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

Unified Diff: tools/vim/PRESUBMIT.py

Issue 1468513002: [tools/vim] Only run PRESUBMIT unittests for changes that touch YCM config. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/vim/PRESUBMIT.py
diff --git a/tools/vim/PRESUBMIT.py b/tools/vim/PRESUBMIT.py
index 8b0e945be8e7acaa704c34763ebf399a5510041e..0456d37e86b253b1657275063c4ff16af79aadc6 100644
--- a/tools/vim/PRESUBMIT.py
+++ b/tools/vim/PRESUBMIT.py
@@ -8,5 +8,23 @@ Runs Python unit tests in /tools/vim/tests on upload.
"""
def CheckChangeOnUpload(input_api, output_api):
- return input_api.canned_checks.RunUnitTestsInDirectory(
- input_api, output_api, 'tests', whitelist=r'.*test.py')
+ results = []
+
+ # affected_files is list of files affected by this change. The paths are
+ # relative to the directory containing PRESUBMIT.py.
+ affected_files = [
+ input_api.os_path.relpath(f, input_api.PresubmitLocalPath())
+ for f in input_api.AbsoluteLocalPaths()]
+
+ # Run the chromium.ycm_extra_conf_unittest test if the YCM config file is
+ # changed or if any change is affecting the tests directory. This specific
+ # test requires access to 'ninja' and hasn't been tested on platforms other
+ # than Linux.
+ if 'chromium.ycm_extra_conf.py' in affected_files or \
+ any([input_api.re.match(r'tests(/|\\)',f) for f in affected_files]):
+ results += input_api.RunTests(
+ input_api.canned_checks.GetUnitTests(
+ input_api, output_api,
+ ['tests/chromium.ycm_extra_conf_unittest.py']))
+
+ return results
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698