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

Unified Diff: tools/perf/PRESUBMIT.py

Issue 954753002: [Telemetry] Add PRESUBMIT check to prevent .sha file uploaded without archive file uploaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewers' comments Created 5 years, 10 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: tools/perf/PRESUBMIT.py
diff --git a/tools/perf/PRESUBMIT.py b/tools/perf/PRESUBMIT.py
index 7ac8a1831d5c7f738601cc403023e41a1b73fac2..92abc67ce862ecd58f2119c354f1191f8c151cdd 100644
--- a/tools/perf/PRESUBMIT.py
+++ b/tools/perf/PRESUBMIT.py
@@ -31,6 +31,38 @@ def _CommonChecks(input_api, output_api):
black_list=PYLINT_BLACKLIST,
disabled_warnings=PYLINT_DISABLED_WARNINGS))
results.extend(_CheckJson(input_api, output_api))
+ results.extend(_CheckWprShaFiles(input_api, output_api))
+ finally:
+ sys.path = old_sys_path
+ return results
+
+
+def _CheckWprShaFiles(input_api, output_api):
+ """Check whether the wpr sha files have matching URLs."""
+ results = []
+ old_sys_path = sys.path
aiolos (Not reviewing) 2015/02/24 19:37:49 The nested sys.path changes are unneeded. Either t
nednguyen 2015/02/24 20:57:46 Err, I didn't look at this carefully and thought t
+ try:
+ sys.path = [os.path.join(os.pardir, 'telemetry')] + sys.path
+ from telemetry.util import cloud_storage
+ for affected_file in input_api.AffectedFiles(include_deletes=False):
+ filename = affected_file.AbsoluteLocalPath()
+ if not filename.endswith('wpr.sha1'):
+ continue
+ is_wpr_file_uploaded = False
+ expected_hash = cloud_storage.ReadHash(filename)
+ is_wpr_file_uploaded = any(
+ cloud_storage.Exists(bucket, expected_hash)
+ for bucket in cloud_storage.BUCKET_ALIASES.itervalues())
+ if not is_wpr_file_uploaded:
+ wpr_filename = filename[:-5]
+ results.append(output_api.PresubmitError(
+ 'There is no URLs matched for wpr sha file %s.\n'
+ 'You can upload your new wpr archive file with the command:\n'
+ 'depot_tools/upload_to_google_storage.py --bucket '
+ '<Your pageset\'s bucket> %s.\nFor more info: see '
+ 'http://www.chromium.org/developers/telemetry/'
+ 'record_a_page_set#TOC-Upload-the-recording-to-Cloud-Storage' %
+ (filename, wpr_filename)))
finally:
sys.path = old_sys_path
return results
« no previous file with comments | « no previous file | tools/telemetry/telemetry/util/cloud_storage.py » ('j') | tools/telemetry/telemetry/util/cloud_storage.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698