Skip to content
Snippets Groups Projects
Commit b4fe9ac5 authored by Ludovico de Nittis's avatar Ludovico de Nittis
Browse files

Merge branch 'wip/smcv/move-tests-outside-pv' into 'main'

Move non-PV-specific tests outside tests/pressure-vessel/

See merge request !620
parents f1ab35f1 7efdd799
No related branches found
No related tags found
1 merge request!620Move non-PV-specific tests outside tests/pressure-vessel/
......@@ -33,8 +33,6 @@
#include "steam-runtime-tools/utils-internal.h"
#include "libglnx.h"
#include "utils.h"
static void
try_divert_stdout (void)
{
......
......@@ -152,6 +152,15 @@ test_depends += executable(
install_dir : tests_dir,
)
test_depends += executable(
'helper',
'helper.c',
dependencies : [glib, libglnx_dep, libsteamrt_static_dep],
include_directories : project_include_dirs,
install : get_option('installed_tests'),
install_dir : tests_dir,
)
test_depends += executable(
'logging-helper',
'logging-helper.c',
......@@ -483,8 +492,16 @@ install_data(
test_scripts = [
{'name': 'check-python.py'},
{'name': 'check-sh.sh'},
{'name': 'test-utils.py'},
]
if get_option('bin')
test_scripts += [
{'name': 'test-launcher.py', 'dbus': true, 'timeout': 90},
{'name': 'test-launcher.py', 'dbus': true, 'full_python': true, 'timeout': 90},
]
endif
if get_option('libcurl_compat')
test_scripts += [
{'name': 'libcurl-compat.py'},
......@@ -494,28 +511,58 @@ endif
foreach test_info : test_scripts
test_name = test_info['name']
program = files(test_name)
program_path = program
wrapper = ''
relocatable_wrapper = ''
test_argv = []
timeout = 30
timeout = test_info.get('timeout', 30)
build_time = test_info.get('build_time', true)
installable = test_info.get('installable', true)
needs_dbus = test_info.get('dbus', false)
if test_name.endswith('.py')
if test_info.get('full_python', false)
test_name = 'full-python-' + test_name
test_argv += ['-S', program]
program = full_python
program_path = program.full_path()
installable = false
elif test_name.endswith('.py')
test_argv += ['-S', program]
program = python
program_path = program.full_path()
wrapper = get_option('prefix') / tests_dir / 'find-python.sh'
relocatable_wrapper = '${G_TEST_BUILDDIR}/find-python.sh'
endif
test(
test_name, program,
args : test_argv,
depends : test_depends,
env : test_env,
protocol : 'tap',
timeout : timeout,
)
if needs_dbus
installable = false
if dbus_run_session.found()
test_argv = [
'--config-file',
no_activation_session_conf,
'--',
program_path,
] + test_argv
program = dbus_run_session
program_path = program.full_path()
else
build_time = false
endif
endif
if get_option('installed_tests')
if build_time
test(
test_name, program,
args : test_argv,
depends : test_depends,
env : test_env,
protocol : 'tap',
timeout : timeout,
)
endif
if get_option('installed_tests') and installable
install_data(
test_name,
install_dir : tests_dir,
......
......@@ -33,7 +33,6 @@ test_env.prepend('PYTHONPATH', meson.current_source_dir() / '..')
# Helper programs and manual tests
helpers = [
'cheap-copy',
'helper',
'mtree-apply',
]
......@@ -62,10 +61,8 @@ tests = [
'cheap-copy.py',
'containers.py',
'invocation.py',
'launcher.py',
'mtree-apply.py',
'test-locale-gen.sh',
'utils.py',
]
compiled_tests = [
......@@ -126,16 +123,16 @@ foreach test_info : compiled_tests
endforeach
foreach test_name : tests
program = files(test_name)
test_argv = []
timeout = 30
if test_name.endswith('.py')
test_argv += [python.full_path(), '-S']
test_argv = ['-S', program] + test_argv
program = python
endif
test_argv += [files(test_name)]
if test_name in ['test-locale-gen.sh', 'launcher.py']
if test_name in ['test-locale-gen.sh']
timeout = 90
endif
......@@ -143,38 +140,16 @@ foreach test_name : tests
timeout = 300
endif
if dbus_run_session.found()
test(
test_name, dbus_run_session,
args : [
'--config-file', no_activation_session_conf,
'--',
] + test_argv,
depends : test_depends,
env : test_env,
protocol : 'tap',
suite : ['pressure-vessel'],
timeout : timeout,
)
# Re-run launcher.py with the default python3 version (if any)
# to try the code path involving gi.repository.Gio
if test_name == 'launcher.py' and full_python.found()
test(
'full-python-' + test_name,
dbus_run_session,
args : [
'--',
full_python.full_path(),
files(test_name),
],
depends : test_depends,
env : test_env,
protocol : 'tap',
suite : ['pressure-vessel'],
timeout : timeout,
)
endif
endif
test(
test_name, program,
args : test_argv,
depends : test_depends,
env : test_env,
protocol : 'tap',
suite : ['pressure-vessel'],
timeout : timeout,
)
endforeach
# vim:set sw=2 sts=2 et:
......@@ -130,6 +130,7 @@ else
# shellcheck disable=SC2030
(
cd "$tmpdir/cwd"
export LC_ADDRESS=af_ZA
export LC_CTYPE=cy_GB.utf8
export LC_COLLATE=cs_CZ
export LC_IDENTIFICATION=it_IT@euro
......@@ -157,6 +158,7 @@ else
fi
for locale in \
af_ZA \
cs_CZ \
cy_GB.UTF-8 \
cy_GB.utf8 \
......@@ -198,6 +200,7 @@ if "$try_setlocale" "en_US.UTF-8" >/dev/null; then
# shellcheck disable=SC2031
(
cd "$tmpdir/cwd"
unset LC_ADDRESS
unset LC_CTYPE
unset LC_COLLATE
unset LC_IDENTIFICATION
......
......@@ -15,12 +15,6 @@ import time
import uuid
try:
import typing
typing # placate pyflakes
except ImportError:
pass
from testutils import (
BaseTest,
run_subprocess,
......
......@@ -8,12 +8,6 @@ import subprocess
import sys
try:
import typing
typing # placate pyflakes
except ImportError:
pass
from testutils import (
BaseTest,
run_subprocess,
......@@ -24,7 +18,7 @@ from testutils import (
class TestUtils(BaseTest):
def setUp(self) -> None:
super().setUp()
self.helper = os.path.join(self.G_TEST_BUILDDIR, 'test-helper')
self.helper = os.path.join(self.G_TEST_BUILDDIR, 'helper')
def test_divert_stdout(self) -> None:
completed = run_subprocess(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment