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 re | 9 import re |
10 import sys | 10 import sys |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 devices = json.loads(file_contents) | 352 devices = json.loads(file_contents) |
353 self.m.step.active_result.presentation.step_text += ( | 353 self.m.step.active_result.presentation.step_text += ( |
354 'file format is json, reverting') | 354 'file format is json, reverting') |
355 old_format = '\n'.join(devices) | 355 old_format = '\n'.join(devices) |
356 self.m.file.write( | 356 self.m.file.write( |
357 'revert_device_file', self.known_devices_file, old_format) | 357 'revert_device_file', self.known_devices_file, old_format) |
358 except ValueError: | 358 except ValueError: |
359 # File wasn't json, so no need to revert. | 359 # File wasn't json, so no need to revert. |
360 self.m.step.active_result.presentation.step_text += ( | 360 self.m.step.active_result.presentation.step_text += ( |
361 'file format is compatible') | 361 'file format is compatible') |
362 | 362 |
363 def device_status_check(self, restart_usb=False, **kwargs): | 363 def device_status_check(self, restart_usb=False, **kwargs): |
364 # TODO(bpastene): Remove once chromium revisions prior to | 364 # TODO(bpastene): Remove once chromium revisions prior to |
365 # crrev.com/1faecde0c03013b6cd725da413339c60223f8948 are no longer tested. | 365 # crrev.com/1faecde0c03013b6cd725da413339c60223f8948 are no longer tested. |
366 # See crbug.com/619707 for context. | 366 # See crbug.com/619707 for context. |
367 self.revert_device_file_format() | 367 self.revert_device_file_format() |
368 | 368 |
369 # TODO(phajdan.jr): Remove path['build'] usage, http://crbug.com/437264 . | 369 # TODO(phajdan.jr): Remove path['build'] usage, http://crbug.com/437264 . |
370 args = [ | 370 args = [ |
371 '--adb-path', self.m.adb.adb_path(), | 371 '--adb-path', self.m.adb.adb_path(), |
372 '--blacklist-file', self.blacklist_file, | 372 '--blacklist-file', self.blacklist_file, |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 'logcat_dump', | 853 'logcat_dump', |
854 self.package_repo_resource('scripts', 'slave', 'tee.py'), | 854 self.package_repo_resource('scripts', 'slave', 'tee.py'), |
855 [self.m.chromium.output_dir.join('full_log'), | 855 [self.m.chromium.output_dir.join('full_log'), |
856 '--', | 856 '--', |
857 self.m.path['checkout'].join('build', 'android', | 857 self.m.path['checkout'].join('build', 'android', |
858 'adb_logcat_printer.py'), | 858 'adb_logcat_printer.py'), |
859 self.m.path['checkout'].join('out', 'logcat')], | 859 self.m.path['checkout'].join('out', 'logcat')], |
860 infra_step=True, | 860 infra_step=True, |
861 ) | 861 ) |
862 | 862 |
863 def stack_tool_steps(self): | 863 def stack_tool_steps(self, force_latest_version=False): |
864 build_dir = self.m.path['checkout'].join('out', | 864 build_dir = self.m.path['checkout'].join('out', |
865 self.m.chromium.c.BUILD_CONFIG) | 865 self.m.chromium.c.BUILD_CONFIG) |
866 log_file = build_dir.join('full_log') | 866 log_file = build_dir.join('full_log') |
867 target_arch = self.m.chromium.c.gyp_env.GYP_DEFINES['target_arch'] | 867 target_arch = self.m.chromium.c.gyp_env.GYP_DEFINES['target_arch'] |
868 # gyp converts ia32 to x86, bot needs to do the same | 868 # gyp converts ia32 to x86, bot needs to do the same |
869 target_arch = {'ia32': 'x86'}.get(target_arch) or target_arch | 869 target_arch = {'ia32': 'x86'}.get(target_arch) or target_arch |
870 | 870 |
871 # --output-directory hasn't always exited on these scripts, so use the | 871 # --output-directory hasn't always exited on these scripts, so use the |
872 # CHROMIUM_OUTPUT_DIR environment variable to avoid unrecognized flag | 872 # CHROMIUM_OUTPUT_DIR environment variable to avoid unrecognized flag |
873 # failures on older script versions (e.g. when doing bisects). | 873 # failures on older script versions (e.g. when doing bisects). |
874 # TODO(agrieve): Switch to --output-directory once we don't need bisects | 874 # TODO(agrieve): Switch to --output-directory once we don't need bisects |
875 # to be able to try revisions that happened before Feb 2016. | 875 # to be able to try revisions that happened before Feb 2016. |
876 env = self.m.chromium.get_env() | 876 env = self.m.chromium.get_env() |
877 env['CHROMIUM_OUTPUT_DIR'] = str(build_dir) | 877 env['CHROMIUM_OUTPUT_DIR'] = str(build_dir) |
878 self.m.step( | 878 self.m.step( |
879 'stack_tool_with_logcat_dump', | 879 'stack_tool_with_logcat_dump', |
880 [self.m.path['checkout'].join('third_party', 'android_platform', | 880 [self.m.path['checkout'].join('third_party', 'android_platform', |
881 'development', 'scripts', 'stack'), | 881 'development', 'scripts', 'stack'), |
882 '--arch', target_arch, '--more-info', log_file], | 882 '--arch', target_arch, '--more-info', log_file], |
883 env=env, | 883 env=env, |
884 infra_step=True) | 884 infra_step=True) |
885 tombstones_cmd = [ | 885 tombstones_cmd = [ |
886 self.m.path['checkout'].join('build', 'android', 'tombstones.py'), | 886 self.m.path['checkout'].join('build', 'android', 'tombstones.py'), |
887 '-a', '-s', '-w', | 887 '-a', '-s', '-w', |
888 ] | 888 ] |
889 if int(self.m.chromium.get_version().get('MAJOR', 0)) > 52: | 889 if (force_latest_version or |
| 890 int(self.m.chromium.get_version().get('MAJOR', 0)) > 52): |
890 tombstones_cmd += ['--adb-path', self.m.adb.adb_path()] | 891 tombstones_cmd += ['--adb-path', self.m.adb.adb_path()] |
891 self.m.step( | 892 self.m.step( |
892 'stack_tool_for_tombstones', | 893 'stack_tool_for_tombstones', |
893 tombstones_cmd, | 894 tombstones_cmd, |
894 env=env, | 895 env=env, |
895 infra_step=True) | 896 infra_step=True) |
896 if self.c.asan_symbolize: | 897 if self.c.asan_symbolize: |
897 self.m.step( | 898 self.m.step( |
898 'stack_tool_for_asan', | 899 'stack_tool_for_asan', |
899 [self.m.path['checkout'].join('build', | 900 [self.m.path['checkout'].join('build', |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 # WebView user agent is changed, and new CTS hasn't been published to | 1059 # WebView user agent is changed, and new CTS hasn't been published to |
1059 # reflect that. | 1060 # reflect that. |
1060 expected_failure_json = self.m.file.read( | 1061 expected_failure_json = self.m.file.read( |
1061 'Fetch the expected failures tests for CTS from chromium checkout', | 1062 'Fetch the expected failures tests for CTS from chromium checkout', |
1062 _CTS_CONFIG_SRC_PATH.join('expected_failure_on_bot.json'), | 1063 _CTS_CONFIG_SRC_PATH.join('expected_failure_on_bot.json'), |
1063 test_data = ''' | 1064 test_data = ''' |
1064 { | 1065 { |
1065 "android.webkit.cts.ExampleBlacklistedTest": | 1066 "android.webkit.cts.ExampleBlacklistedTest": |
1066 [ | 1067 [ |
1067 { | 1068 { |
1068 "name": "testA", | 1069 "name": "testA", |
1069 "_bug_id": "crbug.com/123" | 1070 "_bug_id": "crbug.com/123" |
1070 }, | 1071 }, |
1071 {"name": "testB"} | 1072 {"name": "testB"} |
1072 ] | 1073 ] |
1073 }''' | 1074 }''' |
1074 ) | 1075 ) |
1075 expected_failure = self.m.json.loads(expected_failure_json) | 1076 expected_failure = self.m.json.loads(expected_failure_json) |
1076 | 1077 |
1077 cts_base_dir = self.m.path['build'].join('site_config', 'cts') | 1078 cts_base_dir = self.m.path['build'].join('site_config', 'cts') |
1078 cts_zip_path = cts_base_dir.join(_cts_file_name) | 1079 cts_zip_path = cts_base_dir.join(_cts_file_name) |
1079 cts_extract_dir = cts_base_dir.join('unzipped') | 1080 cts_extract_dir = cts_base_dir.join('unzipped') |
1080 if not self.m.path.exists(cts_zip_path): | 1081 if not self.m.path.exists(cts_zip_path): |
1081 with self.m.step.nest('Update CTS'): | 1082 with self.m.step.nest('Update CTS'): |
1082 # Remove all old cts files before downloading new one. | 1083 # Remove all old cts files before downloading new one. |
1083 self.m.file.rmtree('Delete old CTS', cts_base_dir) | 1084 self.m.file.rmtree('Delete old CTS', cts_base_dir) |
1084 self.m.file.makedirs('Create CTS dir', cts_base_dir) | 1085 self.m.file.makedirs('Create CTS dir', cts_base_dir) |
1085 self.m.gsutil.download(name='Download new CTS', | 1086 self.m.gsutil.download(name='Download new CTS', |
1086 bucket='chromium-cts', | 1087 bucket='chromium-cts', |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 | 1125 |
1125 for test_class in test_classes: | 1126 for test_class in test_classes: |
1126 class_name = 'android.webkit.cts.%s' % test_class.get('name') | 1127 class_name = 'android.webkit.cts.%s' % test_class.get('name') |
1127 test_methods = test_class.findall('./Test') | 1128 test_methods = test_class.findall('./Test') |
1128 | 1129 |
1129 for test_method in test_methods: | 1130 for test_method in test_methods: |
1130 method_name = '%s#%s' % (class_name, test_method.get('name')) | 1131 method_name = '%s#%s' % (class_name, test_method.get('name')) |
1131 if test_method.get('result') == 'notExecuted': | 1132 if test_method.get('result') == 'notExecuted': |
1132 not_executed_tests.append(method_name) | 1133 not_executed_tests.append(method_name) |
1133 elif (test_method.find('./FailedScene') is not None and | 1134 elif (test_method.find('./FailedScene') is not None and |
1134 test_method.get('name') not in | 1135 test_method.get('name') not in |
1135 [ t.get('name') for t in | 1136 [ t.get('name') for t in |
1136 expected_failure.get(class_name, []) ]): | 1137 expected_failure.get(class_name, []) ]): |
1137 unexpected_test_failures.append(method_name) | 1138 unexpected_test_failures.append(method_name) |
1138 | 1139 |
1139 if unexpected_test_failures or not_executed_tests: | 1140 if unexpected_test_failures or not_executed_tests: |
1140 self.m.step.active_result.presentation.status = self.m.step.FAILURE | 1141 self.m.step.active_result.presentation.status = self.m.step.FAILURE |
1141 self.m.step.active_result.presentation.step_text += ( | 1142 self.m.step.active_result.presentation.step_text += ( |
1142 self.m.test_utils.format_step_text( | 1143 self.m.test_utils.format_step_text( |
1143 [['unexpected failures:', unexpected_test_failures], | 1144 [['unexpected failures:', unexpected_test_failures], |
1144 ['not executed:', not_executed_tests]])) | 1145 ['not executed:', not_executed_tests]])) |
1145 | 1146 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 script = self.c.test_runner | 1359 script = self.c.test_runner |
1359 if wrapper_script_suite_name: | 1360 if wrapper_script_suite_name: |
1360 script = self.m.chromium.output_dir.join('bin', 'run_%s' % | 1361 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
1361 wrapper_script_suite_name) | 1362 wrapper_script_suite_name) |
1362 else: | 1363 else: |
1363 env = kwargs.get('env', {}) | 1364 env = kwargs.get('env', {}) |
1364 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', | 1365 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', |
1365 self.m.chromium.output_dir) | 1366 self.m.chromium.output_dir) |
1366 kwargs['env'] = env | 1367 kwargs['env'] = env |
1367 return self.m.python(step_name, script, args, **kwargs) | 1368 return self.m.python(step_name, script, args, **kwargs) |
OLD | NEW |