From 3c9cefc70f7c05e7dcfd494116b96b802113b46a Mon Sep 17 00:00:00 2001 From: Brett Chabot Date: Mon, 6 Jun 2011 20:53:56 -0700 Subject: [PATCH] Remove runtest hard dependency on test_defs.xml files. Previously runtest would fail hard if development/test_runner/test_defs.xml file was not present, even if it wasn't needed (ie running in --path mode). This commit skips test_defs parsing if --path is specified, and only parses development/test_runner/test_defs.xml if its present. Bug 4556556 Change-Id: Ief2dbbdab5c7e82e5db64414392d6e2a564e815d --- testrunner/runtest.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/testrunner/runtest.py b/testrunner/runtest.py index 19102c668..3ecc77b22 100755 --- a/testrunner/runtest.py +++ b/testrunner/runtest.py @@ -195,18 +195,21 @@ class TestRunner(object): Raises: AbortError: If a fatal error occurred when parsing the tests. """ - core_test_path = os.path.join(self._root_path, self._CORE_TEST_PATH) try: known_tests = test_defs.TestDefinitions() - known_tests.Parse(core_test_path) - # read all /vendor/*/tests/testinfo/test_defs.xml paths - vendor_tests_pattern = os.path.join(self._root_path, - self._VENDOR_TEST_PATH) - test_file_paths = glob.glob(vendor_tests_pattern) - for test_file_path in test_file_paths: - known_tests.Parse(test_file_path) - if os.path.isfile(self._options.user_tests_file): - known_tests.Parse(self._options.user_tests_file) + # only read tests when not in path mode + if not self._options.test_path: + core_test_path = os.path.join(self._root_path, self._CORE_TEST_PATH) + if os.path.isfile(core_test_path): + known_tests.Parse(core_test_path) + # read all /vendor/*/tests/testinfo/test_defs.xml paths + vendor_tests_pattern = os.path.join(self._root_path, + self._VENDOR_TEST_PATH) + test_file_paths = glob.glob(vendor_tests_pattern) + for test_file_path in test_file_paths: + known_tests.Parse(test_file_path) + if os.path.isfile(self._options.user_tests_file): + known_tests.Parse(self._options.user_tests_file) return known_tests except errors.ParseError: raise errors.AbortError