Commit 5dc6fc46 authored by Zhaoyang Li's avatar Zhaoyang Li Committed by Commit Bot

[iOS][test runner] Fix getting artifacts and diagnostic logs

The APIs were updated to use output path but the calls were not updated
and causing folder not found warnings. Update the call to fix. Added a
unit test to ensure correct argument is passed in.

Bug: None
Change-Id: I7e8405bdf4ac61d47e78a968a25587dac28e09e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2529239Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Zhaoyang Li <zhaoyangli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826543}
parent c559eaa8
......@@ -279,8 +279,8 @@ class Xcode11LogParser(object):
# For some crashed tests info about error contained only in root node.
test_results['failed'] = Xcode11LogParser._list_of_failed_tests(root)
Xcode11LogParser._get_test_statuses(xcresult, test_results)
Xcode11LogParser.export_diagnostic_data(xcresult)
Xcode11LogParser.copy_artifacts(xcresult)
Xcode11LogParser.export_diagnostic_data(output_path)
Xcode11LogParser.copy_artifacts(output_path)
# Remove the symbol link file.
if os.path.islink(output_path):
os.unlink(output_path)
......
......@@ -583,6 +583,21 @@ class XCode11LogParserTest(test_runner_test.TestCase):
self.assertEqual(['TestCase1/method1', 'TestCase2/method1'],
res['passed'])
@mock.patch('file_util.zip_and_remove_folder')
@mock.patch('xcode_log_parser.Xcode11LogParser.copy_artifacts')
@mock.patch('xcode_log_parser.Xcode11LogParser.export_diagnostic_data')
@mock.patch('os.path.exists', autospec=True)
@mock.patch('xcode_log_parser.Xcode11LogParser._xcresulttool_get')
@mock.patch('xcode_log_parser.Xcode11LogParser._list_of_failed_tests')
def testArtifactsDiagnosticLogsExportedInCollectTestTesults(
self, mock_get_failed_tests, mock_root, mock_exist_file,
mock_export_diagnostic_data, mock_copy_artifacts, mock_zip):
mock_root.side_effect = _xcresulttool_get_side_effect
mock_exist_file.return_value = True
xcode_log_parser.Xcode11LogParser().collect_test_results(OUTPUT_PATH, [])
mock_export_diagnostic_data.assert_called_with(OUTPUT_PATH)
mock_copy_artifacts.assert_called_with(OUTPUT_PATH)
if __name__ == '__main__':
unittest.main()
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