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,39 +102,18 @@ class MachCommands(CommandBase):
|
|||
@Command('test-unit',
|
||||
description='Run unit tests',
|
||||
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,
|
||||
help="Only run tests that match this pattern")
|
||||
def test_unit(self, test_name=None, component=None, package=None):
|
||||
if test_name is None:
|
||||
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()
|
||||
|
||||
def cargo_test(component):
|
||||
return 0 != subprocess.call(
|
||||
["cargo", "test", "-p", component]
|
||||
["cargo", "test", "-p", "unit_tests"]
|
||||
+ 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',
|
||||
description='Run the reference tests',
|
||||
category='testing')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue