diff options
author | Andrew Shu <talklittle@gmail.com> | 2016-06-03 19:42:52 -0700 |
---|---|---|
committer | Andrew Shu <talklittle@gmail.com> | 2016-06-04 14:12:15 -0700 |
commit | 8bc93dde2b82ab77e08ea3c490ca2a0563597d19 (patch) | |
tree | f6d7d84e9d248635c3b190f1ae30298f53bb1e5e /python/servo | |
parent | b0d76ae8920776302fbd49cc308789f79c748406 (diff) | |
download | servo-8bc93dde2b82ab77e08ea3c490ca2a0563597d19.tar.gz servo-8bc93dde2b82ab77e08ea3c490ca2a0563597d19.zip |
mach: Warn and dispatch non-CSS tests for test-css
Diffstat (limited to 'python/servo')
-rw-r--r-- | python/servo/testing_commands.py | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 4fd3bba2fd0..7711c1bfe17 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -337,29 +337,33 @@ class MachCommands(CommandBase): parser=create_parser_wpt) def test_wpt(self, **kwargs): self.ensure_bootstrapped() + return self.run_test_list_or_dispatch("wpt", self._test_wpt, **kwargs) + + def _test_wpt(self, **kwargs): + hosts_file_path = path.join(self.context.topdir, 'tests', 'wpt', 'hosts') + os.environ["hosts_file_path"] = hosts_file_path + run_file = path.abspath(path.join(self.context.topdir, "tests", "wpt", "run_wpt.py")) + return self.wptrunner(run_file, **kwargs) + + # Helper to ensure all specified paths are handled, otherwise dispatch to appropriate test suite. + def run_test_list_or_dispatch(self, correct_suite, correct_function, **kwargs): test_list = kwargs["test_list"] if not test_list: - return self._test_wpt(**kwargs) + return correct_function(**kwargs) else: - # Paths specified on command line. Ensure they are WPT, re-dispatch otherwise. - all_wpt = True + # Paths specified on command line. Ensure they can be handled, re-dispatch otherwise. + all_handled = True for test_path in test_list: suite = self.suite_for_path(test_path) - if "wpt" != suite: - all_wpt = False - print("Warning: %s is not a WPT test. Delegating to test-%s." % (test_path, suite)) - if all_wpt: - return self._test_wpt(**kwargs) + if correct_suite != suite: + all_handled = False + print("Warning: %s is not a %s test. Delegating to test-%s." % (test_path, correct_suite, suite)) + if all_handled: + return correct_function(**kwargs) else: - # Dispatch each test to the correct suite + # Dispatch each test to the correct suite via test() Registrar.dispatch("test", context=self.context, params=test_list) - def _test_wpt(self, **kwargs): - hosts_file_path = path.join(self.context.topdir, 'tests', 'wpt', 'hosts') - os.environ["hosts_file_path"] = hosts_file_path - run_file = path.abspath(path.join(self.context.topdir, "tests", "wpt", "run_wpt.py")) - return self.wptrunner(run_file, **kwargs) - # Helper for test_css and test_wpt: def wptrunner(self, run_file, **kwargs): os.environ["RUST_BACKTRACE"] = "1" @@ -437,6 +441,9 @@ class MachCommands(CommandBase): parser=create_parser_wpt) def test_css(self, **kwargs): self.ensure_bootstrapped() + return self.run_test_list_or_dispatch("css", self._test_css, **kwargs) + + def _test_css(self, **kwargs): run_file = path.abspath(path.join("tests", "wpt", "run_css.py")) return self.wptrunner(run_file, **kwargs) |