summaryrefslogtreecommitdiffstats
path: root/build/android/run_instrumentation_tests.py
diff options
context:
space:
mode:
authorgkanwar@google.com <gkanwar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-03 20:31:43 +0000
committergkanwar@google.com <gkanwar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-03 20:31:43 +0000
commit6f5c26503e6faa9bd80b21461b1b91eb6abcb983 (patch)
treec1dcf4c6b5fee65426da962e49b6a28832f75920 /build/android/run_instrumentation_tests.py
parented314fe15826576b05d852dd635fc356194204c8 (diff)
downloadchromium_src-6f5c26503e6faa9bd80b21461b1b91eb6abcb983.zip
chromium_src-6f5c26503e6faa9bd80b21461b1b91eb6abcb983.tar.gz
chromium_src-6f5c26503e6faa9bd80b21461b1b91eb6abcb983.tar.bz2
Creates a new test running script test_runner.py
This new script serves as a unified entry point for all tests. The existing scripts are now just wrappers around the new script. Old commands should thus still work, but you can now make use of the new script to run various types of tests. There are a few TODOs left: * Add options to run Monkey tests. Miscellaneous notes: * --python_test_root is now a required flag when Python host-driven tests are being run. BUG=248351 Review URL: https://chromiumcodereview.appspot.com/15942016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android/run_instrumentation_tests.py')
-rwxr-xr-xbuild/android/run_instrumentation_tests.py74
1 files changed, 10 insertions, 64 deletions
diff --git a/build/android/run_instrumentation_tests.py b/build/android/run_instrumentation_tests.py
index 598331b..c1a4ef0 100755
--- a/build/android/run_instrumentation_tests.py
+++ b/build/android/run_instrumentation_tests.py
@@ -6,73 +6,19 @@
"""Runs both the Python and Java instrumentation tests."""
-import optparse
+import logging
import os
import sys
-from pylib import buildbot_report
-from pylib import ports
-from pylib.base import base_test_result
-from pylib.host_driven import run_python_tests
-from pylib.instrumentation import dispatch
-from pylib.utils import report_results
-from pylib.utils import run_tests_helper
-from pylib.utils import test_options_parser
-
-
-def DispatchInstrumentationTests(options):
- """Dispatches the Java and Python instrumentation tests, sharding if possible.
-
- Uses the logging module to print the combined final results and
- summary of the Java and Python tests. If the java_only option is set, only
- the Java tests run. If the python_only option is set, only the python tests
- run. If neither are set, run both Java and Python tests.
-
- Args:
- options: command-line options for running the Java and Python tests.
-
- Returns:
- An integer representing the number of broken tests.
- """
- if not options.keep_test_server_ports:
- # Reset the test port allocation. It's important to do it before starting
- # to dispatch any tests.
- if not ports.ResetTestServerPortAllocation():
- raise Exception('Failed to reset test server port.')
-
- all_results = base_test_result.TestRunResults()
-
- if options.run_java_tests:
- all_results.AddTestRunResults(dispatch.Dispatch(options))
- if options.run_python_tests:
- all_results.AddTestRunResults(run_python_tests.DispatchPythonTests(options))
-
- report_results.LogFull(
- results=all_results,
- test_type='Instrumentation',
- test_package=os.path.basename(options.test_apk),
- annotation=options.annotations,
- build_type=options.build_type,
- flakiness_server=options.flakiness_dashboard_server)
-
- return len(all_results.GetNotPass())
-
-
-def main(argv):
- option_parser = optparse.OptionParser()
- test_options_parser.AddInstrumentationOptions(option_parser)
- options, args = option_parser.parse_args(argv)
- test_options_parser.ValidateInstrumentationOptions(option_parser, options,
- args)
-
- run_tests_helper.SetLogLevel(options.verbose_count)
- ret = 1
- try:
- ret = DispatchInstrumentationTests(options)
- finally:
- buildbot_report.PrintStepResultIfNeeded(options, ret)
- return ret
+from pylib import cmd_helper
if __name__ == '__main__':
- sys.exit(main(sys.argv))
+ args = ['python',
+ os.path.join(os.path.dirname(__file__), 'test_runner.py'),
+ 'instrumentation'] + 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))