Run all unit tests with just one Cargo command.

Upgrade Cargo to get https://github.com/rust-lang/cargo/pull/1828,
and use it for unit tests.
This allows Cargo to get some more parallelism
when compiling the test crates’ dependencies.

`touch components/util/lib.rs && mach test-unit` on my machine
goes from 149 seconds to 124.
This commit is contained in:
Simon Sapin 2015-10-01 16:46:35 +02:00
parent e2048d57c4
commit 9228b5011d
2 changed files with 7 additions and 6 deletions

View file

@ -1 +1 @@
2015-08-20
2015-10-01

View file

@ -175,12 +175,13 @@ class MachCommands(CommandBase):
if not packages:
packages = set(os.listdir(path.join(self.context.topdir, "tests", "unit")))
args = ["cargo", "test"]
for crate in packages:
result = subprocess.call(
["cargo", "test", "-p", "%s_tests" % crate] + test_patterns,
env=self.build_env(), cwd=self.servo_crate())
if result != 0:
return result
args += ["-p", "%s_tests" % crate]
args += test_patterns
result = subprocess.call(args, env=self.build_env(), cwd=self.servo_crate())
if result != 0:
return result
@Command('test-ref',
description='Run the reference tests',