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

Unified Diff: PRESUBMIT.py

Issue 1856253002: Change PRESUBMIT.py to make sure the right FlakyTest being used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 5621f9fd037151f6072d0ed06d0009e8efa9198d..5c18d2529619158b9a79dfcc614440b92fb06b5c 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -471,6 +471,21 @@ def _CheckUmaHistogramChanges(input_api, output_api):
'been modified and the associated histogram name has no match in either '
'%s or the modifications of it:' % (histograms_xml_path), problems)]
+def _CheckFlakyTestUsage(input_api, output_api):
+ """Check that FlakyTest annotation is our own instead of the android one"""
+ pattern = input_api.re.compile(r'import android.test.FlakyTest;')
+ files = []
+ for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
+ if (f.LocalPath().endswith('Test.java')):
rnephew (Reviews Here) 2016/04/11 18:58:26 nit: if (f.LocalPath().endswith('Test.java')): i
Yoland Yan(Google) 2016/04/11 19:03:44 Done.
+ contents = input_api.ReadFile(f)
+ if pattern.search(contents):
rnephew (Reviews Here) 2016/04/11 18:58:26 Since contents isn't used elsewhere, you could pro
Yoland Yan(Google) 2016/04/11 19:03:44 Done.
+ files.append(f)
+ if len(files):
+ return [ output_api.PresubmitError(
rnephew (Reviews Here) 2016/04/11 18:56:30 nit: [output_api...
Yoland Yan(Google) 2016/04/11 19:03:44 Done.
+ 'Use org.chromium.base.test.util.FlakyTest instead of ' +
rnephew (Reviews Here) 2016/04/11 18:56:30 nit: 4 space indentation. no need for + here. Thi
Yoland Yan(Google) 2016/04/11 19:03:44 Done.
+ 'android.test.FlakyTest',
+ files) ]
rnephew (Reviews Here) 2016/04/11 18:56:30 nit: files)]
Yoland Yan(Google) 2016/04/11 19:03:44 Done.
+ return []
def _CheckNoNewWStrings(input_api, output_api):
"""Checks to make sure we don't introduce use of wstrings."""
@@ -1794,6 +1809,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckNoAbbreviationInPngFileName(input_api, output_api))
results.extend(_CheckForInvalidOSMacros(input_api, output_api))
results.extend(_CheckForInvalidIfDefinedMacros(input_api, output_api))
+ results.extend(_CheckFlakyTestUsage(input_api, output_api))
# TODO(danakj): Remove this when base/move.h is removed.
results.extend(_CheckForUsingPass(input_api, output_api))
results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api))
« 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