test: allow for a LITEST_JOBS environment variable

valgrind struggles with too many parallel jobs, too easy to hit timeouts.
Let's reduce this for the valgrind runs.

Meson doesn't let us pass arguments through depending on the setup, so let's
make this an environment value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-05-27 14:28:24 +10:00
parent fe8a0eee3f
commit 9b414faea2
2 changed files with 13 additions and 1 deletions

View file

@ -889,6 +889,8 @@ if get_option('tests')
valgrind = find_program('valgrind', required : false)
if valgrind.found()
valgrind_env = environment()
valgrind_env.set('LITEST_JOBS', '4')
valgrind_suppressions_file = join_paths(dir_src_test, 'valgrind.suppressions')
add_test_setup('valgrind',
exe_wrapper : [ valgrind,
@ -896,6 +898,7 @@ if get_option('tests')
'--gen-suppressions=all',
'--error-exitcode=3',
'--suppressions=' + valgrind_suppressions_file ],
env : valgrind_env,
timeout_multiplier : 100)
else
message('valgrind not found, disabling valgrind test suite')

View file

@ -3962,6 +3962,7 @@ litest_parse_argv(int argc, char **argv)
JOBS_CUSTOM
} want_jobs = JOBS_DEFAULT;
char *builddir;
char *jobs_env;
/* If we are not running from the builddir, we assume we're running
* against the system as installed */
@ -3973,6 +3974,13 @@ litest_parse_argv(int argc, char **argv)
if (in_debugger)
want_jobs = JOBS_SINGLE;
if ((jobs_env = getenv("LITEST_JOBS"))) {
if (!safe_atoi(jobs_env, &jobs)) {
fprintf(stderr, "LITEST_JOBS environment variable must be positive integer\n");
exit(EXIT_FAILURE);
}
}
while(1) {
int c;
int option_index = 0;
@ -3997,7 +4005,8 @@ litest_parse_argv(int argc, char **argv)
" --verbose\n"
" Enable verbose output\n"
" --jobs 8\n"
" Number of parallel test suites to run (default: 8)\n"
" Number of parallel test suites to run (default: 8).\n"
" This overrides the LITEST_JOBS environment variable.\n"
" --list\n"
" List all tests\n"
"\n"