aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorMatthew Rasmus <mattr@zzntd.com>2014-12-04 16:13:23 -0800
committerMatthew Rasmus <mattr@zzntd.com>2014-12-04 16:16:15 -0800
commit0aa6d9c28e8fa5405891728de2c387fc1ce9ac6f (patch)
tree4d930cc16be3696155319282a5b59122eac22ea9 /python
parent3d5fa7b6e2cdcd245053063cff26e1b1132dd5fe (diff)
downloadservo-0aa6d9c28e8fa5405891728de2c387fc1ce9ac6f.tar.gz
servo-0aa6d9c28e8fa5405891728de2c387fc1ce9ac6f.zip
Adds a --component (or -c) argument to test-unit
Example usage: `./mach test-unit -c style`
Diffstat (limited to 'python')
-rw-r--r--python/servo/testing_commands.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index 2db41a2df9c..2384f7c6c1d 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -96,11 +96,11 @@ class MachCommands(CommandBase):
@Command('test-unit',
description='Run unit tests',
category='testing')
- @CommandArgument('test_name', default=None, nargs="...",
+ @CommandArgument('--component', '-c', default=None,
+ help="Specific component to test")
+ @CommandArgument('test_name', nargs=argparse.REMAINDER,
help="Only run tests that match this pattern")
- def test_unit(self, test_name=None):
- if test_name is None:
- test_name = []
+ def test_unit(self, test_name=None, component=None):
self.ensure_bootstrapped()
self.ensure_built_tests()
@@ -108,12 +108,15 @@ class MachCommands(CommandBase):
def cargo_test(component):
return 0 != subprocess.call(
- ["gdb", "--args", "cargo", "test", "-p", component]
+ ["cargo", "test", "-p", component]
+ test_name, env=self.build_env(), cwd=self.servo_crate())
- for component in os.listdir("components"):
- if component != "servo":
- ret = ret or cargo_test(component)
+ if component is not None:
+ ret = ret or cargo_test(component)
+ else:
+ for c in os.listdir("components"):
+ if c != "servo":
+ ret = ret or cargo_test(c)
return ret