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

Side by Side Diff: build/android/run_tests.py

Issue 8769020: Android bot changes for robustness, profiling, and debugging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « build/android/emulator.py ('k') | 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) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """Runs all the native unit tests. 6 """Runs all the native unit tests.
7 7
8 1. Copy over test binary to /data/local on device. 8 1. Copy over test binary to /data/local on device.
9 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) 9 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak)
10 to be deployed to the device (in /data/local/tmp). 10 to be deployed to the device (in /data/local/tmp).
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 import cmd_helper 58 import cmd_helper
59 import debug_info 59 import debug_info
60 import emulator 60 import emulator
61 import run_tests_helper 61 import run_tests_helper
62 from single_test_runner import SingleTestRunner 62 from single_test_runner import SingleTestRunner
63 from test_package_executable import TestPackageExecutable 63 from test_package_executable import TestPackageExecutable
64 from test_result import BaseTestResult, TestResults 64 from test_result import BaseTestResult, TestResults
65 65
66 _TEST_SUITES = ['base_unittests', 'sql_unittests', 'ipc_tests', 'net_unittests'] 66 _TEST_SUITES = ['base_unittests', 'sql_unittests', 'ipc_tests', 'net_unittests']
67 67
68
69 class TimeProfile(object):
70 """Class for simple profiling of action, with logging of cost."""
71
72 def __init__(self, description):
73 self._description = description
74 self.Start()
75
76 def Start(self):
77 self._starttime = time.time()
78
79 def Stop(self):
80 """Stop profiling and dump a log."""
81 if self._starttime:
82 stoptime = time.time()
83 logging.info('%fsec to perform %s' %
84 (stoptime - self._starttime, self._description))
85 self._starttime = None
86
68 class Xvfb(object): 87 class Xvfb(object):
69 """Class to start and stop Xvfb if relevant. Nop if not Linux.""" 88 """Class to start and stop Xvfb if relevant. Nop if not Linux."""
70 89
71 def __init__(self): 90 def __init__(self):
72 self._pid = 0 91 self._pid = 0
73 92
74 def _IsLinux(self): 93 def _IsLinux(self):
75 """Return True if on Linux; else False.""" 94 """Return True if on Linux; else False."""
76 return sys.platform.startswith('linux') 95 return sys.platform.startswith('linux')
77 96
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 ListTestSuites() 206 ListTestSuites()
188 return 0 207 return 0
189 buildbot_emulator = None 208 buildbot_emulator = None
190 attached_devices = [] 209 attached_devices = []
191 210
192 if options.use_xvfb: 211 if options.use_xvfb:
193 xvfb = Xvfb() 212 xvfb = Xvfb()
194 xvfb.Start() 213 xvfb.Start()
195 214
196 if options.use_emulator: 215 if options.use_emulator:
216 t = TimeProfile('Emulator launch')
197 buildbot_emulator = emulator.Emulator() 217 buildbot_emulator = emulator.Emulator()
218 buildbot_emulator.Reset()
198 buildbot_emulator.Launch() 219 buildbot_emulator.Launch()
220 t.Stop()
199 attached_devices.append(buildbot_emulator.device) 221 attached_devices.append(buildbot_emulator.device)
200 else: 222 else:
201 attached_devices = android_commands.GetAttachedDevices() 223 attached_devices = android_commands.GetAttachedDevices()
202 224
203 if not attached_devices: 225 if not attached_devices:
204 logging.critical('A device must be attached and online.') 226 logging.critical('A device must be attached and online.')
205 return 1 227 return 1
206 228
207 test_results = RunTests(attached_devices[0], options.test_suite, 229 test_results = RunTests(attached_devices[0], options.test_suite,
208 options.gtest_filter, options.test_arguments, 230 options.gtest_filter, options.test_arguments,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 if len(args) > 1: 280 if len(args) > 1:
259 print 'Unknown argument:', args[1:] 281 print 'Unknown argument:', args[1:]
260 option_parser.print_usage() 282 option_parser.print_usage()
261 sys.exit(1) 283 sys.exit(1)
262 run_tests_helper.SetLogLevel(options.verbose_count) 284 run_tests_helper.SetLogLevel(options.verbose_count)
263 return Dispatch(options) 285 return Dispatch(options)
264 286
265 287
266 if __name__ == '__main__': 288 if __name__ == '__main__':
267 sys.exit(main(sys.argv)) 289 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/emulator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698