Have ./mach test-unit run nothing but cargo test -p unit_tests

All unit tests will move there, and it should be much faster to build
than every other crate together.

Fix #5291.
This commit is contained in:
Simon Sapin 2015-04-07 16:59:56 +02:00
parent dc431c9bdb
commit ec28d98080

View file

@ -102,38 +102,17 @@ class MachCommands(CommandBase):
@Command('test-unit', @Command('test-unit',
description='Run unit tests', description='Run unit tests',
category='testing') category='testing')
@CommandArgument('--package', '-p', default=None,
help="Specific package to test")
@CommandArgument('--component', '-c', default=None,
help="Alias for --package")
@CommandArgument('test_name', nargs=argparse.REMAINDER, @CommandArgument('test_name', nargs=argparse.REMAINDER,
help="Only run tests that match this pattern") help="Only run tests that match this pattern")
def test_unit(self, test_name=None, component=None, package=None): def test_unit(self, test_name=None, component=None, package=None):
if test_name is None: if test_name is None:
test_name = [] test_name = []
if component is not None:
if package is not None:
print("Please use either -p or -c, not both.")
return 1
package = component
self.ensure_bootstrapped() self.ensure_bootstrapped()
def cargo_test(component): return 0 != subprocess.call(
return 0 != subprocess.call( ["cargo", "test", "-p", "unit_tests"]
["cargo", "test", "-p", component] + test_name, env=self.build_env(), cwd=self.servo_crate())
+ test_name, env=self.build_env(), cwd=self.servo_crate())
if package is not None:
return cargo_test(package)
self.ensure_built_tests()
ret = self.run_test("servo", test_name) != 0
for c in os.listdir("components"):
if c != "servo":
ret = ret or cargo_test(c)
return ret
@Command('test-ref', @Command('test-ref',
description='Run the reference tests', description='Run the reference tests',