a848cde3

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Respect the cores nix gave the build

A test suite compiled with -N asks the RTS for every core of the machine
it runs on, which inside a nix build is not what the build was given.
Nix's cores setting reaches a build only as NIX_BUILD_CORES, so read
that, and let it decide how parallel to run when nothing else does.
Nix's --max-jobs is not visible to a build at all, so there is nothing
to respect there.

It narrows only the ByCapabilities case. Anything configured explicitly
still decides: --jobs, --synchronous, SYDTEST_JOBS, threads in the
config file, and --debug all win, so an ambient variable cannot override
a config file. The narrowing also happens after the warning about
compiling with -N is decided, so a suite stuck on one capability is
still told to add it rather than silently running n-way on one core.

Zero threads now means every capability rather than an asynchronous
runner with no workers. --jobs 0 left nothing to take tests off the
queue and the suite died with "thread blocked indefinitely in an STM
transaction". Nix documents 0 as "use every core", and the mutation
driver's own job counts have always treated it that way, so every route
into a thread count now agrees.
GitHub

Total

2m35s

Created Started Finished

Time to Start Worker time Duration Time to finish Idle
Config 3m16s 1s 1s 3m18s 3m16s
Eval 3m19s 2m32s 2m32s 5m52s 1m18s
Build - - - - -
Suite 3m16s 2m34s 2m35s 5m52s 4m35s

Timeline

Config Eval Failed Retried Compressed gap
0s3m20s3m40s4m4m20s4m40s5m5m20s5m40s