OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 ('trunk/src@2', 'src'), | 320 ('trunk/src@2', 'src'), |
321 ('trunk/third_party/foo@2', 'src/third_party/fpp'), | 321 ('trunk/third_party/foo@2', 'src/third_party/fpp'), |
322 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 322 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
323 ('trunk/other@2', 'src/other'), | 323 ('trunk/other@2', 'src/other'), |
324 ('trunk/third_party/foo@2', 'src/third_party/prout')) | 324 ('trunk/third_party/foo@2', 'src/third_party/prout')) |
325 tree['src/file/other/DEPS'] = ( | 325 tree['src/file/other/DEPS'] = ( |
326 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | 326 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) |
327 tree['src/svn_hooked1'] = 'svn_hooked1' | 327 tree['src/svn_hooked1'] = 'svn_hooked1' |
328 self.assertTree(tree) | 328 self.assertTree(tree) |
329 | 329 |
330 def testSyncTransitive(self): | |
331 # TODO(maruel): safesync. | |
332 if not self.enabled: | |
333 return | |
334 self.gclient(['config', self.svn_base + 'trunk/src/']) | |
335 # Test unversioned checkout. | |
M-A Ruel
2011/04/20 15:43:28
This whole part is unneeded since is already teste
Florian Loitsch
2011/04/20 18:32:01
Done.
| |
336 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | |
337 ['running', 'running', | |
338 # This is due to the way svn update is called for a | |
339 # single file when File() is used in a DEPS file. | |
340 ('running', os.path.join(self.root_dir, 'src', 'file', 'other')), | |
341 'running', 'running', 'running', 'running']) | |
342 tree = self.mangle_svn_tree( | |
343 ('trunk/src@2', 'src'), | |
344 ('trunk/third_party/foo@1', 'src/third_party/foo'), | |
345 ('trunk/other@2', 'src/other')) | |
346 tree['src/file/other/DEPS'] = ( | |
347 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | |
348 tree['src/svn_hooked1'] = 'svn_hooked1' | |
349 self.assertTree(tree) | |
350 | |
351 # Manually remove svn_hooked1 before synching to make sure it's not | |
352 # recreated. | |
353 os.remove(join(self.root_dir, 'src', 'svn_hooked1')) | |
354 | |
355 # Test incremental versioned sync: sync transitively backward. | |
356 self.parseGclient( | |
357 ['sync', '--transitive', '--revision', 'src@1', '--deps', 'mac', | |
358 '--delete_unversioned_trees', '--jobs', '1'], | |
359 ['running', 'running', 'running', 'running', 'deleting']) | |
360 tree = self.mangle_svn_tree( | |
361 ('trunk/src@1', 'src'), | |
362 ('trunk/third_party/foo@1', 'src/third_party/fpp'), | |
363 ('trunk/other@1', 'src/other'), | |
364 ('trunk/third_party/foo@1', 'src/third_party/prout')) | |
365 tree['src/file/other/DEPS'] = ( | |
366 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | |
367 self.assertTree(tree) | |
368 # Test incremental sync: delete-unversioned_trees isn't there. | |
M-A Ruel
2011/04/20 15:43:28
I don't think the remaining of the test adds any v
Florian Loitsch
2011/04/20 18:32:01
Done.
| |
369 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | |
370 ['running', 'running', 'running', 'running', 'running']) | |
371 tree = self.mangle_svn_tree( | |
372 ('trunk/src@2', 'src'), | |
373 ('trunk/third_party/foo@1', 'src/third_party/fpp'), | |
374 ('trunk/third_party/foo@1', 'src/third_party/foo'), | |
375 ('trunk/other@2', 'src/other'), | |
376 ('trunk/third_party/foo@1', 'src/third_party/prout')) | |
377 tree['src/file/other/DEPS'] = ( | |
378 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | |
379 tree['src/svn_hooked1'] = 'svn_hooked1' | |
380 self.assertTree(tree) | |
381 | |
330 def testSyncIgnoredSolutionName(self): | 382 def testSyncIgnoredSolutionName(self): |
331 """TODO(maruel): This will become an error soon.""" | 383 """TODO(maruel): This will become an error soon.""" |
332 if not self.enabled: | 384 if not self.enabled: |
333 return | 385 return |
334 self.gclient(['config', self.svn_base + 'trunk/src/']) | 386 self.gclient(['config', self.svn_base + 'trunk/src/']) |
335 results = self.gclient( | 387 results = self.gclient( |
336 ['sync', '--deps', 'mac', '-r', 'invalid@1', '--jobs', '1']) | 388 ['sync', '--deps', 'mac', '-r', 'invalid@1', '--jobs', '1']) |
337 self.checkBlock(results[0], [ | 389 self.checkBlock(results[0], [ |
338 'running', 'running', | 390 'running', 'running', |
339 # This is due to the way svn update is called for a single file when | 391 # This is due to the way svn update is called for a single file when |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 def testSync(self): | 763 def testSync(self): |
712 if not self.enabled: | 764 if not self.enabled: |
713 return | 765 return |
714 # TODO(maruel): safesync. | 766 # TODO(maruel): safesync. |
715 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 767 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
716 # Test unversioned checkout. | 768 # Test unversioned checkout. |
717 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | 769 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], |
718 ['running', 'running', 'running', 'running', 'running']) | 770 ['running', 'running', 'running', 'running', 'running']) |
719 # TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must | 771 # TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must |
720 # add sync parsing to get the list of updated files. | 772 # add sync parsing to get the list of updated files. |
721 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 773 tree = self.mangle_git_tree(('repo_1@3', 'src'), |
722 ('repo_2@1', 'src/repo2'), | 774 ('repo_2@1', 'src/repo2'), |
723 ('repo_3@2', 'src/repo2/repo_renamed')) | 775 ('repo_3@2', 'src/repo2/repo_renamed')) |
724 tree['src/git_hooked1'] = 'git_hooked1' | 776 tree['src/git_hooked1'] = 'git_hooked1' |
725 tree['src/git_hooked2'] = 'git_hooked2' | 777 tree['src/git_hooked2'] = 'git_hooked2' |
726 self.assertTree(tree) | 778 self.assertTree(tree) |
727 | 779 |
728 # Manually remove git_hooked1 before synching to make sure it's not | 780 # Manually remove git_hooked1 before synching to make sure it's not |
729 # recreated. | 781 # recreated. |
730 os.remove(join(self.root_dir, 'src', 'git_hooked1')) | 782 os.remove(join(self.root_dir, 'src', 'git_hooked1')) |
731 | 783 |
732 # Test incremental versioned sync: sync backward. | 784 # Test incremental versioned sync: sync backward. |
733 self.parseGclient(['sync', '--jobs', '1', '--revision', | 785 self.parseGclient(['sync', '--jobs', '1', '--revision', |
734 'src@' + self.githash('repo_1', 1), | 786 'src@' + self.githash('repo_1', 1), |
735 '--deps', 'mac', '--delete_unversioned_trees'], | 787 '--deps', 'mac', '--delete_unversioned_trees'], |
736 ['running', 'running', 'deleting']) | 788 ['running', 'running', 'deleting']) |
737 tree = self.mangle_git_tree(('repo_1@1', 'src'), | 789 tree = self.mangle_git_tree(('repo_1@1', 'src'), |
738 ('repo_2@2', 'src/repo2'), | 790 ('repo_2@2', 'src/repo2'), |
739 ('repo_3@1', 'src/repo2/repo3'), | 791 ('repo_3@1', 'src/repo2/repo3'), |
740 ('repo_4@2', 'src/repo4')) | 792 ('repo_4@2', 'src/repo4')) |
741 tree['src/git_hooked2'] = 'git_hooked2' | 793 tree['src/git_hooked2'] = 'git_hooked2' |
742 self.assertTree(tree) | 794 self.assertTree(tree) |
743 # Test incremental sync: delete-unversioned_trees isn't there. | 795 # Test incremental sync: delete-unversioned_trees isn't there. |
744 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | 796 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], |
745 ['running', 'running', 'running']) | 797 ['running', 'running', 'running']) |
746 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 798 tree = self.mangle_git_tree(('repo_1@3', 'src'), |
747 ('repo_2@1', 'src/repo2'), | 799 ('repo_2@1', 'src/repo2'), |
748 ('repo_3@1', 'src/repo2/repo3'), | 800 ('repo_3@1', 'src/repo2/repo3'), |
749 ('repo_3@2', 'src/repo2/repo_renamed'), | 801 ('repo_3@2', 'src/repo2/repo_renamed'), |
750 ('repo_4@2', 'src/repo4')) | 802 ('repo_4@2', 'src/repo4')) |
751 tree['src/git_hooked1'] = 'git_hooked1' | 803 tree['src/git_hooked1'] = 'git_hooked1' |
752 tree['src/git_hooked2'] = 'git_hooked2' | 804 tree['src/git_hooked2'] = 'git_hooked2' |
753 self.assertTree(tree) | 805 self.assertTree(tree) |
754 | 806 |
807 #def testSyncTransitive(self): | |
808 #if not self.enabled: | |
809 #return | |
810 ## TODO(maruel): safesync. | |
811 #self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | |
812 ## Test unversioned checkout. | |
813 #self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | |
814 #['running', 'running', 'running', 'running', 'running']) | |
815 ## TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, mus t | |
816 ## add sync parsing to get the list of updated files. | |
817 #tree = self.mangle_git_tree(('repo_1@3', 'src'), | |
818 #('repo_2@1', 'src/repo2'), | |
819 #('repo_3@2', 'src/repo2/repo_renamed')) | |
820 #tree['src/git_hooked1'] = 'git_hooked1' | |
821 #tree['src/git_hooked2'] = 'git_hooked2' | |
822 #self.assertTree(tree) | |
823 | |
824 ## Manually remove git_hooked1 before synching to make sure it's not | |
825 ## recreated. | |
826 #os.remove(join(self.root_dir, 'src', 'git_hooked1')) | |
827 | |
828 ## Test incremental versioned sync: sync backward. | |
829 #self.parseGclient(['sync', '--transitive', '--jobs', '1', '--revision', | |
830 #'src@' + self.githash('repo_1', 2), | |
831 #'--deps', 'mac', '--delete_unversioned_trees'], | |
832 #['running', 'running', 'deleting']) | |
833 #tree = self.mangle_git_tree(('repo_1@2', 'src'), | |
834 #('repo_2@2', 'src/repo2'), | |
835 #('repo_3@1', 'src/repo2/repo3'), | |
836 #('repo_4@1', 'src/repo4')) | |
837 #tree['src/git_hooked2'] = 'git_hooked2' | |
838 #self.assertTree(tree) | |
839 ## Test incremental sync: delete-unversioned_trees isn't there. | |
840 #self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | |
841 #['running', 'running', 'running']) | |
842 #tree = self.mangle_git_tree(('repo_1@3', 'src'), | |
843 #('repo_2@1', 'src/repo2'), | |
844 #('repo_3@1', 'src/repo2/repo3'), | |
845 #('repo_3@2', 'src/repo2/repo_renamed'), | |
846 #('repo_4@1', 'src/repo4')) | |
847 #tree['src/git_hooked1'] = 'git_hooked1' | |
848 #tree['src/git_hooked2'] = 'git_hooked2' | |
849 #self.assertTree(tree) | |
850 | |
755 def testSyncIgnoredSolutionName(self): | 851 def testSyncIgnoredSolutionName(self): |
756 """TODO(maruel): This will become an error soon.""" | 852 """TODO(maruel): This will become an error soon.""" |
757 if not self.enabled: | 853 if not self.enabled: |
758 return | 854 return |
759 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 855 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
760 self.parseGclient( | 856 self.parseGclient( |
761 ['sync', '--deps', 'mac', '--jobs', '1', | 857 ['sync', '--deps', 'mac', '--jobs', '1', |
762 '--revision', 'invalid@' + self.githash('repo_1', 1)], | 858 '--revision', 'invalid@' + self.githash('repo_1', 1)], |
763 ['running', 'running', 'running', 'running', 'running'], | 859 ['running', 'running', 'running', 'running', 'running'], |
764 'Please fix your script, having invalid --revision flags ' | 860 'Please fix your script, having invalid --revision flags ' |
765 'will soon considered an error.\n') | 861 'will soon considered an error.\n') |
766 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 862 tree = self.mangle_git_tree(('repo_1@3', 'src'), |
767 ('repo_2@1', 'src/repo2'), | 863 ('repo_2@1', 'src/repo2'), |
768 ('repo_3@2', 'src/repo2/repo_renamed')) | 864 ('repo_3@2', 'src/repo2/repo_renamed')) |
769 tree['src/git_hooked1'] = 'git_hooked1' | 865 tree['src/git_hooked1'] = 'git_hooked1' |
770 tree['src/git_hooked2'] = 'git_hooked2' | 866 tree['src/git_hooked2'] = 'git_hooked2' |
771 self.assertTree(tree) | 867 self.assertTree(tree) |
772 | 868 |
773 def testSyncNoSolutionName(self): | 869 def testSyncNoSolutionName(self): |
774 if not self.enabled: | 870 if not self.enabled: |
775 return | 871 return |
776 # When no solution name is provided, gclient uses the first solution listed. | 872 # When no solution name is provided, gclient uses the first solution listed. |
(...skipping 11 matching lines...) Expand all Loading... | |
788 if not self.enabled: | 884 if not self.enabled: |
789 return | 885 return |
790 # TODO(maruel): safesync. | 886 # TODO(maruel): safesync. |
791 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 887 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
792 # Test unversioned checkout. | 888 # Test unversioned checkout. |
793 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '8'], | 889 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '8'], |
794 ['running', 'running', 'running', 'running', 'running'], | 890 ['running', 'running', 'running', 'running', 'running'], |
795 untangle=True) | 891 untangle=True) |
796 # TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must | 892 # TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must |
797 # add sync parsing to get the list of updated files. | 893 # add sync parsing to get the list of updated files. |
798 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 894 tree = self.mangle_git_tree(('repo_1@3', 'src'), |
799 ('repo_2@1', 'src/repo2'), | 895 ('repo_2@1', 'src/repo2'), |
800 ('repo_3@2', 'src/repo2/repo_renamed')) | 896 ('repo_3@2', 'src/repo2/repo_renamed')) |
801 tree['src/git_hooked1'] = 'git_hooked1' | 897 tree['src/git_hooked1'] = 'git_hooked1' |
802 tree['src/git_hooked2'] = 'git_hooked2' | 898 tree['src/git_hooked2'] = 'git_hooked2' |
803 self.assertTree(tree) | 899 self.assertTree(tree) |
804 | 900 |
805 # Manually remove git_hooked1 before synching to make sure it's not | 901 # Manually remove git_hooked1 before synching to make sure it's not |
806 # recreated. | 902 # recreated. |
807 os.remove(join(self.root_dir, 'src', 'git_hooked1')) | 903 os.remove(join(self.root_dir, 'src', 'git_hooked1')) |
808 | 904 |
809 # Test incremental versioned sync: sync backward. | 905 # Test incremental versioned sync: sync backward. |
810 self.parseGclient( | 906 self.parseGclient( |
811 ['sync', '--revision', 'src@' + self.githash('repo_1', 1), | 907 ['sync', '--revision', 'src@' + self.githash('repo_1', 1), |
812 '--deps', 'mac', '--delete_unversioned_trees', '--jobs', '8'], | 908 '--deps', 'mac', '--delete_unversioned_trees', '--jobs', '8'], |
813 ['running', 'running', 'deleting'], | 909 ['running', 'running', 'deleting'], |
814 untangle=True) | 910 untangle=True) |
815 tree = self.mangle_git_tree(('repo_1@1', 'src'), | 911 tree = self.mangle_git_tree(('repo_1@1', 'src'), |
816 ('repo_2@2', 'src/repo2'), | 912 ('repo_2@2', 'src/repo2'), |
817 ('repo_3@1', 'src/repo2/repo3'), | 913 ('repo_3@1', 'src/repo2/repo3'), |
818 ('repo_4@2', 'src/repo4')) | 914 ('repo_4@2', 'src/repo4')) |
819 tree['src/git_hooked2'] = 'git_hooked2' | 915 tree['src/git_hooked2'] = 'git_hooked2' |
820 self.assertTree(tree) | 916 self.assertTree(tree) |
821 # Test incremental sync: delete-unversioned_trees isn't there. | 917 # Test incremental sync: delete-unversioned_trees isn't there. |
822 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '8'], | 918 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '8'], |
823 ['running', 'running', 'running'], untangle=True) | 919 ['running', 'running', 'running'], untangle=True) |
824 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 920 tree = self.mangle_git_tree(('repo_1@3', 'src'), |
825 ('repo_2@1', 'src/repo2'), | 921 ('repo_2@1', 'src/repo2'), |
826 ('repo_3@1', 'src/repo2/repo3'), | 922 ('repo_3@1', 'src/repo2/repo3'), |
827 ('repo_3@2', 'src/repo2/repo_renamed'), | 923 ('repo_3@2', 'src/repo2/repo_renamed'), |
828 ('repo_4@2', 'src/repo4')) | 924 ('repo_4@2', 'src/repo4')) |
829 tree['src/git_hooked1'] = 'git_hooked1' | 925 tree['src/git_hooked1'] = 'git_hooked1' |
830 tree['src/git_hooked2'] = 'git_hooked2' | 926 tree['src/git_hooked2'] = 'git_hooked2' |
831 self.assertTree(tree) | 927 self.assertTree(tree) |
832 | 928 |
833 def testRevertAndStatus(self): | 929 def testRevertAndStatus(self): |
834 """TODO(maruel): Remove this line once this test is fixed.""" | 930 """TODO(maruel): Remove this line once this test is fixed.""" |
(...skipping 10 matching lines...) Expand all Loading... | |
845 self.assertEquals(0, len(out)) | 941 self.assertEquals(0, len(out)) |
846 | 942 |
847 # Revert implies --force implies running hooks without looking at pattern | 943 # Revert implies --force implies running hooks without looking at pattern |
848 # matching. | 944 # matching. |
849 results = self.gclient(['revert', '--deps', 'mac']) | 945 results = self.gclient(['revert', '--deps', 'mac']) |
850 out = results[0].splitlines(False) | 946 out = results[0].splitlines(False) |
851 # TODO(maruel): http://crosbug.com/3583 It just runs the hooks right now. | 947 # TODO(maruel): http://crosbug.com/3583 It just runs the hooks right now. |
852 self.assertEquals(13, len(out)) | 948 self.assertEquals(13, len(out)) |
853 self.checkString('', results[1]) | 949 self.checkString('', results[1]) |
854 self.assertEquals(0, results[2]) | 950 self.assertEquals(0, results[2]) |
855 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 951 tree = self.mangle_git_tree(('repo_1@3', 'src'), |
856 ('repo_2@1', 'src/repo2'), | 952 ('repo_2@1', 'src/repo2'), |
857 ('repo_3@2', 'src/repo2/repo_renamed')) | 953 ('repo_3@2', 'src/repo2/repo_renamed')) |
858 # TODO(maruel): http://crosbug.com/3583 This file should have been removed. | 954 # TODO(maruel): http://crosbug.com/3583 This file should have been removed. |
859 tree[join('src', 'repo2', 'hi')] = 'Hey!' | 955 tree[join('src', 'repo2', 'hi')] = 'Hey!' |
860 tree['src/git_hooked1'] = 'git_hooked1' | 956 tree['src/git_hooked1'] = 'git_hooked1' |
861 tree['src/git_hooked2'] = 'git_hooked2' | 957 tree['src/git_hooked2'] = 'git_hooked2' |
862 self.assertTree(tree) | 958 self.assertTree(tree) |
863 | 959 |
864 results = self.gclient(['status', '--deps', 'mac']) | 960 results = self.gclient(['status', '--deps', 'mac']) |
865 out = results[0].splitlines(False) | 961 out = results[0].splitlines(False) |
866 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned | 962 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned |
867 # files. | 963 # files. |
868 self.assertEquals(0, len(out)) | 964 self.assertEquals(0, len(out)) |
869 | 965 |
870 def testRunHooks(self): | 966 def testRunHooks(self): |
871 if not self.enabled: | 967 if not self.enabled: |
872 return | 968 return |
873 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 969 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
874 self.gclient(['sync', '--deps', 'mac']) | 970 self.gclient(['sync', '--deps', 'mac']) |
875 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 971 tree = self.mangle_git_tree(('repo_1@3', 'src'), |
876 ('repo_2@1', 'src/repo2'), | 972 ('repo_2@1', 'src/repo2'), |
877 ('repo_3@2', 'src/repo2/repo_renamed')) | 973 ('repo_3@2', 'src/repo2/repo_renamed')) |
878 tree['src/git_hooked1'] = 'git_hooked1' | 974 tree['src/git_hooked1'] = 'git_hooked1' |
879 tree['src/git_hooked2'] = 'git_hooked2' | 975 tree['src/git_hooked2'] = 'git_hooked2' |
880 self.assertTree(tree) | 976 self.assertTree(tree) |
881 | 977 |
882 os.remove(join(self.root_dir, 'src', 'git_hooked1')) | 978 os.remove(join(self.root_dir, 'src', 'git_hooked1')) |
883 os.remove(join(self.root_dir, 'src', 'git_hooked2')) | 979 os.remove(join(self.root_dir, 'src', 'git_hooked2')) |
884 # runhooks runs all hooks even if not matching by design. | 980 # runhooks runs all hooks even if not matching by design. |
885 out = self.parseGclient(['runhooks', '--deps', 'mac'], | 981 out = self.parseGclient(['runhooks', '--deps', 'mac'], |
886 ['running', 'running']) | 982 ['running', 'running']) |
887 self.assertEquals(1, len(out[0])) | 983 self.assertEquals(1, len(out[0])) |
888 self.assertEquals(1, len(out[1])) | 984 self.assertEquals(1, len(out[1])) |
889 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 985 tree = self.mangle_git_tree(('repo_1@3', 'src'), |
890 ('repo_2@1', 'src/repo2'), | 986 ('repo_2@1', 'src/repo2'), |
891 ('repo_3@2', 'src/repo2/repo_renamed')) | 987 ('repo_3@2', 'src/repo2/repo_renamed')) |
892 tree['src/git_hooked1'] = 'git_hooked1' | 988 tree['src/git_hooked1'] = 'git_hooked1' |
893 tree['src/git_hooked2'] = 'git_hooked2' | 989 tree['src/git_hooked2'] = 'git_hooked2' |
894 self.assertTree(tree) | 990 self.assertTree(tree) |
895 | 991 |
896 def testRevInfo(self): | 992 def testRevInfo(self): |
897 if not self.enabled: | 993 if not self.enabled: |
898 return | 994 return |
899 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 995 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
900 self.gclient(['sync', '--deps', 'mac']) | 996 self.gclient(['sync', '--deps', 'mac']) |
901 results = self.gclient(['revinfo', '--deps', 'mac']) | 997 results = self.gclient(['revinfo', '--deps', 'mac']) |
902 out = ('src: %(base)srepo_1\n' | 998 out = ('src: %(base)srepo_1\n' |
903 'src/repo2: %(base)srepo_2@%(hash2)s\n' | 999 'src/repo2: %(base)srepo_2@%(hash2)s\n' |
904 'src/repo2/repo_renamed: %(base)srepo_3\n' % | 1000 'src/repo2/repo_renamed: %(base)srepo_3\n' % |
905 { | 1001 { |
906 'base': self.git_base, | 1002 'base': self.git_base, |
907 'hash2': self.githash('repo_2', 1)[:7], | 1003 'hash2': self.githash('repo_2', 1)[:7], |
908 }) | 1004 }) |
909 self.check((out, '', 0), results) | 1005 self.check((out, '', 0), results) |
910 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) | 1006 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) |
911 out = ('src: %(base)srepo_1@%(hash1)s\n' | 1007 out = ('src: %(base)srepo_1@%(hash1)s\n' |
912 'src/repo2: %(base)srepo_2@%(hash2)s\n' | 1008 'src/repo2: %(base)srepo_2@%(hash2)s\n' |
913 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % | 1009 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % |
914 { | 1010 { |
915 'base': self.git_base, | 1011 'base': self.git_base, |
916 'hash1': self.githash('repo_1', 2), | 1012 'hash1': self.githash('repo_1', 3), |
917 'hash2': self.githash('repo_2', 1), | 1013 'hash2': self.githash('repo_2', 1), |
918 'hash3': self.githash('repo_3', 2), | 1014 'hash3': self.githash('repo_3', 2), |
919 }) | 1015 }) |
920 self.check((out, '', 0), results) | 1016 self.check((out, '', 0), results) |
921 | 1017 |
922 | 1018 |
923 class GClientSmokeBoth(GClientSmokeBase): | 1019 class GClientSmokeBoth(GClientSmokeBase): |
924 def setUp(self): | 1020 def setUp(self): |
925 super(GClientSmokeBoth, self).setUp() | 1021 super(GClientSmokeBoth, self).setUp() |
926 self.enabled = self.FAKE_REPOS.set_up_svn() and self.FAKE_REPOS.set_up_git() | 1022 self.enabled = self.FAKE_REPOS.set_up_svn() and self.FAKE_REPOS.set_up_git() |
927 | 1023 |
928 def testMultiSolutions(self): | 1024 def testMultiSolutions(self): |
929 if not self.enabled: | 1025 if not self.enabled: |
930 return | 1026 return |
931 self.gclient(['config', '--spec', | 1027 self.gclient(['config', '--spec', |
932 'solutions=[' | 1028 'solutions=[' |
933 '{"name": "src",' | 1029 '{"name": "src",' |
934 ' "url": "' + self.svn_base + 'trunk/src/"},' | 1030 ' "url": "' + self.svn_base + 'trunk/src/"},' |
935 '{"name": "src-git",' | 1031 '{"name": "src-git",' |
936 '"url": "' + self.git_base + 'repo_1"}]']) | 1032 '"url": "' + self.git_base + 'repo_1"}]']) |
937 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | 1033 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], |
938 ['running', 'running', 'running', | 1034 ['running', 'running', 'running', |
939 # This is due to the way svn update is called for a single | 1035 # This is due to the way svn update is called for a single |
940 # file when File() is used in a DEPS file. | 1036 # file when File() is used in a DEPS file. |
941 ('running', self.root_dir + '/src/file/other'), | 1037 ('running', self.root_dir + '/src/file/other'), |
942 'running', 'running', 'running', 'running', 'running', 'running', | 1038 'running', 'running', 'running', 'running', 'running', 'running', |
943 'running', 'running']) | 1039 'running', 'running']) |
944 tree = self.mangle_git_tree(('repo_1@2', 'src-git'), | 1040 tree = self.mangle_git_tree(('repo_1@3', 'src-git'), |
945 ('repo_2@1', 'src/repo2'), | 1041 ('repo_2@1', 'src/repo2'), |
946 ('repo_3@2', 'src/repo2/repo_renamed')) | 1042 ('repo_3@2', 'src/repo2/repo_renamed')) |
947 tree.update(self.mangle_svn_tree( | 1043 tree.update(self.mangle_svn_tree( |
948 ('trunk/src@2', 'src'), | 1044 ('trunk/src@2', 'src'), |
949 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 1045 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
950 ('trunk/other@2', 'src/other'))) | 1046 ('trunk/other@2', 'src/other'))) |
951 tree['src/file/other/DEPS'] = ( | 1047 tree['src/file/other/DEPS'] = ( |
952 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | 1048 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) |
953 tree['src/git_hooked1'] = 'git_hooked1' | 1049 tree['src/git_hooked1'] = 'git_hooked1' |
954 tree['src/git_hooked2'] = 'git_hooked2' | 1050 tree['src/git_hooked2'] = 'git_hooked2' |
955 tree['src/svn_hooked1'] = 'svn_hooked1' | 1051 tree['src/svn_hooked1'] = 'svn_hooked1' |
956 self.assertTree(tree) | 1052 self.assertTree(tree) |
957 | 1053 |
958 def testMultiSolutionsJobs(self): | 1054 def testMultiSolutionsJobs(self): |
959 if not self.enabled: | 1055 if not self.enabled: |
960 return | 1056 return |
961 self.gclient(['config', '--spec', | 1057 self.gclient(['config', '--spec', |
962 'solutions=[' | 1058 'solutions=[' |
963 '{"name": "src",' | 1059 '{"name": "src",' |
964 ' "url": "' + self.svn_base + 'trunk/src/"},' | 1060 ' "url": "' + self.svn_base + 'trunk/src/"},' |
965 '{"name": "src-git",' | 1061 '{"name": "src-git",' |
966 '"url": "' + self.git_base + 'repo_1"}]']) | 1062 '"url": "' + self.git_base + 'repo_1"}]']) |
967 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '8'], | 1063 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '8'], |
968 ['running', 'running', 'running', | 1064 ['running', 'running', 'running', 'running', 'running', |
969 # This is due to the way svn update is called for a single | 1065 # This is due to the way svn update is called for a single |
970 # file when File() is used in a DEPS file. | 1066 # file when File() is used in a DEPS file. |
971 ('running', self.root_dir + '/src/file/other'), | 1067 ('running', self.root_dir + '/src/file/other'), |
972 'running', 'running', 'running', 'running', 'running', 'running', | 1068 'running', 'running', 'running', 'running', |
973 'running', 'running'], | 1069 'running', 'running'], |
974 untangle=True) | 1070 untangle=True) |
975 tree = self.mangle_git_tree(('repo_1@2', 'src-git'), | 1071 tree = self.mangle_git_tree(('repo_1@3', 'src-git'), |
976 ('repo_2@1', 'src/repo2'), | 1072 ('repo_2@1', 'src/repo2'), |
977 ('repo_3@2', 'src/repo2/repo_renamed')) | 1073 ('repo_3@2', 'src/repo2/repo_renamed')) |
978 tree.update(self.mangle_svn_tree( | 1074 tree.update(self.mangle_svn_tree( |
979 ('trunk/src@2', 'src'), | 1075 ('trunk/src@2', 'src'), |
980 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 1076 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
981 ('trunk/other@2', 'src/other'))) | 1077 ('trunk/other@2', 'src/other'))) |
982 tree['src/file/other/DEPS'] = ( | 1078 tree['src/file/other/DEPS'] = ( |
983 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | 1079 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) |
984 tree['src/git_hooked1'] = 'git_hooked1' | 1080 tree['src/git_hooked1'] = 'git_hooked1' |
985 tree['src/git_hooked2'] = 'git_hooked2' | 1081 tree['src/git_hooked2'] = 'git_hooked2' |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1037 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) | 1133 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) |
1038 out = ('src: %(svn_base)s/src/@2\n' | 1134 out = ('src: %(svn_base)s/src/@2\n' |
1039 'src-git: %(git_base)srepo_1@%(hash1)s\n' | 1135 'src-git: %(git_base)srepo_1@%(hash1)s\n' |
1040 'src/file/other: %(svn_base)s/other/DEPS@2\n' | 1136 'src/file/other: %(svn_base)s/other/DEPS@2\n' |
1041 'src/other: %(svn_base)s/other@2\n' | 1137 'src/other: %(svn_base)s/other@2\n' |
1042 'src/repo2: %(git_base)srepo_2@%(hash2)s\n' | 1138 'src/repo2: %(git_base)srepo_2@%(hash2)s\n' |
1043 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s\n' | 1139 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s\n' |
1044 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { | 1140 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { |
1045 'svn_base': self.svn_base + 'trunk', | 1141 'svn_base': self.svn_base + 'trunk', |
1046 'git_base': self.git_base, | 1142 'git_base': self.git_base, |
1047 'hash1': self.githash('repo_1', 2), | 1143 'hash1': self.githash('repo_1', 3), |
1048 'hash2': self.githash('repo_2', 1), | 1144 'hash2': self.githash('repo_2', 1), |
1049 'hash3': self.githash('repo_3', 2), | 1145 'hash3': self.githash('repo_3', 2), |
1050 } | 1146 } |
1051 self.check((out, '', 0), results) | 1147 self.check((out, '', 0), results) |
1052 | 1148 |
1053 def testRecurse(self): | 1149 def testRecurse(self): |
1054 if not self.enabled: | 1150 if not self.enabled: |
1055 return | 1151 return |
1056 self.gclient(['config', '--spec', | 1152 self.gclient(['config', '--spec', |
1057 'solutions=[' | 1153 'solutions=[' |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1182 | 1278 |
1183 if '-c' in sys.argv: | 1279 if '-c' in sys.argv: |
1184 COVERAGE = True | 1280 COVERAGE = True |
1185 sys.argv.remove('-c') | 1281 sys.argv.remove('-c') |
1186 if os.path.exists('.coverage'): | 1282 if os.path.exists('.coverage'): |
1187 os.remove('.coverage') | 1283 os.remove('.coverage') |
1188 os.environ['COVERAGE_FILE'] = os.path.join( | 1284 os.environ['COVERAGE_FILE'] = os.path.join( |
1189 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1285 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
1190 '.coverage') | 1286 '.coverage') |
1191 unittest.main() | 1287 unittest.main() |
OLD | NEW |