| OLD | NEW |
| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 self.gclient(['config', self.svn_base + 'trunk/src/']) | 394 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 395 self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1']) | 395 self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1']) |
| 396 out = self.parseGclient(['runhooks', '--deps', 'mac'], []) | 396 out = self.parseGclient(['runhooks', '--deps', 'mac'], []) |
| 397 self.assertEquals([], out) | 397 self.assertEquals([], out) |
| 398 | 398 |
| 399 def testRevInfo(self): | 399 def testRevInfo(self): |
| 400 self.gclient(['config', self.svn_base + 'trunk/src/']) | 400 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 401 self.gclient(['sync', '--deps', 'mac']) | 401 self.gclient(['sync', '--deps', 'mac']) |
| 402 results = self.gclient(['revinfo', '--deps', 'mac']) | 402 results = self.gclient(['revinfo', '--deps', 'mac']) |
| 403 out = ('src: %(base)s/src@2;\n' | 403 out = ('src: %(base)s/src@2;\n' |
| 404 'src/file/foo: %(base)s/third_party/foo/origin;\n' | |
| 405 'src/other: %(base)s/other@2;\n' | 404 'src/other: %(base)s/other@2;\n' |
| 406 'src/third_party/foo: %(base)s/third_party/foo@1\n' % | 405 'src/third_party/foo: %(base)s/third_party/foo@1\n' % |
| 407 { 'base': self.svn_base + 'trunk' }) | 406 { 'base': self.svn_base + 'trunk' }) |
| 408 self.check((out, '', 0), results) | 407 self.check((out, '', 0), results) |
| 409 | 408 |
| 410 | 409 |
| 411 class GClientSmokeGIT(GClientSmokeBase): | 410 class GClientSmokeGIT(GClientSmokeBase): |
| 412 def setUp(self): | 411 def setUp(self): |
| 413 GClientSmokeBase.setUp(self) | 412 GClientSmokeBase.setUp(self) |
| 414 self.enabled = self.FAKE_REPOS.setUpGIT() | 413 self.enabled = self.FAKE_REPOS.setUpGIT() |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 568 tree = self.mangle_git_tree(('repo_1@2', 'src'), |
| 570 ('repo_2@1', 'src/repo2'), | 569 ('repo_2@1', 'src/repo2'), |
| 571 ('repo_3@2', 'src/repo2/repo_renamed')) | 570 ('repo_3@2', 'src/repo2/repo_renamed')) |
| 572 tree['src/git_hooked1'] = 'git_hooked1' | 571 tree['src/git_hooked1'] = 'git_hooked1' |
| 573 tree['src/git_hooked2'] = 'git_hooked2' | 572 tree['src/git_hooked2'] = 'git_hooked2' |
| 574 self.assertTree(tree) | 573 self.assertTree(tree) |
| 575 | 574 |
| 576 def testRevInfo(self): | 575 def testRevInfo(self): |
| 577 if not self.enabled: | 576 if not self.enabled: |
| 578 return | 577 return |
| 578 # TODO(maruel): Test multiple solutions. |
| 579 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 579 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
| 580 self.gclient(['sync', '--deps', 'mac']) | 580 self.gclient(['sync', '--deps', 'mac']) |
| 581 results = self.gclient(['revinfo', '--deps', 'mac']) | 581 results = self.gclient(['revinfo', '--deps', 'mac']) |
| 582 out = ('src: %(base)srepo_1@%(hash1)s;\n' | 582 out = ('src: %(base)srepo_1@%(hash1)s;\n' |
| 583 'src/repo2: %(base)srepo_2@%(hash2)s;\n' | 583 'src/repo2: %(base)srepo_2@%(hash2)s;\n' |
| 584 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % | 584 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % |
| 585 { | 585 { |
| 586 'base': self.git_base, | 586 'base': self.git_base, |
| 587 'hash1': self.githash('repo_1', 2), | 587 'hash1': self.githash('repo_1', 2), |
| 588 'hash2': self.githash('repo_2', 1), | 588 'hash2': self.githash('repo_2', 1), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 607 '{"name": "src-git",' | 607 '{"name": "src-git",' |
| 608 '"url": "' + self.git_base + 'repo_1"}]']) | 608 '"url": "' + self.git_base + 'repo_1"}]']) |
| 609 results = self.gclient(['sync', '--deps', 'mac']) | 609 results = self.gclient(['sync', '--deps', 'mac']) |
| 610 # 3x svn checkout, 3x run hooks | 610 # 3x svn checkout, 3x run hooks |
| 611 self.checkBlock(results[0], | 611 self.checkBlock(results[0], |
| 612 ['running', 'running', | 612 ['running', 'running', |
| 613 # This is due to the way svn update is called for a single | 613 # This is due to the way svn update is called for a single |
| 614 # file when File() is used in a DEPS file. | 614 # file when File() is used in a DEPS file. |
| 615 ('running', self.root_dir + '/src/file/foo'), | 615 ('running', self.root_dir + '/src/file/foo'), |
| 616 'running', 'running', 'running', 'running', 'running', | 616 'running', 'running', 'running', 'running', 'running', |
| 617 'running']) | 617 'running', 'running']) |
| 618 # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to | 618 # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to |
| 619 # new branch \'hash\''. | 619 # new branch \'hash\''. |
| 620 #self.checkString('', results[1]) | 620 #self.checkString('', results[1]) |
| 621 self.assertEquals(0, results[2]) | 621 self.assertEquals(0, results[2]) |
| 622 tree = self.mangle_git_tree(('repo_1@2', 'src-git'), | 622 tree = self.mangle_git_tree(('repo_1@2', 'src-git'), |
| 623 ('repo_2@1', 'src/repo2'), | 623 ('repo_2@1', 'src/repo2'), |
| 624 ('repo_3@2', 'src/repo2/repo_renamed')) | 624 ('repo_3@2', 'src/repo2/repo_renamed')) |
| 625 tree.update(self.mangle_svn_tree( | 625 tree.update(self.mangle_svn_tree( |
| 626 ('trunk/src@2', 'src'), | 626 ('trunk/src@2', 'src'), |
| 627 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 627 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
| 628 ('trunk/other@2', 'src/other'))) | 628 ('trunk/other@2', 'src/other'))) |
| 629 tree['src/file/foo/origin'] = 'svn/trunk/third_party/foo@2\n' | 629 tree['src/file/foo/origin'] = 'svn/trunk/third_party/foo@2\n' |
| 630 tree['src/git_hooked1'] = 'git_hooked1' | 630 tree['src/git_hooked1'] = 'git_hooked1' |
| 631 tree['src/git_hooked2'] = 'git_hooked2' | 631 tree['src/git_hooked2'] = 'git_hooked2' |
| 632 tree['src/svn_hooked1'] = 'svn_hooked1' | 632 tree['src/svn_hooked1'] = 'svn_hooked1' |
| 633 tree['src/svn_hooked2'] = 'svn_hooked2' |
| 633 self.assertTree(tree) | 634 self.assertTree(tree) |
| 634 | 635 |
| 635 def testMultiSolutionsMultiRev(self): | 636 def testMultiSolutionsMultiRev(self): |
| 636 if not self.enabled: | 637 if not self.enabled: |
| 637 return | 638 return |
| 638 self.gclient(['config', '--spec', | 639 self.gclient(['config', '--spec', |
| 639 'solutions=[' | 640 'solutions=[' |
| 640 '{"name": "src",' | 641 '{"name": "src",' |
| 641 ' "url": "' + self.svn_base + 'trunk/src/"},' | 642 ' "url": "' + self.svn_base + 'trunk/src/"},' |
| 642 '{"name": "src-git",' | 643 '{"name": "src-git",' |
| (...skipping 22 matching lines...) Expand all Loading... |
| 665 self.gclient(['config', '--spec', | 666 self.gclient(['config', '--spec', |
| 666 'solutions=[' | 667 'solutions=[' |
| 667 '{"name": "src",' | 668 '{"name": "src",' |
| 668 ' "url": "' + self.svn_base + 'trunk/src/"},' | 669 ' "url": "' + self.svn_base + 'trunk/src/"},' |
| 669 '{"name": "src-git",' | 670 '{"name": "src-git",' |
| 670 '"url": "' + self.git_base + 'repo_1"}]']) | 671 '"url": "' + self.git_base + 'repo_1"}]']) |
| 671 self.gclient(['sync', '--deps', 'mac']) | 672 self.gclient(['sync', '--deps', 'mac']) |
| 672 results = self.gclient(['revinfo', '--deps', 'mac']) | 673 results = self.gclient(['revinfo', '--deps', 'mac']) |
| 673 out = ('src: %(svn_base)s/src/@2;\n' | 674 out = ('src: %(svn_base)s/src/@2;\n' |
| 674 'src-git: %(git_base)srepo_1@%(hash1)s;\n' | 675 'src-git: %(git_base)srepo_1@%(hash1)s;\n' |
| 675 'src/file/foo: %(svn_base)s/third_party/foo/origin;\n' | |
| 676 'src/other: %(svn_base)s/other@2;\n' | 676 'src/other: %(svn_base)s/other@2;\n' |
| 677 'src/repo2: %(git_base)srepo_2@%(hash2)s;\n' | 677 'src/repo2: %(git_base)srepo_2@%(hash2)s;\n' |
| 678 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s;\n' | 678 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s;\n' |
| 679 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { | 679 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { |
| 680 'svn_base': self.svn_base + 'trunk', | 680 'svn_base': self.svn_base + 'trunk', |
| 681 'git_base': self.git_base, | 681 'git_base': self.git_base, |
| 682 'hash1': self.githash('repo_1', 2), | 682 'hash1': self.githash('repo_1', 2), |
| 683 'hash2': self.githash('repo_2', 1), | 683 'hash2': self.githash('repo_2', 1), |
| 684 'hash3': self.githash('repo_3', 2), | 684 'hash3': self.githash('repo_3', 2), |
| 685 } | 685 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 if __name__ == '__main__': | 720 if __name__ == '__main__': |
| 721 if '-c' in sys.argv: | 721 if '-c' in sys.argv: |
| 722 COVERAGE = True | 722 COVERAGE = True |
| 723 sys.argv.remove('-c') | 723 sys.argv.remove('-c') |
| 724 if os.path.exists('.coverage'): | 724 if os.path.exists('.coverage'): |
| 725 os.remove('.coverage') | 725 os.remove('.coverage') |
| 726 os.environ['COVERAGE_FILE'] = os.path.join( | 726 os.environ['COVERAGE_FILE'] = os.path.join( |
| 727 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 727 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 728 '.coverage') | 728 '.coverage') |
| 729 unittest.main() | 729 unittest.main() |
| OLD | NEW |