Index: build/android/pylib/results/presentation/test_results_presentation.py |
diff --git a/build/android/pylib/results/presentation/test_results_presentation.py b/build/android/pylib/results/presentation/test_results_presentation.py |
index d7e2b5a300ae13e292647270d54562990dd91462..07f30c2d463b607e9994b281992058bf31e3a138 100755 |
--- a/build/android/pylib/results/presentation/test_results_presentation.py |
+++ b/build/android/pylib/results/presentation/test_results_presentation.py |
@@ -306,6 +306,7 @@ def upload_to_google_bucket(html, test_name, builder_name, build_number, |
return '%s/%s/%s' % (server_url, bucket, dest) |
+ |
def main(): |
parser = argparse.ArgumentParser() |
parser.add_argument('--json-file', help='Path of json file.') |
@@ -347,16 +348,21 @@ def main(): |
if ((args.build_properties is None) == |
(args.build_number is None or args.builder_name is None)): |
raise parser.error('Exactly one of build_perperties or ' |
- '(build_number or builder_names) should be given.') |
+ '(build_number or builder_name) should be given.') |
if (args.build_number is None) != (args.builder_name is None): |
raise parser.error('args.build_number and args.builder_name ' |
- 'has to be be given together' |
- 'or not given at all.') |
- |
- if (len(args.positional) == 0) == (args.json_file is None): |
+ 'has to be be given together' |
+ 'or not given at all.') |
+ |
+ if len(args.positional) == 0 and args.json_file is None: |
+ if args.output_json: |
+ with open(args.output_json, 'w') as f: |
+ json.dump({}, f) |
+ return |
+ elif len(args.positional) != 0 and args.json_file: |
raise parser.error('Exactly one of args.positional and ' |
- 'args.json_file should be given.') |
+ 'args.json_file should be given.') |
if args.build_properties: |
build_properties = json.loads(args.build_properties) |