| Index: trunk/src/build/android/run_tests.py
|
| ===================================================================
|
| --- trunk/src/build/android/run_tests.py (revision 210250)
|
| +++ trunk/src/build/android/run_tests.py (working copy)
|
| @@ -4,21 +4,76 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -"""Runs all the native unit tests."""
|
| +"""Runs all the native unit tests.
|
|
|
| -import logging
|
| -import os
|
| +1. Copy over test binary to /data/local on device.
|
| +2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak)
|
| + to be deployed to the device. We use the device's $EXTERNAL_STORAGE as the
|
| + base dir (which maps to Context.getExternalFilesDir()).
|
| +3. Environment:
|
| +3.1. chrome/unit_tests requires (via chrome_paths.cc) a directory named:
|
| + $EXTERNAL_STORAGE + /chrome/test/data
|
| +4. Run the binary in the device and stream the log to the host.
|
| +4.1. Optionally, filter specific tests.
|
| +4.2. If we're running a single test suite and we have multiple devices
|
| + connected, we'll shard the tests.
|
| +5. Clean up the device.
|
| +
|
| +Suppressions:
|
| +
|
| +Individual tests in a test binary can be suppressed by listing it in
|
| +the gtest_filter directory in a file of the same name as the test binary,
|
| +one test per line. Here is an example:
|
| +
|
| + $ cat gtest_filter/base_unittests_disabled
|
| + DataPackTest.Load
|
| + ReadOnlyFileUtilTest.ContentsEqual
|
| +
|
| +This file is generated by the tests running on devices. If running on emulator,
|
| +additonal filter file which lists the tests only failed in emulator will be
|
| +loaded. We don't care about the rare testcases which succeeded on emuatlor, but
|
| +failed on device.
|
| +"""
|
| +
|
| +import optparse
|
| import sys
|
|
|
| from pylib import cmd_helper
|
| +from pylib.gtest import dispatch
|
| +from pylib.utils import emulator
|
| +from pylib.utils import run_tests_helper
|
| +from pylib.utils import test_options_parser
|
|
|
|
|
| +def main(argv):
|
| + option_parser = optparse.OptionParser()
|
| + test_options_parser.AddGTestOptions(option_parser)
|
| + options, args = option_parser.parse_args(argv)
|
| +
|
| + if len(args) > 1:
|
| + option_parser.error('Unknown argument: %s' % args[1:])
|
| +
|
| + run_tests_helper.SetLogLevel(options.verbose_count)
|
| +
|
| + if options.out_directory:
|
| + cmd_helper.OutDirectory.set(options.out_directory)
|
| +
|
| + if options.use_emulator:
|
| + emulator.DeleteAllTempAVDs()
|
| +
|
| + failed_tests_count = dispatch.Dispatch(options)
|
| +
|
| + # Failures of individual test suites are communicated by printing a
|
| + # STEP_FAILURE message.
|
| + # Returning a success exit status also prevents the buildbot from incorrectly
|
| + # marking the last suite as failed if there were failures in other suites in
|
| + # the batch (this happens because the exit status is a sum of all failures
|
| + # from all suites, but the buildbot associates the exit status only with the
|
| + # most recent step).
|
| + if options.exit_code:
|
| + return failed_tests_count
|
| + return 0
|
| +
|
| +
|
| if __name__ == '__main__':
|
| - args = ['python',
|
| - os.path.join(os.path.dirname(__file__), 'test_runner.py'),
|
| - 'gtest'] + sys.argv[1:]
|
| - logging.warning('*' * 80)
|
| - logging.warning('This script is deprecated and will be removed soon.')
|
| - logging.warning('Use the following instead: %s', ' '.join(args))
|
| - logging.warning('*' * 80)
|
| - sys.exit(cmd_helper.RunCmd(args))
|
| + sys.exit(main(sys.argv))
|
|
|