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

Unified Diff: tools/presubmit.py

Issue 2553633002: [test] Only run presubmit for changed status files (Closed)
Patch Set: Rebase Created 4 years 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 | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/presubmit.py
diff --git a/tools/presubmit.py b/tools/presubmit.py
index 583b918e4b0385a5a947f996458079bd2e1bd609..50e91bcb651c4bd4e78fccc3336478ac1b7f1dee 100755
--- a/tools/presubmit.py
+++ b/tools/presubmit.py
@@ -461,17 +461,23 @@ def _CheckStatusFileForDuplicateKeys(filepath):
json.loads(contents, object_pairs_hook=check_pairs)
return status["success"]
-def CheckStatusFiles(workspace):
- success = True
- suite_paths = utils.GetSuitePaths(join(workspace, "test"))
- for root in suite_paths:
- suite_path = join(workspace, "test", root)
- status_file_path = join(suite_path, root + ".status")
- suite = testsuite.TestSuite.LoadTestSuite(suite_path)
- if suite and exists(status_file_path):
+
+class StatusFilesProcessor(SourceFileProcessor):
+ """Checks status files for incorrect syntax and duplicate keys."""
+
+ def IsRelevant(self, name):
+ return name.endswith('.status')
+
+ def GetPathsToSearch(self):
+ return ['test']
+
+ def ProcessFiles(self, files):
+ success = True
+ for status_file_path in files:
success &= statusfile.PresubmitCheck(status_file_path)
success &= _CheckStatusFileForDuplicateKeys(status_file_path)
- return success
+ return success
+
def GetOptions():
result = optparse.OptionParser()
@@ -491,7 +497,8 @@ def Main():
print "Running copyright header, trailing whitespaces and " \
"two empty lines between declarations check..."
success &= SourceProcessor().RunOnPath(workspace)
- success &= CheckStatusFiles(workspace)
+ print "Running status-files check..."
+ success &= StatusFilesProcessor().RunOnPath(workspace)
if success:
return 0
else:
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698