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

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

Issue 414383002: Run android tests through runtest.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix --target argument Created 6 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 | 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...) Expand 10 before | Expand all | Expand 10 after
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')] + property_args
109 args += ['--test-platform', 'android']
110 if options.factory_properties.get('generate_gtest_json'):
111 args.append('--generate-json-file')
112 args += ['-o', 'gtest-results/%s' % suite,
113 '--annotate', 'gtest',
114 '--build-number', str(options.build_properties.get('buildnumber',
115 '')),
116 '--builder-name', options.build_properties.get('buildername', '')]
117 if options.target == 'Release':
118 args += ['--target', 'Release']
119 else:
120 args += ['--target', 'Debug']
121 args += cmd
122 RunCmd(args, cwd=DIR_BUILD_ROOT)
123
124
99 def RunTestSuites(options, suites, suites_options=None): 125 def RunTestSuites(options, suites, suites_options=None):
100 """Manages an invocation of test_runner.py for gtests. 126 """Manages an invocation of test_runner.py for gtests.
101 127
102 Args: 128 Args:
103 options: options object. 129 options: options object.
104 suites: List of suite names to run. 130 suites: List of suite names to run.
105 suites_options: Command line options dictionary for particular suites. 131 suites_options: Command line options dictionary for particular suites.
106 For example, 132 For example,
107 {'content_browsertests', ['--num_retries=1', '--release']} 133 {'content_browsertests', ['--num_retries=1', '--release']}
108 will add the options only to content_browsertests. 134 will add the options only to content_browsertests.
109 """ 135 """
110 136
111 if not suites_options: 137 if not suites_options:
112 suites_options = {} 138 suites_options = {}
113 139
114 args = ['--verbose'] 140 args = ['--verbose']
115 if options.target == 'Release': 141 if options.target == 'Release':
116 args.append('--release') 142 args.append('--release')
117 if options.asan: 143 if options.asan:
118 args.append('--tool=asan') 144 args.append('--tool=asan')
119 if options.gtest_filter: 145 if options.gtest_filter:
120 args.append('--gtest-filter=%s' % options.gtest_filter) 146 args.append('--gtest-filter=%s' % options.gtest_filter)
121 147
122 for suite in suites: 148 for suite in suites:
123 bb_annotations.PrintNamedStep(suite) 149 bb_annotations.PrintNamedStep(suite)
124 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args 150 cmd = [suite] + args
125 cmd += suites_options.get(suite, []) 151 cmd += suites_options.get(suite, [])
126 if suite == 'content_browsertests': 152 if suite == 'content_browsertests':
127 cmd.append('--num_retries=1') 153 cmd.append('--num_retries=1')
128 RunCmd(cmd) 154 _RunTest(options, cmd, suite)
129 155
130 156
131 def RunChromeDriverTests(options): 157 def RunChromeDriverTests(options):
132 """Run all the steps for running chromedriver tests.""" 158 """Run all the steps for running chromedriver tests."""
133 bb_annotations.PrintNamedStep('chromedriver_annotation') 159 bb_annotations.PrintNamedStep('chromedriver_annotation')
134 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', 160 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py',
135 '--android-packages=%s,%s,%s,%s' % 161 '--android-packages=%s,%s,%s,%s' %
136 ('chrome_shell', 162 ('chrome_shell',
137 'chrome_stable', 163 'chrome_stable',
138 'chrome_beta', 164 'chrome_beta',
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 729
704 if options.coverage_bucket: 730 if options.coverage_bucket:
705 setattr(options, 'coverage_dir', 731 setattr(options, 'coverage_dir',
706 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) 732 os.path.join(CHROME_OUT_DIR, options.target, 'coverage'))
707 733
708 MainTestWrapper(options) 734 MainTestWrapper(options)
709 735
710 736
711 if __name__ == '__main__': 737 if __name__ == '__main__':
712 sys.exit(main(sys.argv)) 738 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
This is Rietveld 408576698