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

Side by Side Diff: tests/gclient_smoketest.py

Issue 2338002: Fix a bad merge of gclient_smoke.py in my two last concurrent changes. (Closed)
Patch Set: Created 10 years, 6 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 | « 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 self.assertTree(tree) 192 self.assertTree(tree)
193 193
194 def SyncAtRev1(self, arg): 194 def SyncAtRev1(self, arg):
195 self.gclient(['config', self.svn_base + 'trunk/src/']) 195 self.gclient(['config', self.svn_base + 'trunk/src/'])
196 results = self.gclient(['sync', '--deps', 'mac', '-r', arg]) 196 results = self.gclient(['sync', '--deps', 'mac', '-r', arg])
197 out = results[0].splitlines(False) 197 out = results[0].splitlines(False)
198 self.assertEquals(19, len(out)) 198 self.assertEquals(19, len(out))
199 self.checkString('', results[1]) 199 self.checkString('', results[1])
200 self.assertEquals(0, results[2]) 200 self.assertEquals(0, results[2])
201 tree = mangle_svn_tree( 201 tree = mangle_svn_tree(
202 (join('trunk', 'src'), 'src', FAKE.svn_revs[1]), 202 (join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[1]),
203 (join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'), 203 (join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'),
204 FAKE.svn_revs[2]), 204 self.FAKE_REPOS.svn_revs[2]),
205 (join('trunk', 'other'), join('src', 'other'), FAKE.svn_revs[2]), 205 (join('trunk', 'other'), join('src', 'other'),
206 self.FAKE_REPOS.svn_revs[2]),
206 (join('trunk', 'third_party', 'foo'), 207 (join('trunk', 'third_party', 'foo'),
207 join('src', 'third_party', 'prout'), 208 join('src', 'third_party', 'prout'),
208 FAKE.svn_revs[2]), 209 self.FAKE_REPOS.svn_revs[2]),
209 ) 210 )
210 self.assertTree(tree) 211 self.assertTree(tree)
211 212
212 def testSyncIgnoredSolutionName(self): 213 def testSyncIgnoredSolutionName(self):
213 self.SyncAtRev1('ignored@1') 214 self.SyncAtRev1('ignored@1')
214 215
215 def testSyncNoSolutionName(self): 216 def testSyncNoSolutionName(self):
216 self.SyncAtRev1('1') 217 self.SyncAtRev1('1')
217 218
218 def testRevertAndStatus(self): 219 def testRevertAndStatus(self):
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 { 489 {
489 'base': self.git_base, 490 'base': self.git_base,
490 'hash1': self.FAKE_REPOS.git_hashes['repo_1'][1][0], 491 'hash1': self.FAKE_REPOS.git_hashes['repo_1'][1][0],
491 'hash2': self.FAKE_REPOS.git_hashes['repo_2'][0][0], 492 'hash2': self.FAKE_REPOS.git_hashes['repo_2'][0][0],
492 'hash3': self.FAKE_REPOS.git_hashes['repo_3'][1][0], 493 'hash3': self.FAKE_REPOS.git_hashes['repo_3'][1][0],
493 }) 494 })
494 self.check((out, '', 0), results) 495 self.check((out, '', 0), results)
495 496
496 497
497 class GClientSmokeBoth(GClientSmokeBase): 498 class GClientSmokeBoth(GClientSmokeBase):
499 def setUp(self):
500 GClientSmokeBase.setUp(self)
501 self.FAKE_REPOS.setUpSVN()
502 self.FAKE_REPOS.setUpGIT()
503
498 def testMultiSolutions(self): 504 def testMultiSolutions(self):
499 self.gclient(['config', '--spec', 505 self.gclient(['config', '--spec',
500 'solutions=[' 506 'solutions=['
501 '{"name": "src",' 507 '{"name": "src",'
502 ' "url": "' + self.svn_base + 'trunk/src/"},' 508 ' "url": "' + self.svn_base + 'trunk/src/"},'
503 '{"name": "src-git",' 509 '{"name": "src-git",'
504 '"url": "' + self.git_base + 'repo_1"}]']) 510 '"url": "' + self.git_base + 'repo_1"}]'])
505 results = self.gclient(['sync', '--deps', 'mac']) 511 results = self.gclient(['sync', '--deps', 'mac'])
506 out = results[0].splitlines(False) 512 out = results[0].splitlines(False)
507 self.assertEquals(32, len(out)) 513 self.assertEquals(32, len(out))
508 # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to 514 # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to
509 # new branch \'hash\''. 515 # new branch \'hash\''.
510 #self.checkString('', results[1]) 516 #self.checkString('', results[1])
511 self.assertEquals(0, results[2]) 517 self.assertEquals(0, results[2])
512 tree = mangle_git_tree( 518 tree = mangle_git_tree(
513 ('src-git', FAKE.git_hashes['repo_1'][1][1]), 519 ('src-git', self.FAKE_REPOS.git_hashes['repo_1'][1][1]),
514 (join('src', 'repo2'), FAKE.git_hashes['repo_2'][0][1]), 520 (join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
515 (join('src', 'repo2', 'repo_renamed'), FAKE.git_hashes['repo_3'][1][1]), 521 (join('src', 'repo2', 'repo_renamed'),
522 self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
516 ) 523 )
517 tree.update(mangle_svn_tree( 524 tree.update(mangle_svn_tree(
518 (join('trunk', 'src'), 'src', FAKE.svn_revs[2]), 525 (join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[2]),
519 (join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'), 526 (join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'),
520 FAKE.svn_revs[1]), 527 self.FAKE_REPOS.svn_revs[1]),
521 (join('trunk', 'other'), join('src', 'other'), FAKE.svn_revs[2]), 528 (join('trunk', 'other'), join('src', 'other'),
529 self.FAKE_REPOS.svn_revs[2]),
522 )) 530 ))
523 tree[join('src', 'git_hooked1')] = 'git_hooked1' 531 tree[join('src', 'git_hooked1')] = 'git_hooked1'
524 tree[join('src', 'git_hooked2')] = 'git_hooked2' 532 tree[join('src', 'git_hooked2')] = 'git_hooked2'
525 tree[join('src', 'svn_hooked1')] = 'svn_hooked1' 533 tree[join('src', 'svn_hooked1')] = 'svn_hooked1'
526 tree[join('src', 'svn_hooked2')] = 'svn_hooked2' 534 tree[join('src', 'svn_hooked2')] = 'svn_hooked2'
527 self.assertTree(tree) 535 self.assertTree(tree)
528 536
529 def testMultiSolutionsMultiRev(self): 537 def testMultiSolutionsMultiRev(self):
530 self.gclient(['config', '--spec', 538 self.gclient(['config', '--spec',
531 'solutions=[' 539 'solutions=['
532 '{"name": "src",' 540 '{"name": "src",'
533 ' "url": "' + self.svn_base + 'trunk/src/"},' 541 ' "url": "' + self.svn_base + 'trunk/src/"},'
534 '{"name": "src-git",' 542 '{"name": "src-git",'
535 '"url": "' + self.git_base + 'repo_1"}]']) 543 '"url": "' + self.git_base + 'repo_1"}]'])
536 results = self.gclient(['sync', '--deps', 'mac', '--revision', '1', '-r', 544 results = self.gclient([
537 'src-git@' + FAKE.git_hashes['repo_1'][0][0]]) 545 'sync', '--deps', 'mac', '--revision', '1', '-r',
546 'src-git@' + self.FAKE_REPOS.git_hashes['repo_1'][0][0]])
538 out = results[0].splitlines(False) 547 out = results[0].splitlines(False)
539 self.assertEquals(35, len(out)) 548 self.assertEquals(35, len(out))
540 # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to 549 # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to
541 # new branch \'hash\''. 550 # new branch \'hash\''.
542 #self.checkString('', results[1]) 551 #self.checkString('', results[1])
543 self.assertEquals(0, results[2]) 552 self.assertEquals(0, results[2])
544 tree = mangle_git_tree( 553 tree = mangle_git_tree(
545 ('src-git', FAKE.git_hashes['repo_1'][0][1]), 554 ('src-git', self.FAKE_REPOS.git_hashes['repo_1'][0][1]),
546 (join('src', 'repo2'), FAKE.git_hashes['repo_2'][1][1]), 555 (join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
547 (join('src', 'repo2', 'repo3'), FAKE.git_hashes['repo_3'][1][1]), 556 (join('src', 'repo2', 'repo3'),
548 (join('src', 'repo4'), FAKE.git_hashes['repo_4'][1][1]), 557 self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
558 (join('src', 'repo4'), self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
549 ) 559 )
550 tree.update(mangle_svn_tree( 560 tree.update(mangle_svn_tree(
551 (join('trunk', 'src'), 'src', FAKE.svn_revs[1]), 561 (join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[1]),
552 (join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'), 562 (join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'),
553 FAKE.svn_revs[2]), 563 self.FAKE_REPOS.svn_revs[2]),
554 (join('trunk', 'other'), join('src', 'other'), FAKE.svn_revs[2]), 564 (join('trunk', 'other'), join('src', 'other'),
565 self.FAKE_REPOS.svn_revs[2]),
555 (join('trunk', 'third_party', 'foo'), 566 (join('trunk', 'third_party', 'foo'),
556 join('src', 'third_party', 'prout'), 567 join('src', 'third_party', 'prout'),
557 FAKE.svn_revs[2]), 568 self.FAKE_REPOS.svn_revs[2]),
558 )) 569 ))
559 self.assertTree(tree) 570 self.assertTree(tree)
560 571
561 572
562 if __name__ == '__main__': 573 if __name__ == '__main__':
563 if '-c' in sys.argv: 574 if '-c' in sys.argv:
564 COVERAGE = True 575 COVERAGE = True
565 sys.argv.remove('-c') 576 sys.argv.remove('-c')
566 if os.path.exists('.coverage'): 577 if os.path.exists('.coverage'):
567 os.remove('.coverage') 578 os.remove('.coverage')
568 os.environ['COVERAGE_FILE'] = os.path.join( 579 os.environ['COVERAGE_FILE'] = os.path.join(
569 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 580 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
570 '.coverage') 581 '.coverage')
571 unittest.main() 582 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