diff options
author | borenet <borenet@chromium.org> | 2016-10-04 12:45:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-04 12:45:41 -0700 |
commit | 60b0a2d85cb8f9a8fcb91a77b1994a6177f3725f (patch) | |
tree | be18b43739030d21730f7f4485919bf1c41f3c8d /PRESUBMIT.py | |
parent | c06720d06faab3b01eba1b8693e0ac791f06dc96 (diff) |
Add --test to gen_tasks.go, add presubmit check
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2392083002
Review-Url: https://codereview.chromium.org/2392083002
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r-- | PRESUBMIT.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 8115b497b6..4798a02d59 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)) + results.extend(_CheckGNFormatted(input_api, output_api)) return results |