Index: build/android/test_runner.py |
diff --git a/build/android/test_runner.py b/build/android/test_runner.py |
index b3c1b97180c03ffb1e5ad5f1d16e0347de5f09a3..121a990a48dd986ca5e8a45ebd095c440bca024b 100755 |
--- a/build/android/test_runner.py |
+++ b/build/android/test_runner.py |
@@ -42,7 +42,7 @@ _DEVIL_STATIC_CONFIG_FILE = os.path.abspath(os.path.join( |
host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'devil_config.json')) |
-def AddTestLauncherArgs(parser): |
+def AddTestLauncherOptions(parser): |
"""Adds arguments mirroring //base/test/launcher. |
Args: |
@@ -75,6 +75,23 @@ def AddTestLauncherArgs(parser): |
return parser |
+def AddCommandLineOptions(parser): |
+ """Adds arguments to support passing command-line flags to the device.""" |
+ parser.add_argument( |
+ '--device-flags-file', |
+ type=os.path.realpath, |
+ help='The relative filepath to a file containing ' |
+ 'command-line flags to set on the device') |
+ # TODO(jbudorick): This is deprecated. Remove once clients have switched |
+ # to passing command-line flags directly. |
+ parser.add_argument( |
+ '-a', '--test-arguments', |
+ dest='test_arguments', default='', |
+ help=argparse.SUPPRESS) |
+ parser.set_defaults(allow_unknown=True) |
+ parser.set_defaults(command_line_flags=None) |
+ |
+ |
def AddTracingOptions(parser): |
# TODO(shenghuazhang): Move this into AddCommonOptions once it's supported |
# for all test types. |
@@ -160,7 +177,7 @@ def AddCommonOptions(parser): |
dest='verbose_count', default=0, action='count', |
help='Verbose level (multiple times for more)') |
- AddTestLauncherArgs(parser) |
+ AddTestLauncherOptions(parser) |
def ProcessCommonOptions(args): |
@@ -285,10 +302,6 @@ def AddGTestOptions(parser): |
'--test-apk-incremental-install-script', |
type=os.path.realpath, |
help='Path to install script for the test apk.') |
- parser.add_argument( |
- '-a', '--test-arguments', |
- dest='test_arguments', default='', |
- help='Additional arguments to pass to the test.') |
filter_group = parser.add_mutually_exclusive_group() |
filter_group.add_argument( |
@@ -335,17 +348,6 @@ def AddInstrumentationTestOptions(parser): |
action='store_true', dest='delete_stale_data', |
help='Delete stale test data on the device.') |
parser.add_argument( |
- '--device-flags', |
- dest='device_flags', |
- type=os.path.realpath, |
- help='The relative filepath to a file containing ' |
- 'command-line flags to set on the device') |
- parser.add_argument( |
- '--device-flags-file', |
- type=os.path.realpath, |
- help='The relative filepath to a file containing ' |
- 'command-line flags to set on the device') |
- parser.add_argument( |
'--disable-dalvik-asserts', |
dest='set_asserts', action='store_false', default=True, |
help='Removes the dalvik.vm.enableassertions property') |
@@ -825,6 +827,7 @@ def main(): |
AddDeviceOptions(subp) |
AddGTestOptions(subp) |
AddTracingOptions(subp) |
+ AddCommandLineOptions(subp) |
subp = command_parsers.add_parser( |
'instrumentation', |
@@ -833,6 +836,7 @@ def main(): |
AddDeviceOptions(subp) |
AddInstrumentationTestOptions(subp) |
AddTracingOptions(subp) |
+ AddCommandLineOptions(subp) |
subp = command_parsers.add_parser( |
'junit', |
@@ -868,7 +872,12 @@ def main(): |
AddCommonOptions(subp) |
AddPythonTestOptions(subp) |
- args = parser.parse_args() |
+ args, unknown_args = parser.parse_known_args() |
+ if unknown_args: |
+ if hasattr(args, 'allow_unknown') and args.allow_unknown: |
+ args.command_line_flags = unknown_args |
+ else: |
+ parser.error('unrecognized arguments: %s' % ' '.join(unknown_args)) |
try: |
return RunTestsCommand(args) |