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

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

Issue 2777353002: Upload the test results html file to google bucket. (Closed)
Patch Set: Created 3 years, 9 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
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 e8a49086f75ec182ac4b3ed73d8daa3dd01ef076..d257d69cf1df093b2f59174f9655bcd01ae49fc9 100755
--- a/build/android/pylib/results/presentation/test_results_presentation.py
+++ b/build/android/pylib/results/presentation/test_results_presentation.py
@@ -7,7 +7,10 @@
import argparse
import collections
import json
+import tempfile
+import time
import os
+import subprocess
import sys
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -274,6 +277,20 @@ def result_details(json_path, cs_base_url, master_name):
results_dict[test].extend(test_runs)
return results_to_html(results_dict, cs_base_url, master_name)
+def upload_to_google_bucket(html, args):
+ with tempfile.NamedTemporaryFile(suffix='.html') as temp_file:
+ temp_file.write(html)
+ dest = 'html/%s/%s_%s_%s.html' % (
+ args.test_name if args.test_name else 'test_name',
BigBossZhiling 2017/03/27 22:54:54 I am not sure whether we want to make test_name, (
jbudorick 2017/03/28 02:15:33 I think they should all be mandatory.
+ args.builder_name if args.builder_name else 'builder_name',
+ args.build_number if args.build_number else 'builder_number',
+ time.strftime('%Y_%m_%d_T%H_%M_%S'))
+ gsutil_path = os.path.join(BASE_DIR, 'third_party', 'catapult',
+ 'third_party', 'gsutil', 'gsutil.py')
+
+ subprocess.check_call('python %s cp %s gs://%s/%s' % (
+ gsutil_path, temp_file.name, args.bucket, dest), shell=True)
+ return 'https://storage.googleapis.com/%s/%s' % (args.bucket, dest)
def main():
parser = argparse.ArgumentParser()
@@ -281,12 +298,17 @@ def main():
parser.add_argument('--cs-base-url', help='Base url for code search.',
default='http://cs.chromium.org')
parser.add_argument('--master-name', help='Master name in urls.')
+ parser.add_argument('--bucket', default='chromium-result-details')
+ 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.')
args = parser.parse_args()
if os.path.exists(args.json_file):
result_html_string = result_details(args.json_file, args.cs_base_url,
args.master_name)
- print result_html_string.encode('UTF-8')
+ print upload_to_google_bucket(result_html_string.encode('UTF-8'),
+ args)
jbudorick 2017/03/28 02:15:33 This should pass args.test_name, args.builder_name
else:
raise IOError('--json-file %s not found.' % args.json_file)

Powered by Google App Engine
This is Rietveld 408576698