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

Unified Diff: tools/testrunner/local/statusfile.py

Issue 1477403002: [test+presubmit] Remove duplicate test status file entries (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove global variable hack Created 5 years, 1 month 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
« tools/presubmit.py ('K') | « tools/presubmit.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testrunner/local/statusfile.py
diff --git a/tools/testrunner/local/statusfile.py b/tools/testrunner/local/statusfile.py
index 6e2a012a9aa0795a0f1a1a812fbc5dfaaead0185..6e66a72b951a552f42e5edb1bcfd12a5871ff9f9 100644
--- a/tools/testrunner/local/statusfile.py
+++ b/tools/testrunner/local/statusfile.py
@@ -156,20 +156,27 @@ def ReadStatusFile(path, variables):
def PresubmitCheck(path):
contents = ReadContent(path)
root_prefix = os.path.basename(os.path.dirname(path)) + "/"
+ def _Assert(check, message, status):
Michael Achenbach 2015/11/27 14:24:20 nit: naming (optional). Since it's nested, the _ i
Jakob Kummerow 2015/11/27 14:43:26 Compromise: _assert (to emphasize that it's a cust
+ if not check:
+ print("%s: Error: %s" % (path, message))
+ status["success"] = False
+ status = {"success": True}
Michael Achenbach 2015/11/27 14:24:20 As talked offline. You could move this a few lines
Jakob Kummerow 2015/11/27 14:43:26 Done.
try:
for section in contents:
- assert type(section) == list
- assert len(section) == 2
+ _Assert(type(section) == list, "Section must be a list", status)
Michael Achenbach 2015/11/27 14:24:20 Just for the record. Also as discussed offline. If
Jakob Kummerow 2015/11/27 14:43:26 Keeping as is, reasoning: it's rather unlikely tha
+ _Assert(len(section) == 2, "Section list must have exactly 2 entries",
+ status)
section = section[1]
- assert type(section) == dict
+ _Assert(type(section) == dict,
+ "Second entry of section must be a dictionary", status)
for rule in section:
- assert type(rule) == str
- assert not rule.startswith(root_prefix), (
- "Suite name prefix must not be used in status files")
- assert not rule.endswith('.js'), (
- ".js extension must not be used in status files.")
- return True
+ _Assert(type(rule) == str, "Rule key must be a string", status)
+ _Assert(not rule.startswith(root_prefix),
+ "Suite name prefix must not be used in rule keys", status)
+ _Assert(not rule.endswith('.js'),
+ ".js extension must not be used in rule keys.", status)
+ return status["success"]
except Exception as e:
print e
return False
« tools/presubmit.py ('K') | « tools/presubmit.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698