Skip to content

Commit

Permalink
Earlier, the script looked for dirs named 'out' or 'out_*'.
Browse files Browse the repository at this point in the history
Recently it started looking for 'out' following by an alphanumeric word
boundary. Python considers underscores as alphanumeric, so this
unfortunately broke the 'out_*' pattern.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#361655}
  • Loading branch information
lstorset authored and Commit bot committed Nov 25, 2015
1 parent e304875 commit f7a91ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions tools/vim/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def CheckChangeOnUpload(input_api, output_api):
# 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 \
'ninja_output.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(
Expand Down
2 changes: 1 addition & 1 deletion tools/vim/ninja_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def GetNinjaOutputDirectory(chrome_root, configuration=None):
output_dirs = [name_value[1]]
if not output_dirs:
for f in os.listdir(chrome_root):
if re.match(r'out\b', f):
if re.match(r'out(\b|_)', f):
out = os.path.realpath(os.path.join(chrome_root, f))
if os.path.isdir(out):
output_dirs.append(os.path.relpath(out, start = chrome_root))
Expand Down
12 changes: 12 additions & 0 deletions tools/vim/tests/chromium.ycm_extra_conf_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ def testGetClangOptionsForKnownCppFile(self):
'-I[OUT]/tag-one'
])

def testOutDirNames(self):
out_root = os.path.join(self.chrome_root, 'out_with_underscore')
out_dir = os.path.join(out_root, 'Debug')
shutil.move(os.path.join(self.chrome_root, 'out'),
out_root)

clang_options = \
self.ycm_extra_conf.GetClangOptionsFromNinjaForFilename(
self.chrome_root, os.path.join(self.chrome_root, 'one.cpp'))
self.assertIn('-I%s/a' % out_dir, clang_options)
self.assertIn('-I%s/tag-one' % out_dir, clang_options)

def testGetFlagsForFileForKnownCppFile(self):
result = self.ycm_extra_conf.FlagsForFile(
os.path.join(self.chrome_root, 'one.cpp'))
Expand Down

0 comments on commit f7a91ff

Please sign in to comment.