diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2021-08-03 12:03:23 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-08-03 22:14:29 +0000 |
commit | b925b55634cd1c8cc0365c9fc6894f243b627b5e (patch) | |
tree | c2c1b7895a00b728897988d96dd9cf255b1bd344 | |
parent | 375618b81bf04788f214a8c32f9a50538f829e75 (diff) | |
download | libinput-b925b55634cd1c8cc0365c9fc6894f243b627b5e.tar.gz |
test: use MESON_TESTTHREADS to determine the number of jobs
meson uses MESON_TESTTHREADS to determine the number of parallel test
jobs. Since our main test suite cannot be run in parallel anyway, use
that same variable in litest to determine how many jobs we should fork
off.
In the CI pipeline, we can use FDO_CI_CONCURRENT to pass that down so we
don't end up running a billion jobs on a test runner.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rwxr-xr-x | .gitlab-ci/meson-build.sh | 3 | ||||
-rw-r--r-- | test/litest.c | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/.gitlab-ci/meson-build.sh b/.gitlab-ci/meson-build.sh index c2ca0a1e..56b1abcc 100755 --- a/.gitlab-ci/meson-build.sh +++ b/.gitlab-ci/meson-build.sh @@ -22,7 +22,8 @@ if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]]; then fi if [[ -n "$FDO_CI_CONCURRENT" ]]; then - NINJA_ARGS="-j${FDO_CI_CONCURRENT} $NINJA_ARGS" + NINJA_ARGS="-j$FDO_CI_CONCURRENT $NINJA_ARGS" + MESON_TESTTHREADS="$FDO_CI_CONCURRENT" fi echo "*************************************************" diff --git a/test/litest.c b/test/litest.c index 462b9fab..54278bfa 100644 --- a/test/litest.c +++ b/test/litest.c @@ -4627,14 +4627,18 @@ main(int argc, char **argv) int tty_mode = -1; int failed_tests; int rc; + const char *meson_testthreads; in_debugger = is_debugger_attached(); if (in_debugger || RUNNING_ON_VALGRIND) setenv("CK_FORK", "no", 0); - jobs = get_nprocs(); - if (!RUNNING_ON_VALGRIND) - jobs *= 2; + if ((meson_testthreads = getenv("MESON_TESTTHREADS")) == NULL || + !safe_atoi(meson_testthreads, &jobs)) { + jobs = get_nprocs(); + if (!RUNNING_ON_VALGRIND) + jobs *= 2; + } mode = litest_parse_argv(argc, argv); if (mode == LITEST_MODE_ERROR) |