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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 def testRunHooksDepsOs(self): | 422 def testRunHooksDepsOs(self): |
423 self.gclient(['config', self.svn_base + 'trunk/src/']) | 423 self.gclient(['config', self.svn_base + 'trunk/src/']) |
424 self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1']) | 424 self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1']) |
425 out = self.parseGclient(['runhooks', '--deps', 'mac'], []) | 425 out = self.parseGclient(['runhooks', '--deps', 'mac'], []) |
426 self.assertEquals([], out) | 426 self.assertEquals([], out) |
427 | 427 |
428 def testRevInfo(self): | 428 def testRevInfo(self): |
429 self.gclient(['config', self.svn_base + 'trunk/src/']) | 429 self.gclient(['config', self.svn_base + 'trunk/src/']) |
430 self.gclient(['sync', '--deps', 'mac']) | 430 self.gclient(['sync', '--deps', 'mac']) |
431 results = self.gclient(['revinfo', '--deps', 'mac']) | 431 results = self.gclient(['revinfo', '--deps', 'mac']) |
| 432 out = ('src: %(base)s/src;\n' |
| 433 'src/file/other: File("%(base)s/other/DEPS");\n' |
| 434 'src/other: %(base)s/other;\n' |
| 435 'src/third_party/foo: %(base)s/third_party/foo@1\n' % |
| 436 { 'base': self.svn_base + 'trunk' }) |
| 437 self.check((out, '', 0), results) |
| 438 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) |
432 out = ('src: %(base)s/src@2;\n' | 439 out = ('src: %(base)s/src@2;\n' |
433 'src/file/other: %(base)s/other/DEPS@2;\n' | 440 'src/file/other: %(base)s/other/DEPS@2;\n' |
434 'src/other: %(base)s/other@2;\n' | 441 'src/other: %(base)s/other@2;\n' |
435 'src/third_party/foo: %(base)s/third_party/foo@1\n' % | 442 'src/third_party/foo: %(base)s/third_party/foo@1\n' % |
436 { 'base': self.svn_base + 'trunk' }) | 443 { 'base': self.svn_base + 'trunk' }) |
437 self.check((out, '', 0), results) | 444 self.check((out, '', 0), results) |
| 445 results = self.gclient(['revinfo', '--deps', 'mac', '--snapshot']) |
| 446 out = ('# Snapshot generated with gclient revinfo --snapshot\n' |
| 447 'solutions = [\n' |
| 448 ' { "name" : "src",\n' |
| 449 ' "url" : "%(base)s/src",\n' |
| 450 ' "custom_deps" : {\n' |
| 451 ' "foo/bar": None,\n' |
| 452 ' "invalid": None,\n' |
| 453 ' "src/file/other": \'%(base)s/other/DEPS@2\',\n' |
| 454 ' "src/other": \'%(base)s/other@2\',\n' |
| 455 ' "src/third_party/foo": ' |
| 456 '\'%(base)s/third_party/foo@1\',\n' |
| 457 ' },\n' |
| 458 ' "safesync_url": "",\n' |
| 459 ' },\n' |
| 460 ']\n\n' % |
| 461 { 'base': self.svn_base + 'trunk' }) |
| 462 self.check((out, '', 0), results) |
438 | 463 |
439 | 464 |
440 class GClientSmokeGIT(GClientSmokeBase): | 465 class GClientSmokeGIT(GClientSmokeBase): |
441 def setUp(self): | 466 def setUp(self): |
442 GClientSmokeBase.setUp(self) | 467 GClientSmokeBase.setUp(self) |
443 self.enabled = self.FAKE_REPOS.setUpGIT() | 468 self.enabled = self.FAKE_REPOS.setUpGIT() |
444 | 469 |
445 def testSync(self): | 470 def testSync(self): |
446 if not self.enabled: | 471 if not self.enabled: |
447 return | 472 return |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 tree['src/git_hooked1'] = 'git_hooked1' | 626 tree['src/git_hooked1'] = 'git_hooked1' |
602 tree['src/git_hooked2'] = 'git_hooked2' | 627 tree['src/git_hooked2'] = 'git_hooked2' |
603 self.assertTree(tree) | 628 self.assertTree(tree) |
604 | 629 |
605 def testRevInfo(self): | 630 def testRevInfo(self): |
606 if not self.enabled: | 631 if not self.enabled: |
607 return | 632 return |
608 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 633 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
609 self.gclient(['sync', '--deps', 'mac']) | 634 self.gclient(['sync', '--deps', 'mac']) |
610 results = self.gclient(['revinfo', '--deps', 'mac']) | 635 results = self.gclient(['revinfo', '--deps', 'mac']) |
| 636 out = ('src: %(base)srepo_1;\n' |
| 637 'src/repo2: %(base)srepo_2@%(hash2)s;\n' |
| 638 'src/repo2/repo_renamed: %(base)srepo_3\n' % |
| 639 { |
| 640 'base': self.git_base, |
| 641 'hash1': self.githash('repo_1', 2)[:7], |
| 642 'hash2': self.githash('repo_2', 1)[:7], |
| 643 'hash3': self.githash('repo_3', 2)[:7], |
| 644 }) |
| 645 self.check((out, '', 0), results) |
| 646 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) |
611 out = ('src: %(base)srepo_1@%(hash1)s;\n' | 647 out = ('src: %(base)srepo_1@%(hash1)s;\n' |
612 'src/repo2: %(base)srepo_2@%(hash2)s;\n' | 648 'src/repo2: %(base)srepo_2@%(hash2)s;\n' |
613 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % | 649 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % |
614 { | 650 { |
615 'base': self.git_base, | 651 'base': self.git_base, |
616 'hash1': self.githash('repo_1', 2), | 652 'hash1': self.githash('repo_1', 2), |
617 'hash2': self.githash('repo_2', 1), | 653 'hash2': self.githash('repo_2', 1), |
618 'hash3': self.githash('repo_3', 2), | 654 'hash3': self.githash('repo_3', 2), |
619 }) | 655 }) |
620 self.check((out, '', 0), results) | 656 self.check((out, '', 0), results) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 if not self.enabled: | 729 if not self.enabled: |
694 return | 730 return |
695 self.gclient(['config', '--spec', | 731 self.gclient(['config', '--spec', |
696 'solutions=[' | 732 'solutions=[' |
697 '{"name": "src",' | 733 '{"name": "src",' |
698 ' "url": "' + self.svn_base + 'trunk/src/"},' | 734 ' "url": "' + self.svn_base + 'trunk/src/"},' |
699 '{"name": "src-git",' | 735 '{"name": "src-git",' |
700 '"url": "' + self.git_base + 'repo_1"}]']) | 736 '"url": "' + self.git_base + 'repo_1"}]']) |
701 self.gclient(['sync', '--deps', 'mac']) | 737 self.gclient(['sync', '--deps', 'mac']) |
702 results = self.gclient(['revinfo', '--deps', 'mac']) | 738 results = self.gclient(['revinfo', '--deps', 'mac']) |
| 739 out = ('src: %(svn_base)s/src/;\n' |
| 740 'src-git: %(git_base)srepo_1;\n' |
| 741 'src/file/other: File("%(svn_base)s/other/DEPS");\n' |
| 742 'src/other: %(svn_base)s/other;\n' |
| 743 'src/repo2: %(git_base)srepo_2@%(hash2)s;\n' |
| 744 'src/repo2/repo_renamed: %(git_base)srepo_3;\n' |
| 745 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { |
| 746 'svn_base': self.svn_base + 'trunk', |
| 747 'git_base': self.git_base, |
| 748 'hash1': self.githash('repo_1', 2)[:7], |
| 749 'hash2': self.githash('repo_2', 1)[:7], |
| 750 'hash3': self.githash('repo_3', 2)[:7], |
| 751 } |
| 752 self.check((out, '', 0), results) |
| 753 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) |
703 out = ('src: %(svn_base)s/src/@2;\n' | 754 out = ('src: %(svn_base)s/src/@2;\n' |
704 'src-git: %(git_base)srepo_1@%(hash1)s;\n' | 755 'src-git: %(git_base)srepo_1@%(hash1)s;\n' |
705 'src/file/other: %(svn_base)s/other/DEPS@2;\n' | 756 'src/file/other: %(svn_base)s/other/DEPS@2;\n' |
706 'src/other: %(svn_base)s/other@2;\n' | 757 'src/other: %(svn_base)s/other@2;\n' |
707 'src/repo2: %(git_base)srepo_2@%(hash2)s;\n' | 758 'src/repo2: %(git_base)srepo_2@%(hash2)s;\n' |
708 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s;\n' | 759 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s;\n' |
709 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { | 760 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { |
710 'svn_base': self.svn_base + 'trunk', | 761 'svn_base': self.svn_base + 'trunk', |
711 'git_base': self.git_base, | 762 'git_base': self.git_base, |
712 'hash1': self.githash('repo_1', 2), | 763 'hash1': self.githash('repo_1', 2), |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 if __name__ == '__main__': | 879 if __name__ == '__main__': |
829 if '-c' in sys.argv: | 880 if '-c' in sys.argv: |
830 COVERAGE = True | 881 COVERAGE = True |
831 sys.argv.remove('-c') | 882 sys.argv.remove('-c') |
832 if os.path.exists('.coverage'): | 883 if os.path.exists('.coverage'): |
833 os.remove('.coverage') | 884 os.remove('.coverage') |
834 os.environ['COVERAGE_FILE'] = os.path.join( | 885 os.environ['COVERAGE_FILE'] = os.path.join( |
835 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 886 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
836 '.coverage') | 887 '.coverage') |
837 unittest.main() | 888 unittest.main() |
OLD | NEW |