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 re | 9 import re |
| 10 import urllib | 10 import urllib |
| 11 | 11 |
| 12 from recipe_engine.types import freeze | 12 from recipe_engine.types import freeze |
| 13 from recipe_engine import recipe_api | 13 from recipe_engine import recipe_api |
| 14 | 14 |
| 15 | 15 |
| 16 def _TimestampToIsoFormat(timestamp): | 16 def _TimestampToIsoFormat(timestamp): |
| 17 return datetime.datetime.utcfromtimestamp(timestamp).strftime('%Y%m%dT%H%M%S') | 17 return datetime.datetime.utcfromtimestamp(timestamp).strftime('%Y%m%dT%H%M%S') |
| 18 | 18 |
| 19 | 19 |
| 20 class AndroidApi(recipe_api.RecipeApi): | 20 class AndroidApi(recipe_api.RecipeApi): |
| 21 def __init__(self, **kwargs): | 21 def __init__(self, **kwargs): |
| 22 super(AndroidApi, self).__init__(**kwargs) | 22 super(AndroidApi, self).__init__(**kwargs) |
| 23 self._devices = None | 23 self._devices = None |
| 24 self._file_changes_path = None | 24 self._file_changes_path = None |
| 25 self.device_to_test = None | |
|
RobertoCN
2016/06/10 15:50:17
Maybe these belong on the auto_bisect api. (since
Ziqi Xiong
2016/06/22 17:38:21
Done.
| |
| 26 self.device_tested = [] | |
| 25 | 27 |
| 26 def get_config_defaults(self): | 28 def get_config_defaults(self): |
| 27 return { | 29 return { |
| 28 'REVISION': self.m.properties.get('revision', ''), | 30 'REVISION': self.m.properties.get('revision', ''), |
| 29 'CHECKOUT_PATH': self.m.path['checkout'], | 31 'CHECKOUT_PATH': self.m.path['checkout'], |
| 30 } | 32 } |
| 31 | 33 |
| 32 @property | 34 @property |
| 33 def devices(self): | 35 def devices(self): |
| 34 assert self._devices is not None,\ | 36 assert self._devices is not None,\ |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 999 # WebView user agent is changed, and new CTS hasn't been published to | 1001 # WebView user agent is changed, and new CTS hasn't been published to |
| 1000 # reflect that. | 1002 # reflect that. |
| 1001 expected_failure_json = self.m.file.read( | 1003 expected_failure_json = self.m.file.read( |
| 1002 'Fetch the expected failures tests for CTS from chromium checkout', | 1004 'Fetch the expected failures tests for CTS from chromium checkout', |
| 1003 _CTS_CONFIG_SRC_PATH.join('expected_failure_on_bot.json'), | 1005 _CTS_CONFIG_SRC_PATH.join('expected_failure_on_bot.json'), |
| 1004 test_data = ''' | 1006 test_data = ''' |
| 1005 { | 1007 { |
| 1006 "android.webkit.cts.ExampleBlacklistedTest": | 1008 "android.webkit.cts.ExampleBlacklistedTest": |
| 1007 [ | 1009 [ |
| 1008 { | 1010 { |
| 1009 "name": "testA", | 1011 "name": "testA", |
| 1010 "_bug_id": "crbug.com/123" | 1012 "_bug_id": "crbug.com/123" |
| 1011 }, | 1013 }, |
| 1012 {"name": "testB"} | 1014 {"name": "testB"} |
| 1013 ] | 1015 ] |
| 1014 }''' | 1016 }''' |
| 1015 ) | 1017 ) |
| 1016 expected_failure = self.m.json.loads(expected_failure_json) | 1018 expected_failure = self.m.json.loads(expected_failure_json) |
| 1017 | 1019 |
| 1018 cts_base_dir = self.m.path['build'].join('site_config', 'cts') | 1020 cts_base_dir = self.m.path['build'].join('site_config', 'cts') |
| 1019 cts_zip_path = cts_base_dir.join(_cts_file_name) | 1021 cts_zip_path = cts_base_dir.join(_cts_file_name) |
| 1020 cts_extract_dir = cts_base_dir.join('unzipped') | 1022 cts_extract_dir = cts_base_dir.join('unzipped') |
| 1021 if not self.m.path.exists(cts_zip_path): | 1023 if not self.m.path.exists(cts_zip_path): |
| 1022 with self.m.step.nest('Update CTS'): | 1024 with self.m.step.nest('Update CTS'): |
| 1023 # Remove all old cts files before downloading new one. | 1025 # Remove all old cts files before downloading new one. |
| 1024 self.m.file.rmtree('Delete old CTS', cts_base_dir) | 1026 self.m.file.rmtree('Delete old CTS', cts_base_dir) |
| 1025 self.m.file.makedirs('Create CTS dir', cts_base_dir) | 1027 self.m.file.makedirs('Create CTS dir', cts_base_dir) |
| 1026 self.m.gsutil.download(name='Download new CTS', | 1028 self.m.gsutil.download(name='Download new CTS', |
| 1027 bucket='chromium-cts', | 1029 bucket='chromium-cts', |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1065 | 1067 |
| 1066 for test_class in test_classes: | 1068 for test_class in test_classes: |
| 1067 class_name = 'android.webkit.cts.%s' % test_class.get('name') | 1069 class_name = 'android.webkit.cts.%s' % test_class.get('name') |
| 1068 test_methods = test_class.findall('./Test') | 1070 test_methods = test_class.findall('./Test') |
| 1069 | 1071 |
| 1070 for test_method in test_methods: | 1072 for test_method in test_methods: |
| 1071 method_name = '%s#%s' % (class_name, test_method.get('name')) | 1073 method_name = '%s#%s' % (class_name, test_method.get('name')) |
| 1072 if test_method.get('result') == 'notExecuted': | 1074 if test_method.get('result') == 'notExecuted': |
| 1073 not_executed_tests.append(method_name) | 1075 not_executed_tests.append(method_name) |
| 1074 elif (test_method.find('./FailedScene') is not None and | 1076 elif (test_method.find('./FailedScene') is not None and |
| 1075 test_method.get('name') not in | 1077 test_method.get('name') not in |
| 1076 [ t.get('name') for t in | 1078 [ t.get('name') for t in |
| 1077 expected_failure.get(class_name, []) ]): | 1079 expected_failure.get(class_name, []) ]): |
| 1078 unexpected_test_failures.append(method_name) | 1080 unexpected_test_failures.append(method_name) |
| 1079 | 1081 |
| 1080 if unexpected_test_failures or not_executed_tests: | 1082 if unexpected_test_failures or not_executed_tests: |
| 1081 self.m.step.active_result.presentation.status = self.m.step.FAILURE | 1083 self.m.step.active_result.presentation.status = self.m.step.FAILURE |
| 1082 self.m.step.active_result.presentation.step_text += ( | 1084 self.m.step.active_result.presentation.step_text += ( |
| 1083 self.m.test_utils.format_step_text( | 1085 self.m.test_utils.format_step_text( |
| 1084 [['unexpected failures:', unexpected_test_failures], | 1086 [['unexpected failures:', unexpected_test_failures], |
| 1085 ['not executed:', not_executed_tests]])) | 1087 ['not executed:', not_executed_tests]])) |
| 1086 | 1088 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1296 script = self.c.test_runner | 1298 script = self.c.test_runner |
| 1297 if wrapper_script_suite_name: | 1299 if wrapper_script_suite_name: |
| 1298 script = self.m.chromium.output_dir.join('bin', 'run_%s' % | 1300 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
| 1299 wrapper_script_suite_name) | 1301 wrapper_script_suite_name) |
| 1300 else: | 1302 else: |
| 1301 env = kwargs.get('env', {}) | 1303 env = kwargs.get('env', {}) |
| 1302 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', | 1304 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', |
| 1303 self.m.chromium.output_dir) | 1305 self.m.chromium.output_dir) |
| 1304 kwargs['env'] = env | 1306 kwargs['env'] = env |
| 1305 return self.m.python(step_name, script, args, **kwargs) | 1307 return self.m.python(step_name, script, args, **kwargs) |
| OLD | NEW |