mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
test: Only set environment variable if integration tests are enabled.
If we set it to '0' if integration tests are not enabled then we can't enable them from the command line since environment from meson takes priority over environment variables from the command line. We also rename the related variables to avoid conflicts with the existing integration_tests variable.
This commit is contained in:
parent
fc4bac8162
commit
38db5eff34
16
meson.build
16
meson.build
@ -319,9 +319,9 @@ userspace_c_ld_args = []
|
||||
meson_build_sh = find_program('tools/meson-build.sh')
|
||||
|
||||
want_tests = get_option('tests')
|
||||
slow_tests = want_tests != 'false' and get_option('slow-tests')
|
||||
fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
|
||||
integration_tests = want_tests != 'false' and get_option('integration-tests')
|
||||
want_slow_tests = want_tests != 'false' and get_option('slow-tests')
|
||||
want_fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
|
||||
want_integration_tests = want_tests != 'false' and get_option('integration-tests')
|
||||
install_tests = want_tests != 'false' and get_option('install-tests')
|
||||
|
||||
if add_languages('cpp', native : false, required : fuzzer_build)
|
||||
@ -1684,7 +1684,7 @@ conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesync
|
||||
conf.set10('ENABLE_SSH_PROXY_CONFIG', sshconfdir != 'no')
|
||||
conf.set10('ENABLE_SSH_USERDB_CONFIG', conf.get('ENABLE_USERDB') == 1 and sshdconfdir != 'no')
|
||||
|
||||
conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
|
||||
conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', want_slow_tests)
|
||||
|
||||
#####################################################################
|
||||
|
||||
@ -2594,7 +2594,7 @@ endif
|
||||
#####################################################################
|
||||
|
||||
mkosi = find_program('mkosi', required : false)
|
||||
if integration_tests and not mkosi.found()
|
||||
if want_integration_tests and not mkosi.found()
|
||||
error('Could not find mkosi which is required to run the integration tests')
|
||||
endif
|
||||
|
||||
@ -2729,7 +2729,7 @@ foreach tuple : fuzz_sanitizers
|
||||
message('Not compiling @0@ because tests is set to false'.format(name))
|
||||
continue
|
||||
endif
|
||||
if not fuzz_tests
|
||||
if not want_fuzz_tests
|
||||
message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
|
||||
continue
|
||||
endif
|
||||
@ -3028,8 +3028,8 @@ foreach tuple : [
|
||||
['debug mmap cache'],
|
||||
['debug siphash'],
|
||||
['trace logging', conf.get('LOG_TRACE') == 1],
|
||||
['slow tests', slow_tests],
|
||||
['fuzz tests', fuzz_tests],
|
||||
['slow tests', want_slow_tests],
|
||||
['fuzz tests', want_fuzz_tests],
|
||||
['install tests', install_tests],
|
||||
['link-udev-shared', get_option('link-udev-shared')],
|
||||
['link-systemctl-shared', get_option('link-systemctl-shared')],
|
||||
|
@ -14,8 +14,7 @@ test_env = environment()
|
||||
test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
|
||||
test_env.set('PATH', project_build_root + ':' + path)
|
||||
test_env.set('PROJECT_BUILD_ROOT', project_build_root)
|
||||
test_env.set('SYSTEMD_SLOW_TESTS', slow_tests ? '1' : '0')
|
||||
test_env.set('SYSTEMD_INTEGRATION_TESTS', integration_tests ? '1' : '0')
|
||||
test_env.set('SYSTEMD_SLOW_TESTS', want_slow_tests ? '1' : '0')
|
||||
|
||||
if efi_addon != ''
|
||||
test_env.set('EFI_ADDON', efi_addon)
|
||||
|
@ -431,12 +431,18 @@ foreach test_number, dirname : integration_tests
|
||||
'--',
|
||||
] + test_params['mkosi_args']
|
||||
|
||||
integration_test_env = {}
|
||||
|
||||
if want_integration_tests
|
||||
integration_test_env = {'SYSTEMD_INTEGRATION_TESTS': '1'}
|
||||
endif
|
||||
|
||||
# We don't explicitly depend on the "mkosi" target because that means the image is rebuilt
|
||||
# on every "ninja -C build". Instead, the mkosi target has to be rebuilt manually before
|
||||
# running the integration tests with mkosi.
|
||||
test(dirname,
|
||||
integration_test_wrapper,
|
||||
env : test_env,
|
||||
env : integration_test_env,
|
||||
args : args,
|
||||
timeout : test_params['timeout'],
|
||||
suite : 'integration-tests')
|
||||
|
Loading…
Reference in New Issue
Block a user