| 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s;\n' | 653 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s;\n' |
| 654 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { | 654 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { |
| 655 'svn_base': self.svn_base + 'trunk', | 655 'svn_base': self.svn_base + 'trunk', |
| 656 'git_base': self.git_base, | 656 'git_base': self.git_base, |
| 657 'hash1': self.githash('repo_1', 2), | 657 'hash1': self.githash('repo_1', 2), |
| 658 'hash2': self.githash('repo_2', 1), | 658 'hash2': self.githash('repo_2', 1), |
| 659 'hash3': self.githash('repo_3', 2), | 659 'hash3': self.githash('repo_3', 2), |
| 660 } | 660 } |
| 661 self.check((out, '', 0), results) | 661 self.check((out, '', 0), results) |
| 662 | 662 |
| 663 def testRecurse(self): |
| 664 if not self.enabled: |
| 665 return |
| 666 self.gclient(['config', '--spec', |
| 667 'solutions=[' |
| 668 '{"name": "src",' |
| 669 ' "url": "' + self.svn_base + 'trunk/src/"},' |
| 670 '{"name": "src-git",' |
| 671 '"url": "' + self.git_base + 'repo_1"}]']) |
| 672 self.gclient(['sync', '--deps', 'mac']) |
| 673 results = self.gclient(['recurse', 'sh', '-c', |
| 674 'echo $GCLIENT_SCM,$GCLIENT_URL,`pwd`']) |
| 675 |
| 676 entries = [tuple(line.split(',')) |
| 677 for line in results[0].strip().split('\n')] |
| 678 logging.debug(entries) |
| 679 |
| 680 bases = {'svn': self.svn_base, 'git': self.git_base} |
| 681 expected_source = [ |
| 682 ('svn', 'trunk/src/', 'src'), |
| 683 ('git', 'repo_1', 'src-git'), |
| 684 ('svn', 'trunk/other', 'src/other'), |
| 685 ('git', 'repo_2@' + self.githash('repo_2', 1)[:7], 'src/repo2'), |
| 686 ('git', 'repo_3', 'src/repo2/repo_renamed'), |
| 687 ('svn', 'trunk/third_party/foo@1', 'src/third_party/foo'), |
| 688 ] |
| 689 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path)) |
| 690 for (scm, url, path) in expected_source] |
| 691 |
| 692 self.assertEquals(sorted(entries), sorted(expected)) |
| 693 |
| 663 | 694 |
| 664 if __name__ == '__main__': | 695 if __name__ == '__main__': |
| 665 if '-c' in sys.argv: | 696 if '-c' in sys.argv: |
| 666 COVERAGE = True | 697 COVERAGE = True |
| 667 sys.argv.remove('-c') | 698 sys.argv.remove('-c') |
| 668 if os.path.exists('.coverage'): | 699 if os.path.exists('.coverage'): |
| 669 os.remove('.coverage') | 700 os.remove('.coverage') |
| 670 os.environ['COVERAGE_FILE'] = os.path.join( | 701 os.environ['COVERAGE_FILE'] = os.path.join( |
| 671 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 702 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 672 '.coverage') | 703 '.coverage') |
| 673 unittest.main() | 704 unittest.main() |
| OLD | NEW |