Commit 6d0d8be5 authored by qyearsley's avatar qyearsley Committed by Commit bot

Fix auto-bisect presubmit so that it checks config files again.

When I changed this PRESUBMIT.py in http://crrev.com/292434, I didn't properly test it, so it hasn't actually been checking auto_bisect/bisect.cfg as it was supposed to.

This change makes so that the files listed in the CONFIG_FILES list here will be checked (including run-perf-test.cfg, even though it's outside of the auto_bisect directory).

BUG=

Review URL: https://codereview.chromium.org/669543002

Cr-Commit-Position: refs/heads/master@{#300598}
parent 79ecccab
......@@ -12,13 +12,12 @@ import imp
import subprocess
import os
# Paths to bisect config files relative to src/tools.
# Paths to bisect config files relative to this script.
CONFIG_FILES = [
'auto_bisect/config.cfg',
'run-perf-test.cfg'
'bisect.cfg',
os.path.join(os.path.pardir, 'run-perf-test.cfg'),
]
def CheckChangeOnUpload(input_api, output_api):
return _CommonChecks(input_api, output_api)
......@@ -39,10 +38,10 @@ def _CommonChecks(input_api, output_api):
def _CheckAllConfigFiles(input_api, output_api):
"""Checks all bisect config files and returns a list of presubmit results."""
results = []
for f in input_api.AffectedFiles():
for config_file in CONFIG_FILES:
if f.LocalPath().endswith(config_file):
results.extend(_CheckConfigFile(config_file, output_api))
script_path = input_api.PresubmitLocalPath()
for config_file in CONFIG_FILES:
file_path = os.path.join(script_path, config_file)
results.extend(_CheckConfigFile(file_path, output_api))
return results
......@@ -54,7 +53,7 @@ def _CheckConfigFile(file_path, output_api):
warning = 'Failed to read config file %s: %s' % (file_path, str(e))
return [output_api.PresubmitError(warning, items=[file_path])]
if not hasattr(config_file.config):
if not hasattr(config_file, 'config'):
warning = 'Config file has no "config" global variable: %s' % str(e)
return [output_api.PresubmitError(warning, items=[file_path])]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment