Commit 705c5a9e authored by Zhaoyang Li's avatar Zhaoyang Li Committed by Commit Bot

[iOS][test runner] Parse passed tests for interrupted builds.

List of passed tests should be parsed for interrupted builds. However,
crrev/c/2473499 interpreted interrupted builds as "not started" and thus
made it not parsing the list, causing unnecessary retries.

.xcresult folder should not be used as indicator that tests didn't start
because it's created at the end of tests. output_path should serve the
purpose because it's created at the beginning of tests.

Bug: None
Change-Id: Icce037c12383e86356a6bdcc95188d22f97bc0b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505757Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Zhaoyang Li <zhaoyangli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822196}
parent e1b75a41
......@@ -229,6 +229,15 @@ class Xcode11LogParser(object):
'failed': {}
}
# Xcodebuild writes staging data to |output_path| folder during test
# execution. If |output_path| doesn't exist, it means tests didn't start at
# all.
if not os.path.exists(output_path):
test_results['failed']['TESTS_DID_NOT_START'] = [
'%s with staging data does not exist.' % output_path
]
return test_results
# During a run `xcodebuild .. -resultBundlePath %output_path%`
# that generates output_path folder,
# but Xcode 11+ generates `output_path.xcresult` and `output_path`
......@@ -238,16 +247,13 @@ class Xcode11LogParser(object):
# on bots. This piece of code uses .xcresult folder.
xcresult = output_path + '.xcresult'
# |output_path|.xcresult folder is created at the end of tests. If
# |output_path| folder exists but |output_path|.xcresult folder doesn't
# exist, it means xcodebuild exited or was killed half way during tests.
if not os.path.exists(xcresult):
test_results['failed']['TESTS_DID_NOT_START'] = [
'%s with test results does not exist.' % xcresult
]
return test_results
plist_path = os.path.join(xcresult, 'Info.plist')
if not os.path.exists(plist_path):
test_results['failed']['BUILD_INTERRUPTED'] = [
'%s with test results does not exist.' % plist_path] + output
'%s with test results does not exist.' % xcresult
] + output
test_results['passed'] = parse_passed_tests_for_interrupted_run(output)
return test_results
......
......@@ -492,7 +492,7 @@ class XCode11LogParserTest(test_runner_test.TestCase):
'passed': [],
'failed': {
'TESTS_DID_NOT_START': [
'%s.xcresult with test results does not exist.' % OUTPUT_PATH
'%s with staging data does not exist.' % OUTPUT_PATH
]
}
}
......@@ -508,8 +508,7 @@ class XCode11LogParserTest(test_runner_test.TestCase):
'passed': [],
'failed': {
'BUILD_INTERRUPTED': [
'%s with test results does not exist.' %
os.path.join(OUTPUT_PATH + '.xcresult', 'Info.plist')
'%s with test results does not exist.' % XCRESULT_PATH
]
}
}
......@@ -566,10 +565,9 @@ class XCode11LogParserTest(test_runner_test.TestCase):
'[09:09:00:INFO] Test case \'-[TestCase2 method1]\' failed on device.',
'** BUILD INTERRUPTED **',
]
not_found_message = [
'Info.plist.xcresult/Info.plist with test results does not exist.']
not_found_message = ['%s with test results does not exist.' % XCRESULT_PATH]
res = xcode_log_parser.Xcode11LogParser().collect_test_results(
'Info.plist', output)
OUTPUT_PATH, output)
self.assertIn('BUILD_INTERRUPTED', res['failed'])
self.assertEqual(not_found_message + output,
res['failed']['BUILD_INTERRUPTED'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment