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
This commit is contained in:
@@ -195,18 +195,21 @@ class TestRunner(object):
|
|||||||
Raises:
|
Raises:
|
||||||
AbortError: If a fatal error occurred when parsing the tests.
|
AbortError: If a fatal error occurred when parsing the tests.
|
||||||
"""
|
"""
|
||||||
core_test_path = os.path.join(self._root_path, self._CORE_TEST_PATH)
|
|
||||||
try:
|
try:
|
||||||
known_tests = test_defs.TestDefinitions()
|
known_tests = test_defs.TestDefinitions()
|
||||||
known_tests.Parse(core_test_path)
|
# only read tests when not in path mode
|
||||||
# read all <android root>/vendor/*/tests/testinfo/test_defs.xml paths
|
if not self._options.test_path:
|
||||||
vendor_tests_pattern = os.path.join(self._root_path,
|
core_test_path = os.path.join(self._root_path, self._CORE_TEST_PATH)
|
||||||
self._VENDOR_TEST_PATH)
|
if os.path.isfile(core_test_path):
|
||||||
test_file_paths = glob.glob(vendor_tests_pattern)
|
known_tests.Parse(core_test_path)
|
||||||
for test_file_path in test_file_paths:
|
# read all <android root>/vendor/*/tests/testinfo/test_defs.xml paths
|
||||||
known_tests.Parse(test_file_path)
|
vendor_tests_pattern = os.path.join(self._root_path,
|
||||||
if os.path.isfile(self._options.user_tests_file):
|
self._VENDOR_TEST_PATH)
|
||||||
known_tests.Parse(self._options.user_tests_file)
|
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
|
return known_tests
|
||||||
except errors.ParseError:
|
except errors.ParseError:
|
||||||
raise errors.AbortError
|
raise errors.AbortError
|
||||||
|
|||||||
Reference in New Issue
Block a user