| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 595 tree = self.mangle_git_tree(('repo_1@2', 'src'), |
| 596 ('repo_2@1', 'src/repo2'), | 596 ('repo_2@1', 'src/repo2'), |
| 597 ('repo_3@2', 'src/repo2/repo_renamed')) | 597 ('repo_3@2', 'src/repo2/repo_renamed')) |
| 598 tree['src/git_hooked1'] = 'git_hooked1' | 598 tree['src/git_hooked1'] = 'git_hooked1' |
| 599 tree['src/git_hooked2'] = 'git_hooked2' | 599 tree['src/git_hooked2'] = 'git_hooked2' |
| 600 self.assertTree(tree) | 600 self.assertTree(tree) |
| 601 | 601 |
| 602 def testRevInfo(self): | 602 def testRevInfo(self): |
| 603 if not self.enabled: | 603 if not self.enabled: |
| 604 return | 604 return |
| 605 # TODO(maruel): Test multiple solutions. | |
| 606 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 605 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
| 607 self.gclient(['sync', '--deps', 'mac']) | 606 self.gclient(['sync', '--deps', 'mac']) |
| 608 results = self.gclient(['revinfo', '--deps', 'mac']) | 607 results = self.gclient(['revinfo', '--deps', 'mac']) |
| 609 out = ('src: %(base)srepo_1@%(hash1)s;\n' | 608 out = ('src: %(base)srepo_1@%(hash1)s;\n' |
| 610 'src/repo2: %(base)srepo_2@%(hash2)s;\n' | 609 'src/repo2: %(base)srepo_2@%(hash2)s;\n' |
| 611 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % | 610 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % |
| 612 { | 611 { |
| 613 'base': self.git_base, | 612 'base': self.git_base, |
| 614 'hash1': self.githash('repo_1', 2), | 613 'hash1': self.githash('repo_1', 2), |
| 615 'hash2': self.githash('repo_2', 1), | 614 'hash2': self.githash('repo_2', 1), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 634 '{"name": "src-git",' | 633 '{"name": "src-git",' |
| 635 '"url": "' + self.git_base + 'repo_1"}]']) | 634 '"url": "' + self.git_base + 'repo_1"}]']) |
| 636 results = self.gclient(['sync', '--deps', 'mac']) | 635 results = self.gclient(['sync', '--deps', 'mac']) |
| 637 # 3x svn checkout, 3x run hooks | 636 # 3x svn checkout, 3x run hooks |
| 638 self.checkBlock(results[0], | 637 self.checkBlock(results[0], |
| 639 ['running', 'running', | 638 ['running', 'running', |
| 640 # This is due to the way svn update is called for a single | 639 # This is due to the way svn update is called for a single |
| 641 # file when File() is used in a DEPS file. | 640 # file when File() is used in a DEPS file. |
| 642 ('running', self.root_dir + '/src/file/other'), | 641 ('running', self.root_dir + '/src/file/other'), |
| 643 'running', 'running', 'running', 'running', 'running', | 642 'running', 'running', 'running', 'running', 'running', |
| 644 'running', 'running']) | 643 'running']) |
| 645 # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to | 644 # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to |
| 646 # new branch \'hash\''. | 645 # new branch \'hash\''. |
| 647 #self.checkString('', results[1]) | 646 #self.checkString('', results[1]) |
| 648 self.assertEquals(0, results[2]) | 647 self.assertEquals(0, results[2]) |
| 649 tree = self.mangle_git_tree(('repo_1@2', 'src-git'), | 648 tree = self.mangle_git_tree(('repo_1@2', 'src-git'), |
| 650 ('repo_2@1', 'src/repo2'), | 649 ('repo_2@1', 'src/repo2'), |
| 651 ('repo_3@2', 'src/repo2/repo_renamed')) | 650 ('repo_3@2', 'src/repo2/repo_renamed')) |
| 652 tree.update(self.mangle_svn_tree( | 651 tree.update(self.mangle_svn_tree( |
| 653 ('trunk/src@2', 'src'), | 652 ('trunk/src@2', 'src'), |
| 654 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 653 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
| 655 ('trunk/other@2', 'src/other'))) | 654 ('trunk/other@2', 'src/other'))) |
| 656 tree['src/file/other/DEPS'] = ( | 655 tree['src/file/other/DEPS'] = ( |
| 657 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | 656 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) |
| 658 tree['src/git_hooked1'] = 'git_hooked1' | 657 tree['src/git_hooked1'] = 'git_hooked1' |
| 659 tree['src/git_hooked2'] = 'git_hooked2' | 658 tree['src/git_hooked2'] = 'git_hooked2' |
| 660 tree['src/svn_hooked1'] = 'svn_hooked1' | 659 tree['src/svn_hooked1'] = 'svn_hooked1' |
| 661 tree['src/svn_hooked2'] = 'svn_hooked2' | |
| 662 self.assertTree(tree) | 660 self.assertTree(tree) |
| 663 | 661 |
| 664 def testMultiSolutionsMultiRev(self): | 662 def testMultiSolutionsMultiRev(self): |
| 665 if not self.enabled: | 663 if not self.enabled: |
| 666 return | 664 return |
| 667 self.gclient(['config', '--spec', | 665 self.gclient(['config', '--spec', |
| 668 'solutions=[' | 666 'solutions=[' |
| 669 '{"name": "src",' | 667 '{"name": "src",' |
| 670 ' "url": "' + self.svn_base + 'trunk/src/"},' | 668 ' "url": "' + self.svn_base + 'trunk/src/"},' |
| 671 '{"name": "src-git",' | 669 '{"name": "src-git",' |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 if __name__ == '__main__': | 825 if __name__ == '__main__': |
| 828 if '-c' in sys.argv: | 826 if '-c' in sys.argv: |
| 829 COVERAGE = True | 827 COVERAGE = True |
| 830 sys.argv.remove('-c') | 828 sys.argv.remove('-c') |
| 831 if os.path.exists('.coverage'): | 829 if os.path.exists('.coverage'): |
| 832 os.remove('.coverage') | 830 os.remove('.coverage') |
| 833 os.environ['COVERAGE_FILE'] = os.path.join( | 831 os.environ['COVERAGE_FILE'] = os.path.join( |
| 834 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 832 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 835 '.coverage') | 833 '.coverage') |
| 836 unittest.main() | 834 unittest.main() |
| OLD | NEW |