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

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

Issue 11801016: [Android] Break GTest emulator launching into a separate function. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: fixed docstring Created 7 years, 11 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs all the native unit tests. 7 """Runs all the native unit tests.
8 8
9 1. Copy over test binary to /data/local on device. 9 1. Copy over test binary to /data/local on device.
10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) 10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak)
(...skipping 27 matching lines...) Expand all
38 import copy 38 import copy
39 import fnmatch 39 import fnmatch
40 import logging 40 import logging
41 import optparse 41 import optparse
42 import os 42 import os
43 import signal 43 import signal
44 import subprocess 44 import subprocess
45 import sys 45 import sys
46 import time 46 import time
47 47
48 import emulator
49 from pylib import android_commands 48 from pylib import android_commands
50 from pylib import buildbot_report 49 from pylib import buildbot_report
51 from pylib import cmd_helper 50 from pylib import cmd_helper
52 from pylib import ports 51 from pylib import ports
53 from pylib.base_test_sharder import BaseTestSharder 52 from pylib.base_test_sharder import BaseTestSharder
54 from pylib.gtest import debug_info 53 from pylib.gtest import debug_info
55 from pylib.gtest.single_test_runner import SingleTestRunner 54 from pylib.gtest.single_test_runner import SingleTestRunner
55 from pylib.utils import emulator
56 from pylib.utils import run_tests_helper 56 from pylib.utils import run_tests_helper
57 from pylib.utils import test_options_parser 57 from pylib.utils import test_options_parser
58 from pylib.utils import time_profile 58 from pylib.utils import time_profile
59 from pylib.utils import xvfb 59 from pylib.utils import xvfb
60 60
61 61
62 _TEST_SUITES = ['base_unittests', 62 _TEST_SUITES = ['base_unittests',
63 'cc_unittests', 63 'cc_unittests',
64 'content_unittests', 64 'content_unittests',
65 'gpu_unittests', 65 'gpu_unittests',
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 Returns: 241 Returns:
242 0 if successful, number of failing tests otherwise. 242 0 if successful, number of failing tests otherwise.
243 """ 243 """
244 step_name = os.path.basename(options.test_suite).replace('-debug.apk', '') 244 step_name = os.path.basename(options.test_suite).replace('-debug.apk', '')
245 buildbot_report.PrintNamedStep(step_name) 245 buildbot_report.PrintNamedStep(step_name)
246 attached_devices = [] 246 attached_devices = []
247 buildbot_emulators = [] 247 buildbot_emulators = []
248 248
249 if options.use_emulator: 249 if options.use_emulator:
250 for n in range(options.emulator_count): 250 buildbot_emulators = emulator.LaunchEmulators(options.emulator_count,
251 t = time_profile.TimeProfile('Emulator launch %d' % n) 251 wait_for_boot=True)
252 avd_name = None 252 attached_devices = [e.device for e in buildbot_emulators]
253 if n > 0:
254 # Creates a temporary AVD for the extra emulators.
255 avd_name = 'run_tests_avd_%d' % n
256 buildbot_emulator = emulator.Emulator(avd_name, options.fast_and_loose)
257 buildbot_emulator.Launch(kill_all_emulators=n == 0)
258 t.Stop()
259 buildbot_emulators.append(buildbot_emulator)
260 attached_devices.append(buildbot_emulator.device)
261 # Wait for all emulators to boot completed.
262 map(lambda buildbot_emulator: buildbot_emulator.ConfirmLaunch(True),
263 buildbot_emulators)
264 elif options.test_device: 253 elif options.test_device:
265 attached_devices = [options.test_device] 254 attached_devices = [options.test_device]
266 else: 255 else:
267 attached_devices = android_commands.GetAttachedDevices() 256 attached_devices = android_commands.GetAttachedDevices()
268 257
269 if not attached_devices: 258 if not attached_devices:
270 logging.critical('A device must be attached and online.') 259 logging.critical('A device must be attached and online.')
271 buildbot_report.PrintError() 260 buildbot_report.PrintError()
272 return 1 261 return 1
273 262
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 # the batch (this happens because the exit status is a sum of all failures 356 # the batch (this happens because the exit status is a sum of all failures
368 # from all suites, but the buildbot associates the exit status only with the 357 # from all suites, but the buildbot associates the exit status only with the
369 # most recent step). 358 # most recent step).
370 if options.exit_code: 359 if options.exit_code:
371 return failed_tests_count 360 return failed_tests_count
372 return 0 361 return 0
373 362
374 363
375 if __name__ == '__main__': 364 if __name__ == '__main__':
376 sys.exit(main(sys.argv)) 365 sys.exit(main(sys.argv))
OLDNEW
« build/android/pylib/utils/emulator.py ('K') | « build/android/pylib/utils/emulator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698