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

Unified Diff: build/android/pylib/results/presentation/test_results_presentation.py

Issue 2845973004: Dump empty json to output when no shard json file is given. (Closed)
Patch Set: fixes Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698