Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import contextlib | 5 import contextlib |
| 6 import datetime | 6 import datetime |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import pipes | 9 import pipes |
| 10 import re | 10 import re |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 927 apk_package=None, | 927 apk_package=None, |
| 928 official_build=False, | 928 official_build=False, |
| 929 json_results_file=None, | 929 json_results_file=None, |
| 930 timeout_scale=None, strict_mode=None, | 930 timeout_scale=None, strict_mode=None, |
| 931 suffix=None, num_retries=None, | 931 suffix=None, num_retries=None, |
| 932 device_flags=None, | 932 device_flags=None, |
| 933 wrapper_script_suite_name=None, | 933 wrapper_script_suite_name=None, |
| 934 result_details=False, | 934 result_details=False, |
| 935 cs_base_url=None, | 935 cs_base_url=None, |
| 936 store_tombstones=False, | 936 store_tombstones=False, |
| 937 render_results_dir=None, | |
| 937 **kwargs): | 938 **kwargs): |
| 938 args = [ | 939 args = [ |
| 939 '--blacklist-file', self.blacklist_file, | 940 '--blacklist-file', self.blacklist_file, |
| 940 ] | 941 ] |
| 941 if tool: | 942 if tool: |
| 942 args.append('--tool=%s' % tool) | 943 args.append('--tool=%s' % tool) |
| 943 if flakiness_dashboard: | 944 if flakiness_dashboard: |
| 944 args.extend(['--flakiness-dashboard-server', flakiness_dashboard]) | 945 args.extend(['--flakiness-dashboard-server', flakiness_dashboard]) |
| 945 if annotation: | 946 if annotation: |
| 946 args.extend(['-A', annotation]) | 947 args.extend(['-A', annotation]) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 annotation or name, ' (%s)' % suffix if suffix else '') | 987 annotation or name, ' (%s)' % suffix if suffix else '') |
| 987 | 988 |
| 988 try: | 989 try: |
| 989 step_result = self.test_runner( | 990 step_result = self.test_runner( |
| 990 step_name, | 991 step_name, |
| 991 args=args, | 992 args=args, |
| 992 wrapper_script_suite_name=wrapper_script_suite_name, | 993 wrapper_script_suite_name=wrapper_script_suite_name, |
| 993 **kwargs) | 994 **kwargs) |
| 994 finally: | 995 finally: |
| 995 result_step = self.m.step.active_result | 996 result_step = self.m.step.active_result |
| 997 if render_results_dir: | |
| 998 self._upload_render_test_failures(render_results_dir) | |
| 996 if result_details: | 999 if result_details: |
| 997 if (hasattr(result_step, 'test_utils') and | 1000 if (hasattr(result_step, 'test_utils') and |
| 998 hasattr(result_step.test_utils, 'gtest_results')): | 1001 hasattr(result_step.test_utils, 'gtest_results')): |
| 999 json_results = self.m.json.input( | 1002 json_results = self.m.json.input( |
| 1000 result_step.test_utils.gtest_results.raw) | 1003 result_step.test_utils.gtest_results.raw) |
| 1001 details = self.create_result_details(step_name, | 1004 details = self.create_result_details(step_name, |
| 1002 json_results, | 1005 json_results, |
| 1003 cs_base_url) | 1006 cs_base_url) |
| 1004 self.m.step.active_result.presentation.logs[ | 1007 self.m.step.active_result.presentation.logs['result_details'] = ( |
|
ghost stip (do not use)
2016/12/08 20:16:02
I would have left it the same as before but this i
| |
| 1005 'result_details'] = details | 1008 details) |
| 1006 self.copy_gtest_results(result_step, | 1009 # Need to copy gtest results over. A few places call |
| 1007 self.m.step.active_result) | 1010 # |run_instrumentation_suite| function and then look for results in |
| 1011 # the active_result. | |
| 1012 self.copy_gtest_results(result_step, self.m.step.active_result) | |
| 1008 return step_result | 1013 return step_result |
| 1009 | 1014 |
| 1010 def copy_gtest_results(self, result_step, active_step): | 1015 def copy_gtest_results(self, result_step, active_step): |
| 1011 if (hasattr(result_step, 'test_utils') and | 1016 if (hasattr(result_step, 'test_utils') and |
| 1012 hasattr(result_step.test_utils, 'gtest_results')): | 1017 hasattr(result_step.test_utils, 'gtest_results')): |
| 1013 active_step.test_utils = result_step.test_utils | 1018 active_step.test_utils = result_step.test_utils |
| 1014 | 1019 |
| 1015 def create_result_details(self, step_name, json_results_file, cs_base_url): | 1020 def create_result_details(self, step_name, json_results_file, cs_base_url): |
| 1016 presentation_args = ['--json-file', | 1021 presentation_args = ['--json-file', |
| 1017 json_results_file, | 1022 json_results_file, |
| 1018 '--master-name', | 1023 '--master-name', |
| 1019 self.m.properties.get('mastername')] | 1024 self.m.properties.get('mastername')] |
| 1020 if cs_base_url: | 1025 if cs_base_url: |
| 1021 presentation_args.extend(['--cs-base-url', cs_base_url]) | 1026 presentation_args.extend(['--cs-base-url', cs_base_url]) |
| 1022 result_details = self.m.python( | 1027 result_details = self.m.python( |
| 1023 '%s: generate result details' % step_name, | 1028 '%s: generate result details' % step_name, |
| 1024 self.resource('test_results_presentation.py'), | 1029 self.resource('test_results_presentation.py'), |
| 1025 args=presentation_args, | 1030 args=presentation_args, |
| 1026 stdout=self.m.raw_io.output(), | 1031 stdout=self.m.raw_io.output(), |
| 1027 step_test_data=( | 1032 step_test_data=( |
| 1028 lambda: self.m.raw_io.test_api.stream_output( | 1033 lambda: self.m.raw_io.test_api.stream_output( |
| 1029 '<!DOCTYPE html><html></html>'))) | 1034 '<!DOCTYPE html><html></html>'))) |
| 1030 return result_details.stdout.splitlines() | 1035 return result_details.stdout.splitlines() |
| 1031 | 1036 |
| 1037 def _upload_render_test_failures(self, render_results_dir): | |
| 1038 """Uploads render test results. Generates HTML file displaying results.""" | |
| 1039 args = ['--output-html-file', self.m.raw_io.output(), | |
| 1040 '--buildername', self.m.properties['buildername'], | |
| 1041 '--build-number', self.m.properties['buildnumber'], | |
| 1042 '--render-results-dir', render_results_dir] | |
| 1043 step_result = self.m.python( | |
| 1044 name='[Render Tests] Upload Results', | |
| 1045 script=self.m.path['checkout'].join( | |
| 1046 'build', 'android', 'render_tests', | |
| 1047 'process_render_test_results.py'), | |
| 1048 args=args, | |
| 1049 step_test_data=lambda: self.m.raw_io.test_api.output( | |
| 1050 '<!DOCTYPE html><html></html>')) | |
| 1051 step_result.presentation.logs['render results'] = ( | |
| 1052 step_result.raw_io.output.splitlines()) | |
| 1053 | |
| 1032 def logcat_dump(self, gs_bucket=None): | 1054 def logcat_dump(self, gs_bucket=None): |
| 1033 if gs_bucket: | 1055 if gs_bucket: |
| 1034 log_path = self.m.chromium.output_dir.join('full_log') | 1056 log_path = self.m.chromium.output_dir.join('full_log') |
| 1035 self.m.python( | 1057 self.m.python( |
| 1036 'logcat_dump', | 1058 'logcat_dump', |
| 1037 self.m.path['checkout'].join('build', 'android', | 1059 self.m.path['checkout'].join('build', 'android', |
| 1038 'adb_logcat_printer.py'), | 1060 'adb_logcat_printer.py'), |
| 1039 [ '--output-path', log_path, | 1061 [ '--output-path', log_path, |
| 1040 self.m.path['checkout'].join('out', 'logcat') ], | 1062 self.m.path['checkout'].join('out', 'logcat') ], |
| 1041 infra_step=True) | 1063 infra_step=True) |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1254 def run_java_unit_test_suite(self, suite, verbose=True, | 1276 def run_java_unit_test_suite(self, suite, verbose=True, |
| 1255 json_results_file=None, suffix=None, **kwargs): | 1277 json_results_file=None, suffix=None, **kwargs): |
| 1256 args = [] | 1278 args = [] |
| 1257 if verbose: | 1279 if verbose: |
| 1258 args.append('--verbose') | 1280 args.append('--verbose') |
| 1259 if self.c.BUILD_CONFIG == 'Release': | 1281 if self.c.BUILD_CONFIG == 'Release': |
| 1260 args.append('--release') | 1282 args.append('--release') |
| 1261 if json_results_file: | 1283 if json_results_file: |
| 1262 args.extend(['--json-results-file', json_results_file]) | 1284 args.extend(['--json-results-file', json_results_file]) |
| 1263 | 1285 |
| 1264 self.test_runner( | 1286 return self.test_runner( |
| 1265 '%s%s' % (str(suite), ' (%s)' % suffix if suffix else ''), | 1287 '%s%s' % (str(suite), ' (%s)' % suffix if suffix else ''), |
| 1266 ['junit', '-s', suite] + args, | 1288 ['junit', '-s', suite] + args, |
| 1267 env=self.m.chromium.get_env(), | 1289 env=self.m.chromium.get_env(), |
| 1268 **kwargs) | 1290 **kwargs) |
| 1269 | 1291 |
| 1270 def _set_webview_command_line(self, command_line_args): | 1292 def _set_webview_command_line(self, command_line_args): |
| 1271 """Set the Android WebView command line. | 1293 """Set the Android WebView command line. |
| 1272 | 1294 |
| 1273 Args: | 1295 Args: |
| 1274 command_line_args: A list of command line arguments you want set for | 1296 command_line_args: A list of command line arguments you want set for |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 script = self.c.test_runner | 1660 script = self.c.test_runner |
| 1639 if wrapper_script_suite_name: | 1661 if wrapper_script_suite_name: |
| 1640 script = self.m.chromium.output_dir.join('bin', 'run_%s' % | 1662 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
| 1641 wrapper_script_suite_name) | 1663 wrapper_script_suite_name) |
| 1642 else: | 1664 else: |
| 1643 env = kwargs.get('env', {}) | 1665 env = kwargs.get('env', {}) |
| 1644 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', | 1666 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', |
| 1645 self.m.chromium.output_dir) | 1667 self.m.chromium.output_dir) |
| 1646 kwargs['env'] = env | 1668 kwargs['env'] = env |
| 1647 return self.m.python(step_name, script, args, **kwargs) | 1669 return self.m.python(step_name, script, args, **kwargs) |
| OLD | NEW |