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

Side by Side Diff: tests/gclient_smoketest.py

Issue 2393773003: Remove SVN support from gclient_utils and gclient_scm (Closed)
Patch Set: Rebase Created 4 years, 2 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 | « tests/gclient_scm_test.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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Smoke tests for gclient.py. 6 """Smoke tests for gclient.py.
7 7
8 Shell out 'gclient' and run basic conformance tests. 8 Shell out 'gclient' and run basic conformance tests.
9 9
10 This test assumes GClientSmokeBase.URL_BASE is valid. 10 This test assumes GClientSmokeBase.URL_BASE is valid.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 """Work around svn status difference between svn 1.5 and svn 1.6 149 """Work around svn status difference between svn 1.5 and svn 1.6
150 I don't know why but on Windows they are reversed. So sorts the items.""" 150 I don't know why but on Windows they are reversed. So sorts the items."""
151 for i in xrange(len(out)): 151 for i in xrange(len(out)):
152 if len(out[i]) < 2: 152 if len(out[i]) < 2:
153 continue 153 continue
154 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]]) 154 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]])
155 return out 155 return out
156 156
157 157
158 class GClientSmoke(GClientSmokeBase): 158 class GClientSmoke(GClientSmokeBase):
159 """Doesn't require either svnserve nor git-daemon.""" 159 """Doesn't require git-daemon."""
160 @property
161 def svn_base(self):
162 return 'svn://random.server/svn/'
163
164 @property 160 @property
165 def git_base(self): 161 def git_base(self):
166 return 'git://random.server/git/' 162 return 'git://random.server/git/'
167 163
168 def testHelp(self): 164 def testHelp(self):
169 """testHelp: make sure no new command was added.""" 165 """testHelp: make sure no new command was added."""
170 result = self.gclient(['help']) 166 result = self.gclient(['help'])
171 # Roughly, not too short, not too long. 167 # Roughly, not too short, not too long.
172 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2300, 168 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2300,
173 'Too much written to stdout: %d bytes' % len(result[0])) 169 'Too much written to stdout: %d bytes' % len(result[0]))
(...skipping 22 matching lines...) Expand all
196 192
197 def testConfig(self): 193 def testConfig(self):
198 p = join(self.root_dir, '.gclient') 194 p = join(self.root_dir, '.gclient')
199 def test(cmd, expected): 195 def test(cmd, expected):
200 if os.path.exists(p): 196 if os.path.exists(p):
201 os.remove(p) 197 os.remove(p)
202 results = self.gclient(cmd) 198 results = self.gclient(cmd)
203 self.check(('', '', 0), results) 199 self.check(('', '', 0), results)
204 self.checkString(expected, open(p, 'rU').read()) 200 self.checkString(expected, open(p, 'rU').read())
205 201
206 test(['config', self.svn_base + 'trunk/src/'], 202 test(['config', self.git_base + 'src/'],
207 ('solutions = [\n' 203 ('solutions = [\n'
208 ' { "name" : "src",\n' 204 ' { "name" : "src",\n'
209 ' "url" : "%strunk/src",\n' 205 ' "url" : "%ssrc",\n'
210 ' "deps_file" : "DEPS",\n' 206 ' "deps_file" : "DEPS",\n'
211 ' "managed" : True,\n' 207 ' "managed" : True,\n'
212 ' "custom_deps" : {\n' 208 ' "custom_deps" : {\n'
213 ' },\n' 209 ' },\n'
214 ' "safesync_url": "",\n' 210 ' "safesync_url": "",\n'
215 ' },\n' 211 ' },\n'
216 ']\n' 212 ']\n'
217 'cache_dir = None\n') % self.svn_base) 213 'cache_dir = None\n') % self.git_base)
218 214
219 test(['config', self.git_base + 'repo_1', '--name', 'src'], 215 test(['config', self.git_base + 'repo_1', '--name', 'src'],
220 ('solutions = [\n' 216 ('solutions = [\n'
221 ' { "name" : "src",\n' 217 ' { "name" : "src",\n'
222 ' "url" : "%srepo_1",\n' 218 ' "url" : "%srepo_1",\n'
223 ' "deps_file" : "DEPS",\n' 219 ' "deps_file" : "DEPS",\n'
224 ' "managed" : True,\n' 220 ' "managed" : True,\n'
225 ' "custom_deps" : {\n' 221 ' "custom_deps" : {\n'
226 ' },\n' 222 ' },\n'
227 ' "safesync_url": "",\n' 223 ' "safesync_url": "",\n'
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 self.check(('', '', 0), self.gclient(['pack'])) 276 self.check(('', '', 0), self.gclient(['pack']))
281 self.check(('', '', 0), self.gclient(['revert'])) 277 self.check(('', '', 0), self.gclient(['revert']))
282 self.assertTree({}) 278 self.assertTree({})
283 self.check(('', '', 0), self.gclient(['runhooks'])) 279 self.check(('', '', 0), self.gclient(['runhooks']))
284 self.assertTree({}) 280 self.assertTree({})
285 self.check(('', '', 0), self.gclient(['status'])) 281 self.check(('', '', 0), self.gclient(['status']))
286 282
287 def testDifferentTopLevelDirectory(self): 283 def testDifferentTopLevelDirectory(self):
288 # Check that even if the .gclient file does not mention the directory src 284 # Check that even if the .gclient file does not mention the directory src
289 # itself, but it is included via dependencies, the .gclient file is used. 285 # itself, but it is included via dependencies, the .gclient file is used.
290 self.gclient(['config', self.svn_base + 'trunk/src.DEPS']) 286 self.gclient(['config', self.git_base + 'src.DEPS'])
291 deps = join(self.root_dir, 'src.DEPS') 287 deps = join(self.root_dir, 'src.DEPS')
292 os.mkdir(deps) 288 os.mkdir(deps)
289 subprocess2.check_output(['git', 'init'], cwd=deps)
293 write(join(deps, 'DEPS'), 290 write(join(deps, 'DEPS'),
294 'deps = { "src": "%strunk/src" }' % (self.svn_base)) 291 'deps = { "src": "%ssrc" }' % (self.git_base))
292 subprocess2.check_output(['git', 'add', 'DEPS'], cwd=deps)
293 subprocess2.check_output(
294 ['git', 'commit', '-a', '-m', 'DEPS file'], cwd=deps)
295 src = join(self.root_dir, 'src') 295 src = join(self.root_dir, 'src')
296 os.mkdir(src) 296 os.mkdir(src)
297 res = self.gclient(['status', '--jobs', '1'], src) 297 subprocess2.check_output(['git', 'init'], cwd=src)
298 res = self.gclient(['status', '--jobs', '1', '-v'], src)
298 self.checkBlock(res[0], [('running', deps), ('running', src)]) 299 self.checkBlock(res[0], [('running', deps), ('running', src)])
299 300
300 301
301 class GClientSmokeGIT(GClientSmokeBase): 302 class GClientSmokeGIT(GClientSmokeBase):
302 def setUp(self): 303 def setUp(self):
303 super(GClientSmokeGIT, self).setUp() 304 super(GClientSmokeGIT, self).setUp()
304 self.enabled = self.FAKE_REPOS.set_up_git() 305 self.enabled = self.FAKE_REPOS.set_up_git()
305 306
306 def testSync(self): 307 def testSync(self):
307 if not self.enabled: 308 if not self.enabled:
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 907
907 if '-c' in sys.argv: 908 if '-c' in sys.argv:
908 COVERAGE = True 909 COVERAGE = True
909 sys.argv.remove('-c') 910 sys.argv.remove('-c')
910 if os.path.exists('.coverage'): 911 if os.path.exists('.coverage'):
911 os.remove('.coverage') 912 os.remove('.coverage')
912 os.environ['COVERAGE_FILE'] = os.path.join( 913 os.environ['COVERAGE_FILE'] = os.path.join(
913 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 914 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
914 '.coverage') 915 '.coverage')
915 unittest.main() 916 unittest.main()
OLDNEW
« no previous file with comments | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698