def json_writer(): try: yield except Exception: global_results_tags.add('UNRELIABLE_RESULTS') raise finally: if args.isolated_script_test_output: json_results.GenerateJsonTestResultFormatFile(all_raw_results, json_file.name, indent=2) else: json_results.GenerateJsonResultsFile( all_raw_results, json_file.name, global_tags=list(global_results_tags), indent=2)
def json_writer(): try: yield except Exception: global_results_tags.add('UNRELIABLE_RESULTS') raise finally: if args.isolated_script_test_output: interrupted = 'UNRELIABLE_RESULTS' in global_results_tags json_results.GenerateJsonTestResultFormatFile(all_raw_results, interrupted, json_file.name, indent=2) else: json_results.GenerateJsonResultsFile( all_raw_results, json_file.name, global_tags=list(global_results_tags), indent=2) test_class_to_file_name_dict = {} # Test Location is only supported for instrumentation tests as it # requires the size-info file. if test_instance.TestType() == 'instrumentation': test_class_to_file_name_dict = _CreateClassToFileNameDict( args.test_apk) if result_sink_client: for run in all_raw_results: for results in run: for r in results.GetAll(): # Matches chrome.page_info.PageInfoViewTest#testChromePage match = re.search(r'^(.+\..+)#', r.GetName()) test_file_name = test_class_to_file_name_dict.get( match.group(1)) if match else None # Some tests put in non utf-8 char as part of the test # which breaks uploads, so need to decode and re-encode. result_sink_client.Post( r.GetName(), r.GetType(), r.GetDuration(), r.GetLog().decode('utf-8', 'replace').encode('utf-8'), test_file_name, failure_reason=r.GetFailureReason())
def json_writer(): try: yield except Exception: global_results_tags.add('UNRELIABLE_RESULTS') raise finally: if args.isolated_script_test_output: interrupted = 'UNRELIABLE_RESULTS' in global_results_tags json_results.GenerateJsonTestResultFormatFile(all_raw_results, interrupted, json_file.name, indent=2) else: json_results.GenerateJsonResultsFile( all_raw_results, json_file.name, global_tags=list(global_results_tags), indent=2) test_class_to_file_name_dict = {} # Test Location is only supported for instrumentation tests as it # requires the size-info file. if test_instance.TestType() == 'instrumentation': test_class_to_file_name_dict = _CreateClassToFileNameDict( args.test_apk) if result_sink_client: for run in all_raw_results: for results in run: for r in results.GetAll(): # Matches chrome.page_info.PageInfoViewTest#testChromePage match = re.search(r'^(.+\..+)#', r.GetName()) test_file_name = test_class_to_file_name_dict.get( match.group(1)) if match else None _SinkTestResult(r, test_file_name, result_sink_client)