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

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

Issue 15942016: Creates a new test running script test_runner.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverts flakiness server change, uses os.path.join Created 7 years, 5 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 | « build/android/run_instrumentation_tests.py ('k') | build/android/run_uiautomator_tests.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 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 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 import logging
10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) 10 import os
11 to be deployed to the device. We use the device's $EXTERNAL_STORAGE as the
12 base dir (which maps to Context.getExternalFilesDir()).
13 3. Environment:
14 3.1. chrome/unit_tests requires (via chrome_paths.cc) a directory named:
15 $EXTERNAL_STORAGE + /chrome/test/data
16 4. Run the binary in the device and stream the log to the host.
17 4.1. Optionally, filter specific tests.
18 4.2. If we're running a single test suite and we have multiple devices
19 connected, we'll shard the tests.
20 5. Clean up the device.
21
22 Suppressions:
23
24 Individual tests in a test binary can be suppressed by listing it in
25 the gtest_filter directory in a file of the same name as the test binary,
26 one test per line. Here is an example:
27
28 $ cat gtest_filter/base_unittests_disabled
29 DataPackTest.Load
30 ReadOnlyFileUtilTest.ContentsEqual
31
32 This file is generated by the tests running on devices. If running on emulator,
33 additonal filter file which lists the tests only failed in emulator will be
34 loaded. We don't care about the rare testcases which succeeded on emuatlor, but
35 failed on device.
36 """
37
38 import optparse
39 import sys 11 import sys
40 12
41 from pylib import cmd_helper 13 from pylib import cmd_helper
42 from pylib.gtest import dispatch
43 from pylib.utils import emulator
44 from pylib.utils import run_tests_helper
45 from pylib.utils import test_options_parser
46
47
48 def main(argv):
49 option_parser = optparse.OptionParser()
50 test_options_parser.AddGTestOptions(option_parser)
51 options, args = option_parser.parse_args(argv)
52
53 if len(args) > 1:
54 option_parser.error('Unknown argument: %s' % args[1:])
55
56 run_tests_helper.SetLogLevel(options.verbose_count)
57
58 if options.out_directory:
59 cmd_helper.OutDirectory.set(options.out_directory)
60
61 if options.use_emulator:
62 emulator.DeleteAllTempAVDs()
63
64 failed_tests_count = dispatch.Dispatch(options)
65
66 # Failures of individual test suites are communicated by printing a
67 # STEP_FAILURE message.
68 # Returning a success exit status also prevents the buildbot from incorrectly
69 # marking the last suite as failed if there were failures in other suites in
70 # the batch (this happens because the exit status is a sum of all failures
71 # from all suites, but the buildbot associates the exit status only with the
72 # most recent step).
73 if options.exit_code:
74 return failed_tests_count
75 return 0
76 14
77 15
78 if __name__ == '__main__': 16 if __name__ == '__main__':
79 sys.exit(main(sys.argv)) 17 args = ['python',
18 os.path.join(os.path.dirname(__file__), 'test_runner.py'),
19 'gtest'] + sys.argv[1:]
20 logging.warning('*' * 80)
21 logging.warning('This script is deprecated and will be removed soon.')
22 logging.warning('Use the following instead: %s', ' '.join(args))
23 logging.warning('*' * 80)
24 sys.exit(cmd_helper.RunCmd(args))
OLDNEW
« no previous file with comments | « build/android/run_instrumentation_tests.py ('k') | build/android/run_uiautomator_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698