Chromium Code Reviews

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

Issue 410033002: Run android tests through runtest.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to codereview. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | 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 hashlib 8 import hashlib
9 import json 9 import json
10 import os 10 import os
(...skipping 78 matching lines...)
89 89
90 Returns: 90 Returns:
91 The revision number. 91 The revision number.
92 """ 92 """
93 revision = options.build_properties.get('got_revision') 93 revision = options.build_properties.get('got_revision')
94 if not revision: 94 if not revision:
95 revision = options.build_properties.get('revision', 'testing') 95 revision = options.build_properties.get('revision', 'testing')
96 return revision 96 return revision
97 97
98 98
99 def _RunTest(options, cmd, suite):
100 """Run test command with runtest.py.
101
102 Args:
103 options: options object.
104 cmd: the command to run.
105 suite: test name.
106 """
107 property_args = bb_utils.EncodeProperties(options)
108 args = [os.path.join(SLAVE_SCRIPTS_DIR, 'runtest.py'),
109 '--test-type',
110 suite,
111 '--run-python-script'
112 ] + property_args
113 if options.factory_properties.get('generate_gtest_json'):
114 args.append('--generate-json-file')
115
116 if options.target == 'Release':
117 args += ['--target', 'Release']
118 args += cmd
119 RunCmd(args)
120
121
99 def RunTestSuites(options, suites, suites_options=None): 122 def RunTestSuites(options, suites, suites_options=None):
100 """Manages an invocation of test_runner.py for gtests. 123 """Manages an invocation of test_runner.py for gtests.
101 124
102 Args: 125 Args:
103 options: options object. 126 options: options object.
104 suites: List of suite names to run. 127 suites: List of suite names to run.
105 suites_options: Command line options dictionary for particular suites. 128 suites_options: Command line options dictionary for particular suites.
106 For example, 129 For example,
107 {'content_browsertests', ['--num_retries=1', '--release']} 130 {'content_browsertests', ['--num_retries=1', '--release']}
108 will add the options only to content_browsertests. 131 will add the options only to content_browsertests.
109 """ 132 """
110 133
111 if not suites_options: 134 if not suites_options:
112 suites_options = {} 135 suites_options = {}
113 136
114 args = ['--verbose'] 137 args = ['--verbose']
115 if options.target == 'Release': 138 if options.target == 'Release':
116 args.append('--release') 139 args.append('--release')
117 if options.asan: 140 if options.asan:
118 args.append('--tool=asan') 141 args.append('--tool=asan')
119 if options.gtest_filter: 142 if options.gtest_filter:
120 args.append('--gtest-filter=%s' % options.gtest_filter) 143 args.append('--gtest-filter=%s' % options.gtest_filter)
121 144
122 for suite in suites: 145 for suite in suites:
123 bb_annotations.PrintNamedStep(suite) 146 bb_annotations.PrintNamedStep(suite)
124 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args 147 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args
125 cmd += suites_options.get(suite, []) 148 cmd += suites_options.get(suite, [])
126 if suite == 'content_browsertests': 149 if suite == 'content_browsertests':
127 cmd.append('--num_retries=1') 150 cmd.append('--num_retries=1')
128 RunCmd(cmd) 151 _RunTest(options, cmd, suite)
129 152
130 153
131 def RunChromeDriverTests(options): 154 def RunChromeDriverTests(options):
132 """Run all the steps for running chromedriver tests.""" 155 """Run all the steps for running chromedriver tests."""
133 bb_annotations.PrintNamedStep('chromedriver_annotation') 156 bb_annotations.PrintNamedStep('chromedriver_annotation')
134 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', 157 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py',
135 '--android-packages=%s,%s,%s,%s' % 158 '--android-packages=%s,%s,%s,%s' %
136 ('chrome_shell', 159 ('chrome_shell',
137 'chrome_stable', 160 'chrome_stable',
138 'chrome_beta', 161 'chrome_beta',
(...skipping 550 matching lines...)
689 712
690 if options.coverage_bucket: 713 if options.coverage_bucket:
691 setattr(options, 'coverage_dir', 714 setattr(options, 'coverage_dir',
692 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) 715 os.path.join(CHROME_OUT_DIR, options.target, 'coverage'))
693 716
694 MainTestWrapper(options) 717 MainTestWrapper(options)
695 718
696 719
697 if __name__ == '__main__': 720 if __name__ == '__main__':
698 sys.exit(main(sys.argv)) 721 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine