Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: scripts/slave/recipe_modules/chromium_android/api.py

Issue 2206113002: [WebView] Update CTS logic to load test name from json. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: [WebView] Update CTS logic to load test name from json. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/chromium_android/example.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 '--adb-path', self.m.adb.adb_path(), 1142 '--adb-path', self.m.adb.adb_path(),
1143 '--device-path', _WEBVIEW_COMMAND_LINE, 1143 '--device-path', _WEBVIEW_COMMAND_LINE,
1144 '--executable', 'webview', 1144 '--executable', 'webview',
1145 ] 1145 ]
1146 command_line_script_args.extend(command_line_args) 1146 command_line_script_args.extend(command_line_args)
1147 self.m.python('write webview command line file', 1147 self.m.python('write webview command line file',
1148 self.m.path['checkout'].join( 1148 self.m.path['checkout'].join(
1149 'build', 'android', 'adb_command_line.py'), 1149 'build', 'android', 'adb_command_line.py'),
1150 command_line_script_args) 1150 command_line_script_args)
1151 1151
1152 def run_webview_cts(self, command_line_args=None, suffix=None): 1152 def run_webview_cts(self, command_line_args=None, suffix=None,
1153 android_platform='L', arch='arm_64'):
the real yoland 2016/08/03 23:25:01 wouldn't the n bot still run this without android_
mikecase (-- gone --) 2016/08/03 23:34:27 Yes, yeah............................... So about
1153 suffix = ' (%s)' % suffix if suffix else '' 1154 suffix = ' (%s)' % suffix if suffix else ''
1154 if command_line_args: 1155 if command_line_args:
1155 self._set_webview_command_line(command_line_args) 1156 self._set_webview_command_line(command_line_args)
1156 1157
1157 _CTS_CONFIG_SRC_PATH = self.m.path['checkout'].join( 1158 _CTS_CONFIG_SRC_PATH = self.m.path['checkout'].join(
1158 'android_webview', 'tools', 'cts_config') 1159 'android_webview', 'tools', 'cts_config')
1159 _cts_file_name = self.m.file.read( 1160 cts_filenames_json = self.m.file.read(
1160 'Fetch for the name of the cts file', 1161 'Fetch CTS filename data',
1161 _CTS_CONFIG_SRC_PATH.join('webview_cts_gcs_path.txt'), 1162 _CTS_CONFIG_SRC_PATH.join('webview_cts_gcs_path.json'),
1162 test_data='android-cts-5.1_r5-linux_x86-arm.zip') 1163 test_data='''
1163 _CTS_XML_TESTCASE_ELEMENTS = ('./TestPackage/TestSuite[@name="android"]/' 1164 {
1164 'TestSuite[@name="webkit"]/' 1165 "arm_64": {
1165 'TestSuite[@name="cts"]/TestCase') 1166 "L": "cts_arm64_L.zip"
1166 self_result = self.m.step.active_result 1167 }
1167 self_result.presentation.logs['cts_file_name'] = [_cts_file_name] 1168 }''')
1168 _cts_file_name = _cts_file_name.strip() 1169 cts_filenames = self.m.json.loads(cts_filenames_json)
1169 # WebView user agent is changed, and new CTS hasn't been published to 1170 try:
1170 # reflect that. 1171 cts_filename = cts_filenames[arch][android_platform]
1172 except KeyError:
1173 raise self.m.step.StepFailure(
1174 'No CTS test found to use for arch:%s android:%s' % (
1175 arch, android_platform))
1176
1171 expected_failure_json = self.m.file.read( 1177 expected_failure_json = self.m.file.read(
1172 'Fetch the expected failures tests for CTS from chromium checkout', 1178 'Fetch expected failures data',
1173 _CTS_CONFIG_SRC_PATH.join('expected_failure_on_bot.json'), 1179 _CTS_CONFIG_SRC_PATH.join('expected_failure_on_bot.json'),
1174 test_data = ''' 1180 test_data = '''
1175 { 1181 {
1176 "android.webkit.cts.ExampleBlacklistedTest": 1182 "android.webkit.cts.ExampleBlacklistedTest":
1177 [ 1183 [
1178 { 1184 {
1179 "name": "testA", 1185 "name": "testA",
1180 "_bug_id": "crbug.com/123" 1186 "_bug_id": "crbug.com/123"
1181 }, 1187 },
1182 {"name": "testB"} 1188 {"name": "testB"}
1183 ] 1189 ]
1184 }''' 1190 }''')
1185 )
1186 expected_failure = self.m.json.loads(expected_failure_json) 1191 expected_failure = self.m.json.loads(expected_failure_json)
1187 1192
1188 cts_base_dir = self.m.path['cache'].join('android_cts') 1193 cts_base_dir = self.m.path['cache'].join('android_cts')
1189 cts_zip_path = cts_base_dir.join(_cts_file_name) 1194 cts_zip_path = cts_base_dir.join(cts_filename)
1190 cts_extract_dir = cts_base_dir.join('unzipped') 1195 cts_extract_dir = cts_base_dir.join('unzipped')
1191 if not self.m.path.exists(cts_zip_path): 1196 if not self.m.path.exists(cts_zip_path):
1192 with self.m.step.nest('Update CTS'): 1197 with self.m.step.nest('Update CTS'):
1193 # Remove all old cts files before downloading new one. 1198 # Remove all old cts files before downloading new one.
1194 self.m.file.rmtree('Delete old CTS', cts_base_dir) 1199 self.m.file.rmtree('Delete old CTS', cts_base_dir)
1195 self.m.file.makedirs('Create CTS dir', cts_base_dir) 1200 self.m.file.makedirs('Create CTS dir', cts_base_dir)
1196 self.m.gsutil.download(name='Download new CTS', 1201 self.m.gsutil.download(name='Download new CTS',
1197 bucket='chromium-cts', 1202 bucket='chromium-cts',
1198 source=_cts_file_name, 1203 source=cts_filename,
1199 dest=cts_zip_path) 1204 dest=cts_zip_path)
1200 self.m.zip.unzip(step_name='Extract new CTS', 1205 self.m.zip.unzip(step_name='Extract new CTS',
1201 zip_file=cts_zip_path, 1206 zip_file=cts_zip_path,
1202 output=cts_extract_dir) 1207 output=cts_extract_dir)
1203 1208
1204 cts_path = cts_extract_dir.join('android-cts', 'tools', 'cts-tradefed') 1209 cts_path = cts_extract_dir.join('android-cts', 'tools', 'cts-tradefed')
1205 env = {'PATH': self.m.path.pathsep.join([self.m.adb.adb_dir(), '%(PATH)s'])} 1210 env = {'PATH': self.m.path.pathsep.join([self.m.adb.adb_dir(), '%(PATH)s'])}
1206 1211
1207 try: 1212 try:
1208 self.m.step('Run CTS%s' % suffix, 1213 self.m.step('Run CTS%s' % suffix,
(...skipping 15 matching lines...) Expand all
1224 if (len(split) > 1): 1229 if (len(split) > 1):
1225 return split[1] 1230 return split[1]
1226 raise self.m.step.StepFailure( 1231 raise self.m.step.StepFailure(
1227 "Failed to parse the CTS output for the xml report file location") 1232 "Failed to parse the CTS output for the xml report file location")
1228 1233
1229 report_xml = self.m.file.read('Read test result and report failures', 1234 report_xml = self.m.file.read('Read test result and report failures',
1230 find_test_report_html(result.stdout)) 1235 find_test_report_html(result.stdout))
1231 root = ElementTree.fromstring(report_xml) 1236 root = ElementTree.fromstring(report_xml)
1232 not_executed_tests = [] 1237 not_executed_tests = []
1233 unexpected_test_failures = [] 1238 unexpected_test_failures = []
1239
1240 _CTS_XML_TESTCASE_ELEMENTS = ('./TestPackage/TestSuite[@name="android"]/'
1241 'TestSuite[@name="webkit"]/'
1242 'TestSuite[@name="cts"]/TestCase')
1234 test_classes = root.findall(_CTS_XML_TESTCASE_ELEMENTS) 1243 test_classes = root.findall(_CTS_XML_TESTCASE_ELEMENTS)
1235 1244
1236 for test_class in test_classes: 1245 for test_class in test_classes:
1237 class_name = 'android.webkit.cts.%s' % test_class.get('name') 1246 class_name = 'android.webkit.cts.%s' % test_class.get('name')
1238 test_methods = test_class.findall('./Test') 1247 test_methods = test_class.findall('./Test')
1239 1248
1240 for test_method in test_methods: 1249 for test_method in test_methods:
1241 method_name = '%s#%s' % (class_name, test_method.get('name')) 1250 method_name = '%s#%s' % (class_name, test_method.get('name'))
1242 if test_method.get('result') == 'notExecuted': 1251 if test_method.get('result') == 'notExecuted':
1243 not_executed_tests.append(method_name) 1252 not_executed_tests.append(method_name)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 script = self.c.test_runner 1478 script = self.c.test_runner
1470 if wrapper_script_suite_name: 1479 if wrapper_script_suite_name:
1471 script = self.m.chromium.output_dir.join('bin', 'run_%s' % 1480 script = self.m.chromium.output_dir.join('bin', 'run_%s' %
1472 wrapper_script_suite_name) 1481 wrapper_script_suite_name)
1473 else: 1482 else:
1474 env = kwargs.get('env', {}) 1483 env = kwargs.get('env', {})
1475 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', 1484 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR',
1476 self.m.chromium.output_dir) 1485 self.m.chromium.output_dir)
1477 kwargs['env'] = env 1486 kwargs['env'] = env
1478 return self.m.python(step_name, script, args, **kwargs) 1487 return self.m.python(step_name, script, args, **kwargs)
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/chromium_android/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698