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

Unified Diff: tools/PRESUBMIT.py

Issue 529593002: In the presubmit for auto-bisect, run pylint and unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | tools/auto_bisect/PRESUBMIT.py » ('j') | 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
deleted file mode 100644
index e7b9b25faa8de33fe4437a365d011eabf094f741..0000000000000000000000000000000000000000
--- a/tools/PRESUBMIT.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Top-level presubmit script for auto-bisect.
-
-See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
-details on the presubmit API built into gcl.
-"""
-
-import imp
-import os
-
-# Paths to bisect config files relative to src/tools.
-CONFIG_FILES = [
- 'auto_bisect/config.cfg',
- 'run-perf-test.cfg'
-]
-
-PYLINT_BLACKLIST = []
-PYLINT_DISABLED_WARNINGS = []
-
-
-def CheckChangeOnUpload(input_api, output_api):
- return _CommonChecks(input_api, output_api)
-
-
-def CheckChangeOnCommit(input_api, output_api):
- return _CommonChecks(input_api, output_api)
-
-
-def _CommonChecks(input_api, output_api):
- """Does all presubmit checks for auto-bisect."""
- # TODO(qyearsley) Run bisect unit test.
- # TODO(qyearsley) Run pylint on all auto-bisect py files but not other files.
- results = []
- results.extend(_CheckAllConfigFiles(input_api, output_api))
- return results
-
-
-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))
- return results
-
-
-def _CheckConfigFile(file_path, output_api):
- """Checks one bisect config file and returns a list of presubmit results."""
- try:
- config_file = imp.load_source('config', file_path)
- except IOError as e:
- 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):
- warning = 'Config file has no "config" global variable: %s' % str(e)
- return [output_api.PresubmitError(warning, items=[file_path])]
-
- if type(config_file.config) is not dict:
- warning = 'Config file "config" global variable is not dict: %s' % str(e)
- return [output_api.PresubmitError(warning, items=[file_path])]
-
- for k, v in config_dict.iteritems():
- if v != '':
- warning = 'Non-empty value in config dict: %s: %s' % (repr(k), repr(v))
- warning += ('\nThe bisection config file should only contain a config '
- 'dict with empty fields. Changes to this file should not '
- 'be submitted.')
- return [output_api.PresubmitError(warning, items=[file_path])]
-
- return []
« no previous file with comments | « no previous file | tools/auto_bisect/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698