1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Top-level presubmit script for bisect trybot.
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
8 details on the presubmit API built into gcl.
13 def _ExamineBisectConfigFile(input_api
, output_api
):
14 for f
in input_api
.AffectedFiles():
15 if not f
.LocalPath().endswith('run-bisect-perf-regression.cfg'):
19 cfg_file
= imp
.load_source('config', 'run-bisect-perf-regression.cfg')
21 for k
, v
in cfg_file
.config
.iteritems():
24 except (IOError, AttributeError, TypeError):
29 def _CheckNoChangesToBisectConfigFile(input_api
, output_api
):
30 results
= _ExamineBisectConfigFile(input_api
, output_api
)
32 return [output_api
.PresubmitError(
33 'The bisection config file should only contain a config dict with '
34 'empty fields. Changes to this file should never be submitted.',
39 def CommonChecks(input_api
, output_api
):
41 results
.extend(_CheckNoChangesToBisectConfigFile(input_api
, output_api
))
44 def CheckChangeOnUpload(input_api
, output_api
):
45 return CommonChecks(input_api
, output_api
)
47 def CheckChangeOnCommit(input_api
, output_api
):
48 return CommonChecks(input_api
, output_api
)