The default timeout for tests is 30s, but that's not always enough time: the Valgrind test, for example, are currently special-cased because they take longer, and on certain architectures where powerful hardware is not (yet) available even the basic test programs might take more than 30s to complete. A concrete example of this happening and preventing a package build from finishing: https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=riscv64&ver=6.7.0-1&stamp=1599587548&raw=0 Make it possible to configure a different timeout for tests. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- meson.build | 2 ++ meson_options.txt | 1 + tests/meson.build | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 0820e4c895..2d5b364979 100644 --- a/meson.build +++ b/meson.build @@ -141,6 +141,8 @@ if get_option('tests_coverage') ] endif +tests_timeout = get_option('tests_timeout') + # Detect when running under the clang static analyzer's scan-build driver # or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly. diff --git a/meson_options.txt b/meson_options.txt index 43ce9b83de..d048ed8dd6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,6 +5,7 @@ option('system', type: 'boolean', value: false, description: 'Set install paths option('runstatedir', type: 'string', value: '', description: 'State directory for temporary sockets, pid files, etc') option('tests_expensive', type: 'feature', value: 'auto', description: 'set the default for enabling expensive tests (long timeouts), use VIR_TEST_EXPENSIVE to override') option('tests_coverage', type: 'boolean', value: false, description: 'turn on code coverage instrumentation') +option('tests_timeout', type: 'integer', value: 30, description: 'time (in seconds) after which a test case is considered failed') option('git_werror', type: 'feature', value: 'auto', description: 'use -Werror if building from GIT') option('rpath', type: 'feature', value: 'auto', description: 'whether to include rpath information in installed binaries and libraries') diff --git a/tests/meson.build b/tests/meson.build index 0a204c46e4..322904910e 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -582,7 +582,7 @@ foreach data : tests ], export_dynamic: true, ) - test(data['name'], test_bin, env: tests_env) + test(data['name'], test_bin, env: tests_env, timeout: tests_timeout) endforeach @@ -681,7 +681,7 @@ endif foreach name : test_scripts script = find_program(name) - test(name, script, env: tests_env) + test(name, script, env: tests_env, timeout: tests_timeout) endforeach add_test_setup( @@ -701,6 +701,6 @@ add_test_setup( '--suppressions=@0@'.format(meson.current_source_dir() / '.valgrind.supp'), '--error-exitcode=1', ], - # default timeout in meson is 30s + # Tests take a lot longer when run under Valgrind timeout_multiplier: 4, ) -- 2.26.2