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

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

Issue 2821533005: Make test results presentation enabled for swarming. (Closed)
Patch Set: 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 | testing/buildbot/chromium.linux.json » ('j') | testing/buildbot/chromium.linux.json » ('J')
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 3324784a4040100e77574208024121954943a889..d6dfa87d0ce0143574497b2b95417f676165e888 100755
--- a/build/android/pylib/results/presentation/test_results_presentation.py
+++ b/build/android/pylib/results/presentation/test_results_presentation.py
@@ -308,12 +308,12 @@ def upload_to_google_bucket(html, test_name, builder_name, build_number,
def main():
parser = argparse.ArgumentParser()
- parser.add_argument('--json-file', help='Path of json file.', required=True)
+ parser.add_argument('--json-file', help='Path of json file.')
parser.add_argument('--cs-base-url', help='Base url for code search.',
default='http://cs.chromium.org')
parser.add_argument('--bucket', help='Google storage bucket.', required=True)
- parser.add_argument('--builder-name', help='Builder name.', required=True)
- parser.add_argument('--build-number', help='Build number.', required=True)
+ parser.add_argument('--builder-name', help='Builder name.')
+ parser.add_argument('--build-number', help='Build number.')
parser.add_argument('--test-name', help='The name of the test.',
required=True)
parser.add_argument('--server-url', help='The url of the server.',
@@ -324,15 +324,61 @@ def main():
'whether to download the file, or view in browser.'),
default='text/html',
choices=['text/html', 'application/octet-stream'])
+ parser.add_argument(
+ '-o', '--output-json',
+ help='(Swarming Isolated Merge Script API)'
jbudorick 2017/04/17 13:00:46 This should just be "(Swarming Merge Script API)",
BigBossZhiling 2017/04/17 20:23:11 Done.
+ ' Output JSON file to create.')
+ parser.add_argument(
+ '--build-properties',
+ help='(Swarming Isolated Merge Script API) '
+ 'Build property JSON file provided by recipes.')
+ parser.add_argument(
+ '--summary-json',
+ help='(Swarming Isolated Merge Script API)'
+ ' Summary of shard state running on swarming.'
mikecase (-- gone --) 2017/04/17 17:59:20 nit, you need a space at the end of this line or b
BigBossZhiling 2017/04/17 20:23:11 Done.
+ '(Output of the swarming.py collect'
+ ' --task-summary-json=XXX command.)')
+ parser.add_argument(
+ 'positional', nargs='*',
mikecase (-- gone --) 2017/04/17 17:59:20 Im not familiar with this swarming merge scripts.
BigBossZhiling 2017/04/17 20:23:11 Acknowledged.
+ help='output.json from shards.')
+
args = parser.parse_args()
- if os.path.exists(args.json_file):
- result_html_string = result_details(args.json_file, args.cs_base_url,
+
+ if (args.build_properties and args.output_json and
jbudorick 2017/04/17 13:00:46 Instead of splitting like this, handle these argum
BigBossZhiling 2017/04/17 20:23:11 Done.
+ args.summary_json and args.positional):
+ is_swarming = True
+ else:
+ is_swarming = False
+
+ if is_swarming:
+ build_properties = json.loads(args.build_properties)
+ build_number = build_properties['buildnumber']
+ builder_name = build_properties['buildname']
+ output_json = args.output_json
+ json_file = args.positional[0]
+ else:
+ json_file = args.json_file
+ build_number = args.build_number
+ builder_name = args.builder_name
+
+ if os.path.exists(json_file):
+ result_html_string = result_details(json_file, args.cs_base_url,
args.bucket, args.server_url)
- print upload_to_google_bucket(result_html_string.encode('UTF-8'),
- args.test_name, args.builder_name,
- args.build_number, args.bucket,
- args.server_url, args.content_type)
+ result_details_link = upload_to_google_bucket(
+ result_html_string.encode('UTF-8'),
+ args.test_name, builder_name,
+ build_number, args.bucket,
+ args.server_url, args.content_type)
+
+ if is_swarming:
jbudorick 2017/04/17 13:00:46 Similarly, write the output json if output_json is
BigBossZhiling 2017/04/17 20:23:11 Done.
+ with open(json_file) as original_json_file:
+ json_object = json.loads(original_json_file.read())
+ json_object['links'] = {'result_details': result_details_link}
+ with open(output_json, 'w') as f:
+ f.write(str(json_object))
+ else:
+ print result_details_link
else:
raise IOError('--json-file %s not found.' % args.json_file)
« no previous file with comments | « no previous file | testing/buildbot/chromium.linux.json » ('j') | testing/buildbot/chromium.linux.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698