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

Side by Side Diff: scripts/slave/recipe_modules/chromium/steps.py

Issue 892463002: Merged Android and non-Android code paths to reuse code in GTestTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/chromium_android/api.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 re 5 import re
6 6
7 7
8 class Test(object): 8 class Test(object):
9 """ 9 """
10 Base class for tests that can be retried after deapplying a previously 10 Base class for tests that can be retried after deapplying a previously
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return [self.target_name + '_apk'] 217 return [self.target_name + '_apk']
218 218
219 # On iOS we rely on 'All' target being compiled instead of using 219 # On iOS we rely on 'All' target being compiled instead of using
220 # individual targets. 220 # individual targets.
221 if api.chromium.c.TARGET_PLATFORM == 'ios': 221 if api.chromium.c.TARGET_PLATFORM == 'ios':
222 return [] 222 return []
223 223
224 return [self.target_name] 224 return [self.target_name]
225 225
226 def run(self, api, suffix): 226 def run(self, api, suffix):
227 if api.chromium.c.TARGET_PLATFORM == 'android':
228 isolate_file_path = None
229 if self._android_isolate_path:
230 isolate_file_path = api.path['checkout'].join(
231 self._android_isolate_path)
232 return api.chromium_android.run_test_suite(
233 self.target_name,
234 flakiness_dashboard='http://test-results.appspot.com',
235 isolate_file_path=isolate_file_path)
236
237 # Copy the list because run can be invoked multiple times and we modify 227 # Copy the list because run can be invoked multiple times and we modify
238 # the local copy. 228 # the local copy.
239 args = self._args[:] 229 args = self._args[:]
240 230
241 if suffix == 'without patch': 231 if suffix == 'without patch':
242 args.append(api.chromium.test_launcher_filter( 232 args.append(api.chromium.test_launcher_filter(
243 self.failures(api, 'with patch'))) 233 self.failures(api, 'with patch')))
244 234
235 gtest_results_file = api.json.gtest_results(add_json_log=False)
236 step_test_data = lambda: api.json.test_api.canned_gtest_output(True)
237
245 kwargs = {} 238 kwargs = {}
246 kwargs['name'] = self._step_name(suffix) 239 kwargs['name'] = self._step_name(suffix)
247 kwargs['xvfb'] = True
248 kwargs['test_type'] = self.name
249 kwargs['annotate'] = 'gtest'
250 kwargs['args'] = args 240 kwargs['args'] = args
251 kwargs['step_test_data'] = lambda: api.json.test_api.canned_gtest_output( 241 kwargs['step_test_data'] = step_test_data
252 True) 242
253 kwargs['test_launcher_summary_output'] = api.json.gtest_results( 243 if api.chromium.c.TARGET_PLATFORM == 'android':
254 add_json_log=False) 244 # TODO(sergiyb): Figure out if we can reuse isolate module for running
255 kwargs.update(self._runtest_kwargs) 245 # isolated Android tests, rather than using custom solution in Android
246 # test launcher.
247 if self._android_isolate_path:
248 isolate_fpath = api.path['checkout'].join(self._android_isolate_path)
Paweł Hajdan Jr. 2015/01/29 20:19:12 nit: Instead of somewhat weird isolate_fpath why n
Sergiy Byelozyorov 2015/01/29 20:24:22 Done.
249 kwargs['isolate_file_path'] = isolate_fpath
250 kwargs['json_results_file'] = gtest_results_file
Sergiy Byelozyorov 2015/01/29 17:09:58 Since Android test launcher tries to return test r
Paweł Hajdan Jr. 2015/01/29 20:19:12 Have you verified this? Both are JSON, but Androi
Sergiy Byelozyorov 2015/01/29 20:24:22 (sorry for not replying directly to the comment fi
251 kwargs['flakiness_dashboard'] = 'http://test-results.appspot.com'
252 else:
253 kwargs['xvfb'] = True
254 kwargs['test_type'] = self.name
255 kwargs['annotate'] = 'gtest'
256 kwargs['test_launcher_summary_output'] = gtest_results_file
257 kwargs.update(self._runtest_kwargs)
256 258
257 try: 259 try:
258 if self._use_isolate: 260 if api.chromium.c.TARGET_PLATFORM == 'android':
261 api.chromium_android.run_test_suite(self.target_name, **kwargs)
262 elif self._use_isolate:
259 api.isolate.runtest(self.target_name, self._revision, 263 api.isolate.runtest(self.target_name, self._revision,
260 self._webkit_revision, **kwargs) 264 self._webkit_revision, **kwargs)
261 else: 265 else:
262 api.chromium.runtest(self.target_name, revision=self._revision, 266 api.chromium.runtest(self.target_name, revision=self._revision,
263 webkit_revision=self._webkit_revision, **kwargs) 267 webkit_revision=self._webkit_revision, **kwargs)
264 finally: 268 finally:
265 step_result = api.step.active_result 269 step_result = api.step.active_result
266 self._test_runs[suffix] = step_result 270 self._test_runs[suffix] = step_result
267 271
268 r = step_result.json.gtest_results 272 r = step_result.json.gtest_results
269 p = step_result.presentation 273 p = step_result.presentation
270 274
271 if r.valid: 275 if r.valid:
272 p.step_text += api.test_utils.format_step_text([ 276 p.step_text += api.test_utils.format_step_text([
273 ['failures:', r.failures] 277 ['failures:', r.failures]
274 ]) 278 ])
279
275 return step_result 280 return step_result
276 281
277 def has_valid_results(self, api, suffix): 282 def has_valid_results(self, api, suffix):
278 gtest_results = self._test_runs[suffix].json.gtest_results 283 gtest_results = self._test_runs[suffix].json.gtest_results
279 if not gtest_results.valid: # pragma: no cover 284 if not gtest_results.valid: # pragma: no cover
280 return False 285 return False
281 global_tags = gtest_results.raw.get('global_tags', []) 286 global_tags = gtest_results.raw.get('global_tags', [])
282 return 'UNRELIABLE_RESULTS' not in global_tags 287 return 'UNRELIABLE_RESULTS' not in global_tags
283 288
284 def failures(self, api, suffix): 289 def failures(self, api, suffix):
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 GTestTest('crypto_unittests'), 1106 GTestTest('crypto_unittests'),
1102 GTestTest('gfx_unittests'), 1107 GTestTest('gfx_unittests'),
1103 GTestTest('url_unittests'), 1108 GTestTest('url_unittests'),
1104 GTestTest('content_unittests'), 1109 GTestTest('content_unittests'),
1105 GTestTest('net_unittests'), 1110 GTestTest('net_unittests'),
1106 GTestTest('ui_base_unittests'), 1111 GTestTest('ui_base_unittests'),
1107 GTestTest('ui_ios_unittests'), 1112 GTestTest('ui_ios_unittests'),
1108 GTestTest('sync_unit_tests'), 1113 GTestTest('sync_unit_tests'),
1109 GTestTest('sql_unittests'), 1114 GTestTest('sql_unittests'),
1110 ] 1115 ]
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/chromium_android/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698