From 3d5fa7b6e2cdcd245053063cff26e1b1132dd5fe Mon Sep 17 00:00:00 2001 From: Matthew Rasmus Date: Thu, 4 Dec 2014 16:12:22 -0800 Subject: PEP8 line length fixes in testing_commands.py ...so that PyLint stops yelling at me --- python/servo/testing_commands.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'python/servo/testing_commands.py') diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index ff4844731d8..2db41a2df9c 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -36,7 +36,9 @@ class MachCommands(CommandBase): for filename in target_contents: if filename.startswith(prefix + "-"): filepath = path.join( - self.context.topdir, "components", "servo", "target", filename) + self.context.topdir, "components", "servo", + "target", filename) + if path.isfile(filepath) and os.access(filepath, os.X_OK): return filepath @@ -106,8 +108,8 @@ class MachCommands(CommandBase): def cargo_test(component): return 0 != subprocess.call( - ["cargo", "test", "-p", component] + test_name, - env=self.build_env(), cwd=self.servo_crate()) + ["gdb", "--args", "cargo", "test", "-p", component] + + test_name, env=self.build_env(), cwd=self.servo_crate()) for component in os.listdir("components"): if component != "servo": -- cgit v1.2.3 From 0aa6d9c28e8fa5405891728de2c387fc1ce9ac6f Mon Sep 17 00:00:00 2001 From: Matthew Rasmus Date: Thu, 4 Dec 2014 16:13:23 -0800 Subject: Adds a --component (or -c) argument to test-unit Example usage: `./mach test-unit -c style` --- python/servo/testing_commands.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'python/servo/testing_commands.py') 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 -- cgit v1.2.3 From 19d119785c328e6f06fae99bbf6ed1f20eebf14a Mon Sep 17 00:00:00 2001 From: Matthew Rasmus Date: Thu, 4 Dec 2014 16:19:56 -0800 Subject: Last second bug catch --- python/servo/testing_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/servo/testing_commands.py') diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 2384f7c6c1d..a47777d82f7 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -100,7 +100,7 @@ class MachCommands(CommandBase): 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, component=None): + def test_unit(self, test_name, component=None): self.ensure_bootstrapped() self.ensure_built_tests() -- cgit v1.2.3