diff options
author | 2020-04-30 15:01:30 +0800 | |
---|---|---|
committer | 2020-05-15 11:43:43 +0800 | |
commit | 9425870f739ea42ad021373dbcdf28de104ee96d (patch) | |
tree | d5199750298682e640ddf6c894fa1d451c3f2005 /tools/auto_gen_test_config.py | |
parent | e9ab85956f38c3bcdbfd273048bed51e52a9616f (diff) |
Update auto-gen test config template with PARAMETERIZED_STRINGS
placeholder
Bug: 134509111
Test: add "test_mainline_modules: [some.apk]" to TetheringTests,
and build the modules, confirm the parameterized option is added
in the test config.
Change-Id: I0f4f837412075520153d21c9ca12cf5c3f555de7
Diffstat (limited to 'tools/auto_gen_test_config.py')
-rwxr-xr-x | tools/auto_gen_test_config.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/auto_gen_test_config.py b/tools/auto_gen_test_config.py index c7c5bdc611..943f23815b 100755 --- a/tools/auto_gen_test_config.py +++ b/tools/auto_gen_test_config.py @@ -27,6 +27,7 @@ ATTRIBUTE_RUNNER = 'android:name' ATTRIBUTE_PACKAGE = 'package' PLACEHOLDER_LABEL = '{LABEL}' +PLACEHOLDER_EXTRA_CONFIGS = '{EXTRA_CONFIGS}' PLACEHOLDER_MODULE = '{MODULE}' PLACEHOLDER_PACKAGE = '{PACKAGE}' PLACEHOLDER_RUNNER = '{RUNNER}' @@ -41,16 +42,20 @@ def main(argv): Returns: 0 if no error, otherwise 1. """ - if len(argv) != 4: + if len(argv) != 4 and len(argv) != 6: sys.stderr.write( - 'Invalid arguements. The script requires 4 arguments for file paths: ' + 'Invalid arguments. The script requires 4 arguments for file paths: ' 'target_config android_manifest empty_config ' - 'instrumentation_test_config_template.\n') + 'instrumentation_test_config_template ' + 'and 2 optional arguments for extra configs: ' + '--extra-configs \'EXTRA_CONFIGS\'.\n') return 1 + target_config = argv[0] android_manifest = argv[1] empty_config = argv[2] instrumentation_test_config_template = argv[3] + extra_configs = '\n'.join(argv[5].split('\\n')) if len(argv) == 6 else '' manifest = parse(android_manifest) instrumentation_elements = manifest.getElementsByTagName('instrumentation') @@ -80,6 +85,7 @@ def main(argv): config = config.replace(PLACEHOLDER_MODULE, module) config = config.replace(PLACEHOLDER_PACKAGE, package) config = config.replace(PLACEHOLDER_TEST_TYPE, test_type) + config = config.replace(PLACEHOLDER_EXTRA_CONFIGS, extra_configs) config = config.replace(PLACEHOLDER_RUNNER, runner) with open(target_config, 'w') as config_file: config_file.write(config) |