Separately limit concurrent builds or tests
sourcefrog opened this issue · comments
In some trees the test suite might be a lot more (or less) resource intensive than the build.
Linking is often single threaded so it could be good to run many builds in parallel, but if the test suite is very hungry then just setting a high -j may overload the machine.
We could use a semaphore to limit how many threads can be running tests at any time.
Cargo and rustc use the jobserver protocol, possibly you can hook into that.
Yes I think running a single jobserver across all children is a good idea, but probably a separate issue from this one, so I filed #317.
A jobserver would manage resource contention across different builds and stop them thrashing each other, but I don't think that cargo test
or the test framework talk to it, so it wouldn't manage resources between hungry test suites.
(Arguably Nextest, at least, could use it though.)
Ah indeed cargo test doesn't yet - rust-lang/cargo#5609 has some discusssion