diff options
author | Matt Brubeck <mbrubeck@limpet.net> | 2014-09-12 21:57:40 -0700 |
---|---|---|
committer | Matt Brubeck <mbrubeck@limpet.net> | 2014-09-12 21:57:40 -0700 |
commit | 25f263b7516e7accc569b5a045ff9bf23c56f8a7 (patch) | |
tree | e40a6d4b00febb373e700251e71e135702b7c574 | |
parent | b64f27b2b69996508eed0a76acc7414a791b1a9e (diff) | |
parent | e6b31a616faaf30c1de45d0dcccc3dd19d5f0b0f (diff) | |
download | servo-25f263b7516e7accc569b5a045ff9bf23c56f8a7.tar.gz servo-25f263b7516e7accc569b5a045ff9bf23c56f8a7.zip |
Merge pull request #3312 from mbrubeck/test-name
Add more arguments to mach test commands. r=jack
-rw-r--r-- | python/servo/testing_commands.py | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index e9e46c30c69..0ce95850f4b 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -57,17 +57,31 @@ class MachCommands(CommandBase): @Command('test-unit', description='Run libservo unit tests', - category='testing') - def test_unit(self): + category='testing', + allow_all_args=True) + @CommandArgument('test_name', default=None, nargs="...", + help="Only run tests that match this pattern") + @CommandArgument('params', default=None, nargs="...", + help="Command-line arguments to be passed to the test harness") + def test_unit(self, test_name=None, params=None): + if params is None: + params = [] + if test_name is not None: + params.append(test_name) self.ensure_bootstrapped() self.ensure_built_tests() - return self.run_test("servo") + return self.run_test("servo", params) @Command('test-ref', description='Run the reference tests', category='testing') - @CommandArgument('--kind', '-k', default=None) - def test_ref(self, kind=None): + @CommandArgument('--kind', '-k', default=None, + help="'cpu' or 'gpu' (default both)") + @CommandArgument('test_name', default=None, nargs="?", + help="Only run tests that match this pattern") + @CommandArgument('servo_params', default=None, nargs="...", + help="Command-line arguments to be passed through to Servo") + def test_ref(self, kind=None, test_name=None, servo_params=None): self.ensure_bootstrapped() self.ensure_built_tests() @@ -78,7 +92,12 @@ class MachCommands(CommandBase): test_start = time() for k in kinds: print("Running %s reftests..." % k) - ret = self.run_test("reftest", [k, test_path]) + test_args = [k, test_path] + if test_name is not None: + test_args.append(test_name) + if servo_params is not None: + test_args += ["--"] + servo_params + ret = self.run_test("reftest", test_args) error = error or ret != 0 elapsed = time() - test_start @@ -88,14 +107,22 @@ class MachCommands(CommandBase): @Command('test-content', description='Run the content tests', - category='testing') - def test_content(self): + category='testing', + allow_all_args=True) + @CommandArgument('test_name', default=None, nargs="?", + help="Only run tests that match this pattern") + def test_content(self, test_name=None): self.ensure_bootstrapped() self.ensure_built_tests() test_path = path.join(self.context.topdir, "tests", "content") + test_args = ["--source-dir=%s" % test_path] + + if test_name is not None: + test_args.append(test_name) + test_start = time() - ret = self.run_test("contenttest", ["--source-dir=%s" % test_path]) + ret = self.run_test("contenttest", test_args) elapsed = time() - test_start print("Content tests completed in %0.2fs" % elapsed) |