test: make the test jobs dependent on the number of processors
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 28 Oct 2019 05:12:22 +0000 (15:12 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 28 Oct 2019 22:01:00 +0000 (08:01 +1000)
Let's hope the test suite is more successful on puny VMs that way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/litest.c

index 2e17009e7290bc63c9f350a1ba6ce8fea78944d4..2f7e7e4dd682410f466cc287f3d6f96fb14785e0 100644 (file)
@@ -46,6 +46,7 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/sysinfo.h>
 #include <libudev.h>
 #if HAVE_LIBSYSTEMD
 #include <systemd/sd-bus.h>
@@ -73,7 +74,7 @@
 #define UDEV_DEVICE_GROUPS_FILE UDEV_RULES_D \
        "/80-libinput-device-groups-litest-XXXXXX.rules"
 
-static int jobs = 8;
+static int jobs;
 static bool in_debugger = false;
 static bool verbose = false;
 static bool run_deviceless = false;
@@ -4273,6 +4274,8 @@ main(int argc, char **argv)
        if (in_debugger || RUNNING_ON_VALGRIND)
                setenv("CK_FORK", "no", 0);
 
+       jobs = get_nprocs() * 2;
+
        mode = litest_parse_argv(argc, argv);
        if (mode == LITEST_MODE_ERROR)
                return EXIT_FAILURE;