| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 expected1 = ('running', os.path.join(self.root_dir, 'src')) | 933 expected1 = ('running', os.path.join(self.root_dir, 'src')) |
| 934 expected2 = ('running', os.path.join(expected1[1], 'repo2')) | 934 expected2 = ('running', os.path.join(expected1[1], 'repo2')) |
| 935 expected3 = ('running', os.path.join(expected2[1], 'repo_renamed')) | 935 expected3 = ('running', os.path.join(expected2[1], 'repo_renamed')) |
| 936 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], | 936 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], |
| 937 [expected1, expected2, expected3]) | 937 [expected1, expected2, expected3]) |
| 938 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned | 938 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned |
| 939 # files. | 939 # files. |
| 940 self.assertEquals(3, len(out)) | 940 self.assertEquals(3, len(out)) |
| 941 | 941 |
| 942 # Revert implies --force implies running hooks without looking at pattern | 942 # Revert implies --force implies running hooks without looking at pattern |
| 943 # matching. | 943 # matching. For each expected path, 'git reset' and 'git clean' are run, so |
| 944 results = self.gclient(['revert', '--deps', 'mac', '--jobs', '1']) | 944 # there should be two results for each. The last two results should reflect |
| 945 out = results[0].splitlines(False) | 945 # writing git_hooked1 and git_hooked2. |
| 946 # TODO(maruel): http://crosbug.com/3583 It just runs the hooks right now. | 946 expected4 = ('running', self.root_dir) |
| 947 self.assertEquals(13, len(out)) | 947 out = self.parseGclient(['revert', '--deps', 'mac', '--jobs', '1'], |
| 948 self.checkString('', results[1]) | 948 [expected1, expected1, |
| 949 self.assertEquals(0, results[2]) | 949 expected2, expected2, |
| 950 expected3, expected3, |
| 951 expected4, expected4]) |
| 952 self.assertEquals(8, len(out)) |
| 950 tree = self.mangle_git_tree(('repo_1@2', 'src'), | 953 tree = self.mangle_git_tree(('repo_1@2', 'src'), |
| 951 ('repo_2@1', 'src/repo2'), | 954 ('repo_2@1', 'src/repo2'), |
| 952 ('repo_3@2', 'src/repo2/repo_renamed')) | 955 ('repo_3@2', 'src/repo2/repo_renamed')) |
| 953 # TODO(maruel): http://crosbug.com/3583 This file should have been removed. | |
| 954 tree[join('src', 'repo2', 'hi')] = 'Hey!' | |
| 955 tree['src/git_hooked1'] = 'git_hooked1' | 956 tree['src/git_hooked1'] = 'git_hooked1' |
| 956 tree['src/git_hooked2'] = 'git_hooked2' | 957 tree['src/git_hooked2'] = 'git_hooked2' |
| 957 self.assertTree(tree) | 958 self.assertTree(tree) |
| 958 | 959 |
| 959 results = self.gclient(['status', '--deps', 'mac', '--jobs', '1']) | 960 results = self.gclient(['status', '--deps', 'mac', '--jobs', '1']) |
| 960 out = results[0].splitlines(False) | 961 out = results[0].splitlines(False) |
| 961 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned | 962 # TODO(maruel): http://crosbug.com/3584 It should output the unversioned |
| 962 # files. | 963 # files. |
| 963 self.assertEquals(6, len(out)) | 964 self.assertEquals(6, len(out)) |
| 964 | 965 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 | 1282 |
| 1282 if '-c' in sys.argv: | 1283 if '-c' in sys.argv: |
| 1283 COVERAGE = True | 1284 COVERAGE = True |
| 1284 sys.argv.remove('-c') | 1285 sys.argv.remove('-c') |
| 1285 if os.path.exists('.coverage'): | 1286 if os.path.exists('.coverage'): |
| 1286 os.remove('.coverage') | 1287 os.remove('.coverage') |
| 1287 os.environ['COVERAGE_FILE'] = os.path.join( | 1288 os.environ['COVERAGE_FILE'] = os.path.join( |
| 1288 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1289 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 1289 '.coverage') | 1290 '.coverage') |
| 1290 unittest.main() | 1291 unittest.main() |
| OLD | NEW |