Index: build/android/test_runner.py |
diff --git a/build/android/test_runner.py b/build/android/test_runner.py |
index 8f0ac08edfe06ed8d25ed6a43024e5e2ab1e08b4..497642c5233d914de5451f2d5116b856a3342d44 100755 |
--- a/build/android/test_runner.py |
+++ b/build/android/test_runner.py |
@@ -594,6 +594,13 @@ def AddPerfTestOptions(parser): |
help='Only starts tests when the battery is charged above ' |
'given level.') |
group.add_argument('--known-devices-file', help='Path to known device list.') |
+ group.add_argument( |
+ '--repeat', dest='repeat', type=int, default=0, |
+ help='Number of times to repeat the specified set of tests.') |
+ group.add_argument('--break-on-failure', '--break_on_failure', |
+ dest='break_on_failure', action='store_true', |
+ help='Whether to break on failure.') |
+ |
AddCommonOptions(parser) |
AddDeviceOptions(parser) |
@@ -686,6 +693,24 @@ def _RunMonkeyTests(args, devices): |
return exit_code |
+def RunPerfTestsInPlatformMode(args): |
+ def infra_error(message): |
+ logging.fatal(message) |
+ sys.exit(constants.INFRA_EXIT_CODE) |
+ |
+ if args.single_step or args.steps: |
+ return RunTestsInPlatformMode(args) |
+ |
+ # These are not full perf test runs, they are for printing out past runs or |
+ # lists of tests. As such, they do not require the retry logic or results |
+ # logic. They only need to perform the action required and return the correct |
+ # return code. |
+ with environment_factory.CreateEnvironment(args, infra_error) as env: |
+ with test_instance_factory.CreateTestInstance(args, infra_error) as test: |
+ with test_run_factory.CreateTestRun( |
+ args, env, test, infra_error) as test_run: |
+ return test_run.RunTests() |
mikecase (-- gone --)
2016/06/01 17:40:28
Not sure I 100% sure I get what this does.
rnephew (Reviews Here)
2016/06/01 20:32:05
Talked offline about it. Also, before landing this
|
+ |
def _RunPerfTests(args, active_devices): |
"""Subcommand of RunTestsCommands which runs perf tests.""" |
perf_options = ProcessPerfTestOptions(args) |
@@ -799,6 +824,8 @@ def RunTestsCommand(args): # pylint: disable=too-many-return-statements |
if args.enable_platform_mode or command in ('gtest', 'instrumentation'): |
return RunTestsInPlatformMode(args) |
+ if command == 'perf': |
+ return RunPerfTestsInPlatformMode(args) |
forwarder.Forwarder.RemoveHostLog() |
if not ports.ResetTestServerPortAllocation(): |
@@ -827,6 +854,7 @@ _SUPPORTED_IN_PLATFORM_MODE = [ |
'gtest', |
'instrumentation', |
'uirobot', |
+ 'perf', |
mikecase (-- gone --)
2016/06/01 17:40:28
super nit: alphabetize
rnephew (Reviews Here)
2016/06/01 20:32:05
Done.
|
] |