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

Unified Diff: PRESUBMIT.py

Issue 6758001: Move git_cl back into depot_tools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Add stub to not break incremental update Created 9 years, 9 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 | README.codereview » ('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 6232c191ba02e7e5b9839630066f1172bbdbf823..2096425b550b6b8ab421411da09f5d4fac812c3c 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1,11 +1,11 @@
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Copyright (c) 2011 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 depot tools.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
-details on the presubmit API built into gcl.
+details on the presubmit API built into depot_tools.
"""
UNIT_TESTS = [
@@ -43,14 +43,68 @@ def CommonChecks(input_api, output_api):
white_list = [r'.*\.py$', r'^git-try$']
black_list = list(input_api.DEFAULT_BLACK_LIST) + [
r'^cpplint\.py$',
- r'^git_cl[\/\\]test[\/\\](local_)?rietveld.*',
- r'^git_cl[\/\\]upload.*',
+ r'^tests[\/\\]\w+?[\/\\].+',
]
output.extend(input_api.canned_checks.RunPylint(
input_api,
output_api,
white_list=white_list,
black_list=black_list))
+ output.extend(RunGitClTests(input_api, output_api))
+ return output
+
+
+def RunGitClTests(input_api, output_api):
+ """Run all the shells scripts in the directory test.
+ """
+ # Not exposed from InputApi.
+ from os import listdir
+
+ # First loads a local Rietveld instance.
+ import sys
+ old_sys_path = sys.path
+ try:
+ sys.path = [input_api.PresubmitLocalPath()] + sys.path
+ from tests import local_rietveld # pylint: disable=W0403
+ server = local_rietveld.LocalRietveld()
+ finally:
+ sys.path = old_sys_path
+
+ # Set to True for testing.
+ verbose = False
+ if verbose:
+ stdout = None
+ stderr = None
+ else:
+ stdout = input_api.subprocess.PIPE
+ stderr = input_api.subprocess.STDOUT
+ output = []
+ try:
+ # Start a local rietveld instance to test against.
+ server.start_server()
+ test_path = input_api.os_path.abspath(
+ input_api.os_path.join(input_api.PresubmitLocalPath(), 'tests'))
+ for test in listdir(test_path):
+ # test-lib.sh is not an actual test so it should not be run. The other
+ # tests are tests known to fail.
+ DISABLED_TESTS = (
+ 'owners.sh', 'push-from-logs.sh', 'rename.sh', 'test-lib.sh')
+ if test in DISABLED_TESTS or not test.endswith('.sh'):
+ continue
+
+ print('Running %s' % test)
+ proc = input_api.subprocess.Popen(
+ [input_api.os_path.join(test_path, test)],
+ cwd=test_path,
+ stdout=stdout,
+ stderr=stderr)
+ proc.communicate()
+ if proc.returncode != 0:
+ output.append(output_api.PresubmitError('%s failed' % test))
+ except local_rietveld.Failure, e:
+ output.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args)))
+ finally:
+ server.stop_server()
return output
« no previous file with comments | « no previous file | README.codereview » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698