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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 915 tree = self.mangle_git_tree(('repo_1@2', 'src'), |
916 ('repo_2@1', 'src/repo2'), | 916 ('repo_2@1', 'src/repo2'), |
917 ('repo_3@1', 'src/repo2/repo3'), | 917 ('repo_3@1', 'src/repo2/repo3'), |
918 ('repo_3@2', 'src/repo2/repo_renamed'), | 918 ('repo_3@2', 'src/repo2/repo_renamed'), |
919 ('repo_4@2', 'src/repo4')) | 919 ('repo_4@2', 'src/repo4')) |
920 tree['src/git_hooked1'] = 'git_hooked1' | 920 tree['src/git_hooked1'] = 'git_hooked1' |
921 tree['src/git_hooked2'] = 'git_hooked2' | 921 tree['src/git_hooked2'] = 'git_hooked2' |
922 self.assertTree(tree) | 922 self.assertTree(tree) |
923 | 923 |
924 def testRevertAndStatus(self): | 924 def testRevertAndStatus(self): |
925 """TODO(maruel): Remove this line once this test is fixed.""" | |
926 if not self.enabled: | 925 if not self.enabled: |
927 return | 926 return |
928 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 927 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
929 # Tested in testSync. | 928 # Tested in testSync. |
930 self.gclient(['sync', '--deps', 'mac']) | 929 self.gclient(['sync', '--deps', 'mac']) |
931 write(join(self.root_dir, 'src', 'repo2', 'hi'), 'Hey!') | 930 write(join(self.root_dir, 'src', 'repo2', 'hi'), 'Hey!') |
932 | 931 |
933 expected1 = ('running', os.path.join(self.root_dir, 'src')) | 932 expected1 = ('running', os.path.join(self.root_dir, 'src')) |
934 expected2 = ('running', os.path.join(expected1[1], 'repo2')) | 933 expected2 = ('running', os.path.join(expected1[1], 'repo2')) |
935 expected3 = ('running', os.path.join(expected2[1], 'repo_renamed')) | 934 expected3 = ('running', os.path.join(expected2[1], 'repo_renamed')) |
936 out = self.parseGclient(['status', '--deps', 'mac'], | 935 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], |
937 [expected1, expected2, expected3]) | 936 [expected1, expected2, expected3]) |
938 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned | 937 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned |
939 # files. | 938 # files. |
940 self.assertEquals(3, len(out)) | 939 self.assertEquals(3, len(out)) |
941 | 940 |
942 # Revert implies --force implies running hooks without looking at pattern | 941 # Revert implies --force implies running hooks without looking at pattern |
943 # matching. | 942 # matching. |
944 results = self.gclient(['revert', '--deps', 'mac']) | 943 results = self.gclient(['revert', '--deps', 'mac']) |
945 out = results[0].splitlines(False) | 944 out = results[0].splitlines(False) |
946 # TODO(maruel): http://crosbug.com/3583 It just runs the hooks right now. | 945 # TODO(maruel): http://crosbug.com/3583 It just runs the hooks right now. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 | 1276 |
1278 if '-c' in sys.argv: | 1277 if '-c' in sys.argv: |
1279 COVERAGE = True | 1278 COVERAGE = True |
1280 sys.argv.remove('-c') | 1279 sys.argv.remove('-c') |
1281 if os.path.exists('.coverage'): | 1280 if os.path.exists('.coverage'): |
1282 os.remove('.coverage') | 1281 os.remove('.coverage') |
1283 os.environ['COVERAGE_FILE'] = os.path.join( | 1282 os.environ['COVERAGE_FILE'] = os.path.join( |
1284 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1283 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
1285 '.coverage') | 1284 '.coverage') |
1286 unittest.main() | 1285 unittest.main() |
OLD | NEW |