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

Unified Diff: PRESUBMIT.py

Issue 2392083002: Add --test to gen_tasks.go, add presubmit check (Closed)
Patch Set: Only on upload Created 4 years, 2 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 | infra/bots/gen_tasks.go » ('j') | 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 8115b497b654ec87aa198fe311105f2e0f89ff23..4798a02d594df20f6dbf4ea6f0b703bce93fc32e 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -183,6 +183,24 @@ def _RecipeSimulationTest(input_api, output_api):
'`%s` failed:\n%s' % (' '.join(cmd), e.output)))
return results
+
+def _GenTasksTest(input_api, output_api):
+ """Run gen_tasks.go test."""
+ results = []
+ if not any(f.LocalPath().startswith('infra')
+ for f in input_api.AffectedFiles()):
+ return results
+
+ gen_tasks = os.path.join('infra', 'bots', 'gen_tasks.go')
+ cmd = ['go', 'run', gen_tasks, '--test']
+ try:
+ subprocess.check_output(cmd)
+ except subprocess.CalledProcessError as e:
+ results.append(output_api.PresubmitError(
+ '`%s` failed:\n%s' % (' '.join(cmd), e.output)))
+ return results
+
+
def _CheckGNFormatted(input_api, output_api):
"""Make sure any .gn files we're changing have been formatted."""
results = []
@@ -234,8 +252,10 @@ def CheckChangeOnUpload(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
# Run on upload, not commit, since the presubmit bot apparently doesn't have
- # coverage installed.
+ # coverage or Go installed.
results.extend(_RecipeSimulationTest(input_api, output_api))
+ results.extend(_GenTasksTest(input_api, output_api))
borenet 2016/10/04 18:59:47 This is really unfortunate. We need to be able to
dogben 2016/10/04 19:16:23 Is there a reason skia_presubmit-Trybot doesn't ru
borenet 2016/10/04 19:26:55 That bot was brought up by chrome-infra after they
borenet 2016/10/04 19:32:22 Filed https://bugs.chromium.org/p/skia/issues/deta
+
results.extend(_CheckGNFormatted(input_api, output_api))
return results
« no previous file with comments | « no previous file | infra/bots/gen_tasks.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698