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>
This commit is contained in:
Peter Hutterer 2021-08-03 12:03:23 +10:00
parent 375618b81b
commit b925b55634
2 changed files with 9 additions and 4 deletions

View file

@ -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 "*************************************************"

View file

@ -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)