Cargo runs tests in parallel for a single crate, but each test crate is run one after the other in series at the moment. I have a cargo PR that adds a
--test-jobs arg to parallise the test execution: [WIP] parallel test crates by gilescope · Pull Request #10052 · rust-lang/cargo · GitHub
At the moment the PR doesn't constrain the parallism (aside from you can pass a corse
--test-threads to the test runners).
As projects get bigger this becomes more of an issue and many integration tests have just one test in them so have zero parallelism at the moment.
One direction that could be gone in is establising if the test driver supports the jobserver protocol and using that to manage the parallelism. I'm wondering what other options are on the table? Cargo running test crates in parallel can make an extreamly big difference to how long your CI builds take as well as locally if you have lots of cores (and the trend for cores is more).
Idk, maybe rust can't have nice things, but so far as a community we've generally managed to find a way to have our cake and eat it. There's a very nice cake here, but how do we eat it?
(The hack is of course to move all tests into one test crate but that feels quite a large hack)