[android] Handle non-existent gtest XML result file.
Bug: 765673 Change-Id: Icb0dcc89e2898f7a03c6558aa4ff07eef9508ac6 Reviewed-on: https://chromium-review.googlesource.com/668796 Reviewed-by: Benjamin Pastene <bpastene@chromium.org> Commit-Queue: John Budorick <jbudorick@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#502382} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 79cd156c0988e6bf20bf81e84912265ef467068b
This commit is contained in:
Родитель
4564130c3b
Коммит
4843ac7296
|
@ -207,10 +207,11 @@ def ParseGTestOutput(output, symbolizer, device_abi):
|
|||
def ParseGTestXML(xml_content):
|
||||
"""Parse gtest XML result."""
|
||||
results = []
|
||||
if not xml_content:
|
||||
return results
|
||||
|
||||
html = HTMLParser.HTMLParser()
|
||||
|
||||
# TODO(jbudorick): Unclear how this handles crashes.
|
||||
testsuites = xml.etree.ElementTree.fromstring(xml_content)
|
||||
for testsuite in testsuites:
|
||||
suite_name = testsuite.attrib['name']
|
||||
|
|
|
@ -177,6 +177,10 @@ class GtestTestInstanceTests(unittest.TestCase):
|
|||
self.assertEquals(1, actual[0].GetDuration())
|
||||
self.assertEquals(base_test_result.ResultType.PASS, actual[0].GetType())
|
||||
|
||||
def testParseGTestXML_none(self):
|
||||
actual = gtest_test_instance.ParseGTestXML(None)
|
||||
self.assertEquals([], actual)
|
||||
|
||||
def testConvertTestFilterFile_commentsAndBlankLines(self):
|
||||
input_lines = [
|
||||
'positive1',
|
||||
|
|
|
@ -421,9 +421,16 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
|
|||
timeout=timeout, retries=0)
|
||||
|
||||
if self._test_instance.enable_xml_result_parsing:
|
||||
gtest_xml = device.ReadFile(
|
||||
device_tmp_results_file.name,
|
||||
as_root=True)
|
||||
try:
|
||||
gtest_xml = device.ReadFile(
|
||||
device_tmp_results_file.name,
|
||||
as_root=True)
|
||||
except device_errors.CommandFailedError as e:
|
||||
logging.warning(
|
||||
'Failed to pull gtest results XML file %s: %s',
|
||||
device_tmp_results_file.name,
|
||||
str(e))
|
||||
gtest_xml = None
|
||||
|
||||
for s in self._servers[str(device)]:
|
||||
s.Reset()
|
||||
|
|
Загрузка…
Ссылка в новой задаче