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

Side by Side Diff: build/android/buildbot/bb_device_steps.py

Issue 20649002: [Android] Dedup content_browsertests test setup from gtests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed bulach's comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/pylib/android_commands.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import collections 6 import collections
7 import glob 7 import glob
8 import multiprocessing 8 import multiprocessing
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bb_annotations.PrintWarning() 98 bb_annotations.PrintWarning()
99 else: 99 else:
100 print 'Reboots complete.' 100 print 'Reboots complete.'
101 101
102 102
103 def RunTestSuites(options, suites): 103 def RunTestSuites(options, suites):
104 """Manages an invocation of test_runner.py for gtests. 104 """Manages an invocation of test_runner.py for gtests.
105 105
106 Args: 106 Args:
107 options: options object. 107 options: options object.
108 suites: List of suites to run. 108 suites: List of suite names to run.
109 """ 109 """
110 args = ['--verbose'] 110 args = ['--verbose']
111 if options.target == 'Release': 111 if options.target == 'Release':
112 args.append('--release') 112 args.append('--release')
113 if options.asan: 113 if options.asan:
114 args.append('--tool=asan') 114 args.append('--tool=asan')
115 for suite in suites: 115 for suite in suites:
116 bb_annotations.PrintNamedStep(suite.name) 116 bb_annotations.PrintNamedStep(suite)
117 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite.name] + args 117 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args
118 if suite.is_suite_exe: 118 if suite == 'content_browsertests':
119 cmd.append('--exe') 119 cmd.append('--num_retries=1')
120 RunCmd(cmd) 120 RunCmd(cmd)
121 121
122 def RunBrowserTestSuite(options):
123 """Manages an invocation of test_runner.py for content_browsertests.
124
125 Args:
126 options: options object.
127 """
128 args = ['--verbose', '--num_retries=1']
129 if options.target == 'Release':
130 args.append('--release')
131 if options.asan:
132 args.append('--tool=asan')
133 bb_annotations.PrintNamedStep(constants.BROWSERTEST_SUITE_NAME)
134 RunCmd(['build/android/test_runner.py', 'content_browsertests'] + args)
135
136 def RunChromeDriverTests(_): 122 def RunChromeDriverTests(_):
137 """Run all the steps for running chromedriver tests.""" 123 """Run all the steps for running chromedriver tests."""
138 bb_annotations.PrintNamedStep('chromedriver_annotation') 124 bb_annotations.PrintNamedStep('chromedriver_annotation')
139 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', 125 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py',
140 '--android-package=%s' % constants.CHROMIUM_TEST_SHELL_PACKAGE]) 126 '--android-package=%s' % constants.CHROMIUM_TEST_SHELL_PACKAGE])
141 127
142 def InstallApk(options, test, print_step=False): 128 def InstallApk(options, test, print_step=False):
143 """Install an apk to all phones. 129 """Install an apk to all phones.
144 130
145 Args: 131 Args:
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 def RunUnitTests(options): 266 def RunUnitTests(options):
281 RunTestSuites(options, gtest_config.STABLE_TEST_SUITES) 267 RunTestSuites(options, gtest_config.STABLE_TEST_SUITES)
282 268
283 269
284 def RunInstrumentationTests(options): 270 def RunInstrumentationTests(options):
285 for test in INSTRUMENTATION_TESTS.itervalues(): 271 for test in INSTRUMENTATION_TESTS.itervalues():
286 RunInstrumentationSuite(options, test) 272 RunInstrumentationSuite(options, test)
287 273
288 274
289 def RunWebkitTests(options): 275 def RunWebkitTests(options):
290 RunTestSuites(options, [gtest_config.Apk('webkit_unit_tests')]) 276 RunTestSuites(options, ['webkit_unit_tests'])
291 RunWebkitLint(options.target) 277 RunWebkitLint(options.target)
292 278
293 279
294 def GetTestStepCmds(): 280 def GetTestStepCmds():
295 return [ 281 return [
296 ('chromedriver', RunChromeDriverTests), 282 ('chromedriver', RunChromeDriverTests),
297 ('unit', RunUnitTests), 283 ('unit', RunUnitTests),
298 ('ui', RunInstrumentationTests), 284 ('ui', RunInstrumentationTests),
299 ('webkit', RunWebkitTests), 285 ('webkit', RunWebkitTests),
300 ('webkit_layout', RunWebkitLayoutTests) 286 ('webkit_layout', RunWebkitLayoutTests)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 323
338 if options.install: 324 if options.install:
339 test_obj = INSTRUMENTATION_TESTS[options.install] 325 test_obj = INSTRUMENTATION_TESTS[options.install]
340 InstallApk(options, test_obj, print_step=True) 326 InstallApk(options, test_obj, print_step=True)
341 327
342 if options.test_filter: 328 if options.test_filter:
343 bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options) 329 bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options)
344 330
345 if options.experimental: 331 if options.experimental:
346 RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES) 332 RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES)
347 RunBrowserTestSuite(options)
348 333
349 # Run all post test steps 334 # Run all post test steps
350 for _, cmd in GetPostTestStepCmds(): 335 for _, cmd in GetPostTestStepCmds():
351 cmd(options) 336 cmd(options)
352 337
353 338
354 def GetDeviceStepsOptParser(): 339 def GetDeviceStepsOptParser():
355 parser = bb_utils.GetParser() 340 parser = bb_utils.GetParser()
356 parser.add_option('--experimental', action='store_true', 341 parser.add_option('--experimental', action='store_true',
357 help='Run experiemental tests') 342 help='Run experiemental tests')
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 return sys.exit('Unknown tests %s' % list(unknown_tests)) 375 return sys.exit('Unknown tests %s' % list(unknown_tests))
391 376
392 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) 377 setattr(options, 'target', options.factory_properties.get('target', 'Debug'))
393 378
394 MainTestWrapper(options) 379 MainTestWrapper(options)
395 provision_devices.KillHostHeartbeat() 380 provision_devices.KillHostHeartbeat()
396 381
397 382
398 if __name__ == '__main__': 383 if __name__ == '__main__':
399 sys.exit(main(sys.argv)) 384 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698