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

Unified Diff: build/android/test_runner.py

Issue 19537004: [Android] Converts host driven tests to common test_dispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sharding_refactoring
Patch Set: Adds tagging of host-driven, re-adds exception handling 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 side-by-side diff with in-line comments
Download patch
Index: build/android/test_runner.py
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index f50bc7cb82b131efb488617d89f70796d84c7f5c..7df6409393af6b126c5e75ca60f59894fd9ac7de 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -22,9 +22,9 @@ from pylib import ports
from pylib.base import base_test_result
from pylib.base import test_dispatcher
from pylib.browsertests import setup as browsertests_setup
-from pylib.gtest import setup as gtest_setup
from pylib.gtest import gtest_config
-from pylib.host_driven import run_python_tests as python_dispatch
+from pylib.gtest import setup as gtest_setup
+from pylib.host_driven import setup as host_driven_setup
from pylib.instrumentation import setup as instrumentation_setup
from pylib.uiautomator import setup as uiautomator_setup
from pylib.utils import report_results
@@ -434,8 +434,22 @@ def _RunInstrumentationTests(options, error_func):
results.AddTestRunResults(test_results)
if options.run_python_tests:
- test_results, test_exit_code = (
- python_dispatch.DispatchPythonTests(options))
+ runner_factory, tests = host_driven_setup.InstrumentationSetup(
+ options.python_test_root, options.official_build, options.annotations,
+ options.exclude_annotations, options.test_filter, options.tool,
+ options.build_type, options.push_deps, options.cleanup_test_files,
+ options.test_apk_path, options.test_apk_jar_path, options.test_data,
+ options.install_apk, options.save_perf_json,
+ options.screenshot_failures, options.wait_for_debugger,
+ options.disable_assertions)
+
+ test_results, test_exit_code = test_dispatcher.RunTests(
+ tests, runner_factory, False,
+ options.test_device,
+ shard=True,
+ build_type=options.build_type,
+ test_timeout=None,
+ num_retries=options.num_retries)
results.AddTestRunResults(test_results)
@@ -480,8 +494,23 @@ def _RunUIAutomatorTests(options, error_func):
results.AddTestRunResults(test_results)
if options.run_python_tests:
- test_results, test_exit_code = (
- python_dispatch.DispatchPythonTests(options))
+ # TODO(gkanwar): Create a UIAutomator Setup, use it here
+ runner_factory, tests = host_driven_setup.InstrumentationSetup(
+ options.python_test_root, options.official_build, options.annotations,
+ options.exclude_annotations, options.test_filter, options.tool,
+ options.build_type, options.push_deps, options.cleanup_test_files,
+ options.test_apk_path, options.test_apk_jar_path, options.test_data,
+ options.install_apk, options.save_perf_json,
+ options.screenshot_failures, options.wait_for_debugger,
+ options.disable_assertion)
+
+ test_results, test_exit_code = test_dispatcher.RunTests(
+ tests, runner_factory, False,
+ options.test_device,
+ shard=True,
+ build_type=options.build_type,
+ test_timeout=None,
+ num_retries=options.num_retries)
results.AddTestRunResults(test_results)
@@ -536,8 +565,6 @@ def RunTestsCommand(command, options, args, option_parser):
else:
raise Exception('Unknown test type.')
- return exit_code
-
def HelpCommand(command, options, args, option_parser):
"""Display help for a certain command, or overall help.
@@ -605,14 +632,14 @@ class CommandOptionParser(optparse.OptionParser):
self.example = kwargs.pop('example', '')
optparse.OptionParser.__init__(self, *args, **kwargs)
- #override
+ # override
def get_usage(self):
normal_usage = optparse.OptionParser.get_usage(self)
command_list = self.get_command_list()
example = self.get_example()
return self.expand_prog_name(normal_usage + example + command_list)
- #override
+ # override
def get_command_list(self):
if self.command_list:
return '\nCommands:\n %s\n' % '\n '.join(sorted(self.command_list))

Powered by Google App Engine
This is Rietveld 408576698