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

Side by Side Diff: tools/vim/tests/chromium.ycm_extra_conf_unittest.py

Issue 1940753002: Enable YouCompleteMe and :CrCompile to find GN build directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change from 'out/Debug' to 'out/gn' directory in tests. Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « tools/vim/ninja_output.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright 2015 The Chromium Authors. All rights reserved. 3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Tests for chromium.ycm_extra_conf. 7 """Tests for chromium.ycm_extra_conf.
8 8
9 These tests should be getting picked up by the PRESUBMIT.py in /tools/vim. 9 These tests should be getting picked up by the PRESUBMIT.py in /tools/vim.
10 Currently the tests only run on Linux and require 'ninja' to be available on 10 Currently the tests only run on Linux and require 'ninja' to be available on
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 | .gclient 73 | .gclient
74 | 74 |
75 +-- src 75 +-- src
76 | | DEPS 76 | | DEPS
77 | | three.cc 77 | | three.cc
78 | | 78 | |
79 | +-- .git 79 | +-- .git
80 | 80 |
81 +-- out 81 +-- out
82 | 82 |
83 +-- Debug 83 +-- gn
84 build.ninja 84 build.ninja
85 """ 85 """
86 self.chrome_root = os.path.abspath(os.path.normpath( 86 self.chrome_root = os.path.abspath(os.path.normpath(
87 os.path.join(self.test_root, 'src'))) 87 os.path.join(self.test_root, 'src')))
88 self.out_dir = os.path.join(self.chrome_root, 'out', 'Debug') 88 self.out_dir = os.path.join(self.chrome_root, 'out', 'gn')
89 89
90 os.makedirs(self.chrome_root) 90 os.makedirs(self.chrome_root)
91 os.makedirs(os.path.join(self.chrome_root, '.git')) 91 os.makedirs(os.path.join(self.chrome_root, '.git'))
92 os.makedirs(self.out_dir) 92 os.makedirs(self.out_dir)
93 93
94 CreateFile(os.path.join(self.test_root, '.gclient')) 94 CreateFile(os.path.join(self.test_root, '.gclient'))
95 CreateFile(os.path.join(self.chrome_root, 'DEPS')) 95 CreateFile(os.path.join(self.chrome_root, 'DEPS'))
96 CreateFile(os.path.join(self.chrome_root, 'three.cc')) 96 CreateFile(os.path.join(self.chrome_root, 'three.cc'))
97 97
98 # Fake ninja build file. Applications of 'cxx' rule are tagged by which 98 # Fake ninja build file. Applications of 'cxx' rule are tagged by which
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 '-I[SRC]', 158 '-I[SRC]',
159 '-Wno-unknown-warning-option', 159 '-Wno-unknown-warning-option',
160 '-I[OUT]/a', 160 '-I[OUT]/a',
161 '-isysroot', 161 '-isysroot',
162 '/mac.sdk', 162 '/mac.sdk',
163 '-I[OUT]/tag-one' 163 '-I[OUT]/tag-one'
164 ]) 164 ])
165 165
166 def testOutDirNames(self): 166 def testOutDirNames(self):
167 out_root = os.path.join(self.chrome_root, 'out_with_underscore') 167 out_root = os.path.join(self.chrome_root, 'out_with_underscore')
168 out_dir = os.path.join(out_root, 'Debug') 168 out_dir = os.path.join(out_root, 'gn')
169 shutil.move(os.path.join(self.chrome_root, 'out'), 169 shutil.move(os.path.join(self.chrome_root, 'out'),
170 out_root) 170 out_root)
171 171
172 clang_options = \ 172 clang_options = \
173 self.ycm_extra_conf.GetClangOptionsFromNinjaForFilename( 173 self.ycm_extra_conf.GetClangOptionsFromNinjaForFilename(
174 self.chrome_root, os.path.join(self.chrome_root, 'one.cpp')) 174 self.chrome_root, os.path.join(self.chrome_root, 'one.cpp'))
175 self.assertIn('-I%s/a' % out_dir, clang_options) 175 self.assertIn('-I%s/a' % out_dir, clang_options)
176 self.assertIn('-I%s/tag-one' % out_dir, clang_options) 176 self.assertIn('-I%s/tag-one' % out_dir, clang_options)
177 177
178 def testGetFlagsForFileForKnownCppFile(self): 178 def testGetFlagsForFileForKnownCppFile(self):
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 '-DUSE_CLANG_COMPLETER', 330 '-DUSE_CLANG_COMPLETER',
331 '-std=c++11', 331 '-std=c++11',
332 '-x', 'c++', 332 '-x', 'c++',
333 '-I[SRC]', 333 '-I[SRC]',
334 '-Wno-unknown-warning-option', 334 '-Wno-unknown-warning-option',
335 '-I[OUT]/a', 335 '-I[OUT]/a',
336 '--sysroot=[SRC]/build/sysroot-image', 336 '--sysroot=[SRC]/build/sysroot-image',
337 ]) 337 ])
338 338
339 if __name__ == '__main__': 339 if __name__ == '__main__':
340 if not os.path.isfile('chromium.ycm_extra_conf.py'):
341 print('The test must be run from src/tools/vim/ directory')
342 sys.exit(1)
340 unittest.main() 343 unittest.main()
OLDNEW
« no previous file with comments | « tools/vim/ninja_output.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698