mirror of
https://github.com/servo/servo.git
synced 2025-06-08 16:43:28 +00:00
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:
parent
dc431c9bdb
commit
ec28d98080
1 changed files with 3 additions and 24 deletions
|
@ -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',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue