From ce1f2bab7bdc12ed3ff2b0d96f0000a8d478586b Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 21 Apr 2015 18:24:11 +0200 Subject: Fix up the splitting of the unit tests crate. Closes #5707. (Includes a rebase of it.) Fixes #5688. --- python/servo/testing_commands.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'python/servo/testing_commands.py') diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 62f4f213fbf..81361b0081f 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -101,18 +101,26 @@ class MachCommands(CommandBase): @Command('test-unit', description='Run unit tests', category='testing') + @CommandArgument('--package', '-p', default=None, help="Specific package 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, package=None): + def test_unit(self, test_name=None, package=None): if test_name is None: test_name = [] self.ensure_bootstrapped() - return 0 != subprocess.call( - ["cargo", "test", "-p", "gfx_tests", "net_tests", "script_tests", - "style_tests", "util_tests"] + test_name, - env=self.build_env(), cwd=self.servo_crate()) + if package: + packages = [package] + else: + packages = os.listdir(path.join(self.context.topdir, "tests", "unit")) + + for crate in packages: + result = subprocess.call( + ["cargo", "test", "-p", "%s_tests" % crate] + test_name, + env=self.build_env(), cwd=self.servo_crate()) + if result != 0: + return result @Command('test-ref', description='Run the reference tests', -- cgit v1.2.3