mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-11 01:16:24 -04:00
tests/build: Stop sharing the same environment for all tests
This allows us to pass different environments to different tests.
This commit is contained in:
@@ -4,42 +4,39 @@
|
||||
installed_testdir = get_option('prefix') / get_option('libexecdir') / 'installed-tests' / 'Flatpak'
|
||||
installed_tests_metadir = get_option('prefix') / get_option('datadir') / 'installed-tests' / 'Flatpak'
|
||||
|
||||
tests_environment = environment()
|
||||
tests_environment.set('FLATPAK_CONFIG_DIR', '/dev/null')
|
||||
tests_environment.set(
|
||||
'FLATPAK_PORTAL',
|
||||
project_build_root / 'portal' / 'flatpak-portal',
|
||||
)
|
||||
tests_environment.set(
|
||||
'FLATPAK_REVOKEFS_FUSE',
|
||||
project_build_root / 'revokefs' / 'revokefs-fuse',
|
||||
)
|
||||
tests_environment.set('FLATPAK_TESTS_DEBUG', '1')
|
||||
tests_environment.set('FLATPAK_TESTS_STRICT_TAP', '1')
|
||||
tests_environment.set('FLATPAK_TRIGGERSDIR', project_source_root / 'triggers')
|
||||
tests_environment.set(
|
||||
'FLATPAK_VALIDATE_ICON',
|
||||
project_build_root / 'icon-validator' / 'flatpak-validate-icon',
|
||||
)
|
||||
tests_environment.set('FUSERMOUNT', fusermount)
|
||||
tests_environment.set('G_TEST_BUILDDIR', meson.current_build_dir())
|
||||
tests_environment.set('G_TEST_SRCDIR', meson.current_source_dir())
|
||||
tests_environment.prepend('GI_TYPELIB_PATH', project_build_root / 'common')
|
||||
tests_environment.prepend('LD_LIBRARY_PATH', project_build_root / 'common')
|
||||
tests_environment.prepend('PATH', project_build_root / 'app')
|
||||
|
||||
if get_option('system_bubblewrap') == ''
|
||||
tests_environment.set('FLATPAK_BWRAP', project_build_root / 'subprojects' / 'bubblewrap' / 'flatpak-bwrap')
|
||||
env_flatpak_bwrap = project_build_root / 'subprojects' / 'bubblewrap' / 'flatpak-bwrap'
|
||||
else
|
||||
tests_environment.set('FLATPAK_BWRAP', get_option('system_bubblewrap'))
|
||||
env_flatpak_bwrap = get_option('system_bubblewrap')
|
||||
endif
|
||||
|
||||
if get_option('system_dbus_proxy') == ''
|
||||
tests_environment.set('FLATPAK_DBUSPROXY', project_build_root / 'subprojects' / 'dbus-proxy' / 'flatpak-dbus-proxy')
|
||||
env_flatpak_dbusproxy = project_build_root / 'subprojects' / 'dbus-proxy' / 'flatpak-dbus-proxy'
|
||||
else
|
||||
tests_environment.set('FLATPAK_DBUSPROXY', get_option('system_dbus_proxy'))
|
||||
env_flatpak_dbusproxy = get_option('system_dbus_proxy')
|
||||
endif
|
||||
|
||||
tests_environment = {
|
||||
'FLATPAK_CONFIG_DIR' : '/dev/null',
|
||||
'FLATPAK_PORTAL' : project_build_root / 'portal' / 'flatpak-portal',
|
||||
'FLATPAK_REVOKEFS_FUSE' : project_build_root / 'revokefs' / 'revokefs-fuse',
|
||||
'FLATPAK_TESTS_DEBUG' : '1',
|
||||
'FLATPAK_TESTS_STRICT_TAP' : '1',
|
||||
'FLATPAK_TRIGGERSDIR' : project_source_root / 'triggers',
|
||||
'FLATPAK_VALIDATE_ICON' : project_build_root / 'icon-validator' / 'flatpak-validate-icon',
|
||||
'FUSERMOUNT' : fusermount,
|
||||
'G_TEST_BUILDDIR' : meson.current_build_dir(),
|
||||
'G_TEST_SRCDIR' : meson.current_source_dir(),
|
||||
'FLATPAK_BWRAP' : env_flatpak_bwrap,
|
||||
'FLATPAK_DBUSPROXY' : env_flatpak_dbusproxy,
|
||||
}
|
||||
|
||||
tests_environment_prepend = {
|
||||
'GI_TYPELIB_PATH' : project_build_root / 'common',
|
||||
'LD_LIBRARY_PATH' : project_build_root / 'common',
|
||||
'PATH' : project_build_root / 'app',
|
||||
}
|
||||
|
||||
if get_option('installed_tests')
|
||||
configure_file(
|
||||
input : 'installed-tests.sh.in',
|
||||
@@ -164,13 +161,18 @@ foreach testcase : c_tests
|
||||
)
|
||||
endif
|
||||
|
||||
test_env = environment(tests_environment)
|
||||
foreach k, v: tests_environment_prepend
|
||||
test_env.prepend(k, v)
|
||||
endforeach
|
||||
|
||||
if can_run_host_binaries
|
||||
test(
|
||||
name,
|
||||
tap_test,
|
||||
args : [exe],
|
||||
depends : runtime_repo,
|
||||
env : tests_environment,
|
||||
env : test_env,
|
||||
protocol : 'tap',
|
||||
timeout : options.get('timeout', 30),
|
||||
)
|
||||
@@ -382,13 +384,18 @@ foreach testcase : wrapped_tests
|
||||
)
|
||||
endif
|
||||
|
||||
test_env = environment(tests_environment)
|
||||
foreach k, v: tests_environment_prepend
|
||||
test_env.prepend(k, v)
|
||||
endforeach
|
||||
|
||||
if can_run_host_binaries
|
||||
test(
|
||||
name,
|
||||
tap_test,
|
||||
args : [meson.current_source_dir() / name],
|
||||
depends : runtime_repo,
|
||||
env : tests_environment,
|
||||
env : test_env,
|
||||
is_parallel : is_parallel,
|
||||
protocol : 'tap',
|
||||
timeout : timeout,
|
||||
|
||||
Reference in New Issue
Block a user