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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 expected2 = ('running', os.path.join(expected1[1], 'repo2')) | 933 expected2 = ('running', os.path.join(expected1[1], 'repo2')) |
934 expected3 = ('running', os.path.join(expected2[1], 'repo_renamed')) | 934 expected3 = ('running', os.path.join(expected2[1], 'repo_renamed')) |
935 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], | 935 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], |
936 [expected1, expected2, expected3]) | 936 [expected1, expected2, expected3]) |
937 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned | 937 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned |
938 # files. | 938 # files. |
939 self.assertEquals(3, len(out)) | 939 self.assertEquals(3, len(out)) |
940 | 940 |
941 # Revert implies --force implies running hooks without looking at pattern | 941 # Revert implies --force implies running hooks without looking at pattern |
942 # matching. | 942 # matching. |
943 results = self.gclient(['revert', '--deps', 'mac']) | 943 results = self.gclient(['revert', '--deps', 'mac', '--jobs', '1']) |
944 out = results[0].splitlines(False) | 944 out = results[0].splitlines(False) |
945 # 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. |
946 self.assertEquals(13, len(out)) | 946 self.assertEquals(13, len(out)) |
947 self.checkString('', results[1]) | 947 self.checkString('', results[1]) |
948 self.assertEquals(0, results[2]) | 948 self.assertEquals(0, results[2]) |
949 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 949 tree = self.mangle_git_tree(('repo_1@2', 'src'), |
950 ('repo_2@1', 'src/repo2'), | 950 ('repo_2@1', 'src/repo2'), |
951 ('repo_3@2', 'src/repo2/repo_renamed')) | 951 ('repo_3@2', 'src/repo2/repo_renamed')) |
952 # TODO(maruel): http://crosbug.com/3583 This file should have been removed. | 952 # TODO(maruel): http://crosbug.com/3583 This file should have been removed. |
953 tree[join('src', 'repo2', 'hi')] = 'Hey!' | 953 tree[join('src', 'repo2', 'hi')] = 'Hey!' |
954 tree['src/git_hooked1'] = 'git_hooked1' | 954 tree['src/git_hooked1'] = 'git_hooked1' |
955 tree['src/git_hooked2'] = 'git_hooked2' | 955 tree['src/git_hooked2'] = 'git_hooked2' |
956 self.assertTree(tree) | 956 self.assertTree(tree) |
957 | 957 |
958 results = self.gclient(['status', '--deps', 'mac']) | 958 results = self.gclient(['status', '--deps', 'mac', '--jobs', '1']) |
959 out = results[0].splitlines(False) | 959 out = results[0].splitlines(False) |
960 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned | 960 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned |
961 # files. | 961 # files. |
962 self.assertEquals(6, len(out)) | 962 self.assertEquals(6, len(out)) |
963 | 963 |
964 def testRunHooks(self): | 964 def testRunHooks(self): |
965 if not self.enabled: | 965 if not self.enabled: |
966 return | 966 return |
967 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 967 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
968 self.gclient(['sync', '--deps', 'mac']) | 968 self.gclient(['sync', '--deps', 'mac']) |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 | 1276 |
1277 if '-c' in sys.argv: | 1277 if '-c' in sys.argv: |
1278 COVERAGE = True | 1278 COVERAGE = True |
1279 sys.argv.remove('-c') | 1279 sys.argv.remove('-c') |
1280 if os.path.exists('.coverage'): | 1280 if os.path.exists('.coverage'): |
1281 os.remove('.coverage') | 1281 os.remove('.coverage') |
1282 os.environ['COVERAGE_FILE'] = os.path.join( | 1282 os.environ['COVERAGE_FILE'] = os.path.join( |
1283 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1283 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
1284 '.coverage') | 1284 '.coverage') |
1285 unittest.main() | 1285 unittest.main() |
OLD | NEW |