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

Side by Side Diff: tests/gclient_smoketest.py

Issue 4215001: Add a new regression test for custom_deps in .gclient files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 GClientSmokeBase.setUp(self) 255 GClientSmokeBase.setUp(self)
256 self.enabled = self.FAKE_REPOS.setUpSVN() 256 self.enabled = self.FAKE_REPOS.setUpSVN()
257 257
258 def testSync(self): 258 def testSync(self):
259 # TODO(maruel): safesync. 259 # TODO(maruel): safesync.
260 if not self.enabled: 260 if not self.enabled:
261 return 261 return
262 self.gclient(['config', self.svn_base + 'trunk/src/']) 262 self.gclient(['config', self.svn_base + 'trunk/src/'])
263 # Test unversioned checkout. 263 # Test unversioned checkout.
264 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], 264 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'],
265 ['running', 'running', 265 ['running', 'running',
266 # This is due to the way svn update is called for a 266 # This is due to the way svn update is called for a
267 # single file when File() is used in a DEPS file. 267 # single file when File() is used in a DEPS file.
268 ('running', os.path.join(self.root_dir, 'src', 'file', 'o ther')), 268 ('running', os.path.join(self.root_dir, 'src', 'file', 'other')),
269 'running', 'running', 'running', 'running']) 269 'running', 'running', 'running', 'running'])
270 tree = self.mangle_svn_tree( 270 tree = self.mangle_svn_tree(
271 ('trunk/src@2', 'src'), 271 ('trunk/src@2', 'src'),
272 ('trunk/third_party/foo@1', 'src/third_party/foo'), 272 ('trunk/third_party/foo@1', 'src/third_party/foo'),
273 ('trunk/other@2', 'src/other')) 273 ('trunk/other@2', 'src/other'))
274 tree['src/file/other/DEPS'] = ( 274 tree['src/file/other/DEPS'] = (
275 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) 275 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS'])
276 tree['src/svn_hooked1'] = 'svn_hooked1' 276 tree['src/svn_hooked1'] = 'svn_hooked1'
277 self.assertTree(tree) 277 self.assertTree(tree)
278 278
279 # Manually remove svn_hooked1 before synching to make sure it's not 279 # Manually remove svn_hooked1 before synching to make sure it's not
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 ('trunk/src@2', 'src'), 395 ('trunk/src@2', 'src'),
396 ('trunk/third_party/foo@2', 'src/third_party/fpp'), 396 ('trunk/third_party/foo@2', 'src/third_party/fpp'),
397 ('trunk/third_party/foo@1', 'src/third_party/foo'), 397 ('trunk/third_party/foo@1', 'src/third_party/foo'),
398 ('trunk/other@2', 'src/other'), 398 ('trunk/other@2', 'src/other'),
399 ('trunk/third_party/foo@2', 'src/third_party/prout')) 399 ('trunk/third_party/foo@2', 'src/third_party/prout'))
400 tree['src/file/other/DEPS'] = ( 400 tree['src/file/other/DEPS'] = (
401 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) 401 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS'])
402 tree['src/svn_hooked1'] = 'svn_hooked1' 402 tree['src/svn_hooked1'] = 'svn_hooked1'
403 self.assertTree(tree) 403 self.assertTree(tree)
404 404
405 def testSyncCustomDeps(self):
406 if not self.enabled:
407 return
408 out = (
409 'solutions = [\n'
410 ' { "name" : "src",\n'
411 ' "url" : "%(base)s/src",\n'
412 ' "custom_deps" : {\n'
413 # Remove 2 deps, change 1, add 1.
414 ' "src/other": None,\n'
415 ' "src/third_party/foo": \'%(base)s/third_party/prout\',\n'
416 ' "src/file/other": None,\n'
417 ' "new_deps": "/trunk/src/third_party",\n'
418 ' },\n'
419 ' "safesync_url": "",\n'
420 ' },\n'
421 ']\n\n' %
422 { 'base': self.svn_base + 'trunk' })
423 fileobj = open(os.path.join(self.root_dir, '.gclient'), 'w')
424 fileobj.write(out)
425 fileobj.close()
426 self.parseGclient(
427 ['sync', '--deps', 'mac', '--jobs', '1'],
428 ['running', 'running', 'running', 'running'],
429 untangle=True)
430 tree = self.mangle_svn_tree(
431 ('trunk/src@2', 'src'),
432 ('trunk/third_party/prout@2', 'src/third_party/foo'),
433 ('trunk/src/third_party@2', 'new_deps'))
434 tree['src/svn_hooked1'] = 'svn_hooked1'
435 self.assertTree(tree)
436
405 def testRevertAndStatus(self): 437 def testRevertAndStatus(self):
406 if not self.enabled: 438 if not self.enabled:
407 return 439 return
408 self.gclient(['config', self.svn_base + 'trunk/src/']) 440 self.gclient(['config', self.svn_base + 'trunk/src/'])
409 # Tested in testSync. 441 # Tested in testSync.
410 self.gclient(['sync', '--deps', 'mac']) 442 self.gclient(['sync', '--deps', 'mac'])
411 write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!') 443 write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!')
412 444
413 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], 445 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'],
414 [['running', join(self.root_dir, 'src')], 446 [['running', join(self.root_dir, 'src')],
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 if __name__ == '__main__': 1132 if __name__ == '__main__':
1101 if '-c' in sys.argv: 1133 if '-c' in sys.argv:
1102 COVERAGE = True 1134 COVERAGE = True
1103 sys.argv.remove('-c') 1135 sys.argv.remove('-c')
1104 if os.path.exists('.coverage'): 1136 if os.path.exists('.coverage'):
1105 os.remove('.coverage') 1137 os.remove('.coverage')
1106 os.environ['COVERAGE_FILE'] = os.path.join( 1138 os.environ['COVERAGE_FILE'] = os.path.join(
1107 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 1139 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
1108 '.coverage') 1140 '.coverage')
1109 unittest.main() 1141 unittest.main()
OLDNEW
« 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