mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Change mach test-unit
parameter from -c
to -p
For consistency with Cargo params, and related mach commands like `mach update-cargo`. The `-c` version is still available as an alias for compatibility with old scripts.
This commit is contained in:
parent
5765930892
commit
910869f63c
1 changed files with 12 additions and 4 deletions
|
@ -102,14 +102,22 @@ 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,
|
@CommandArgument('--component', '-c', default=None,
|
||||||
help="Specific component to test")
|
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):
|
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()
|
||||||
self.ensure_built_tests()
|
self.ensure_built_tests()
|
||||||
|
|
||||||
|
@ -120,8 +128,8 @@ class MachCommands(CommandBase):
|
||||||
["cargo", "test", "-p", component]
|
["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 component is not None:
|
if package is not None:
|
||||||
ret = ret or cargo_test(component)
|
ret = ret or cargo_test(package)
|
||||||
else:
|
else:
|
||||||
for c in os.listdir("components"):
|
for c in os.listdir("components"):
|
||||||
if c != "servo":
|
if c != "servo":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue