| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 'deps = { "src": "%strunk/src" }' % (self.svn_base)) | 250 'deps = { "src": "%strunk/src" }' % (self.svn_base)) |
| 251 src = join(self.root_dir, 'src') | 251 src = join(self.root_dir, 'src') |
| 252 os.mkdir(src) | 252 os.mkdir(src) |
| 253 res = self.gclient(['status', '--jobs', '1'], src) | 253 res = self.gclient(['status', '--jobs', '1'], src) |
| 254 self.checkBlock(res[0], [('running', deps), ('running', src)]) | 254 self.checkBlock(res[0], [('running', deps), ('running', src)]) |
| 255 | 255 |
| 256 | 256 |
| 257 class GClientSmokeSVN(GClientSmokeBase): | 257 class GClientSmokeSVN(GClientSmokeBase): |
| 258 def setUp(self): | 258 def setUp(self): |
| 259 super(GClientSmokeSVN, self).setUp() | 259 super(GClientSmokeSVN, self).setUp() |
| 260 self.enabled = self.FAKE_REPOS.setUpSVN() | 260 self.enabled = self.FAKE_REPOS.set_up_svn() |
| 261 | 261 |
| 262 def testSync(self): | 262 def testSync(self): |
| 263 # TODO(maruel): safesync. | 263 # TODO(maruel): safesync. |
| 264 if not self.enabled: | 264 if not self.enabled: |
| 265 return | 265 return |
| 266 self.gclient(['config', self.svn_base + 'trunk/src/']) | 266 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 267 # Test unversioned checkout. | 267 # Test unversioned checkout. |
| 268 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | 268 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], |
| 269 ['running', 'running', | 269 ['running', 'running', |
| 270 # This is due to the way svn update is called for a | 270 # This is due to the way svn update is called for a |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 os.remove(join(self.root_dir, '.gclient_entries')) | 683 os.remove(join(self.root_dir, '.gclient_entries')) |
| 684 src = join(self.root_dir, 'src') | 684 src = join(self.root_dir, 'src') |
| 685 res = self.gclient(['sync', '--jobs', '1'], src) | 685 res = self.gclient(['sync', '--jobs', '1'], src) |
| 686 self.checkBlock(res[0], | 686 self.checkBlock(res[0], |
| 687 ['running', 'running', 'running']) | 687 ['running', 'running', 'running']) |
| 688 | 688 |
| 689 | 689 |
| 690 class GClientSmokeGIT(GClientSmokeBase): | 690 class GClientSmokeGIT(GClientSmokeBase): |
| 691 def setUp(self): | 691 def setUp(self): |
| 692 super(GClientSmokeGIT, self).setUp() | 692 super(GClientSmokeGIT, self).setUp() |
| 693 self.enabled = self.FAKE_REPOS.setUpGIT() | 693 self.enabled = self.FAKE_REPOS.set_up_git() |
| 694 | 694 |
| 695 def testSync(self): | 695 def testSync(self): |
| 696 if not self.enabled: | 696 if not self.enabled: |
| 697 return | 697 return |
| 698 # TODO(maruel): safesync. | 698 # TODO(maruel): safesync. |
| 699 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) | 699 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) |
| 700 # Test unversioned checkout. | 700 # Test unversioned checkout. |
| 701 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | 701 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], |
| 702 ['running', 'running', 'running', 'running', 'running']) | 702 ['running', 'running', 'running', 'running', 'running']) |
| 703 # TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must | 703 # TODO(maruel): http://crosbug.com/3582 hooks run even if not matching, must |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 'hash1': self.githash('repo_1', 2), | 900 'hash1': self.githash('repo_1', 2), |
| 901 'hash2': self.githash('repo_2', 1), | 901 'hash2': self.githash('repo_2', 1), |
| 902 'hash3': self.githash('repo_3', 2), | 902 'hash3': self.githash('repo_3', 2), |
| 903 }) | 903 }) |
| 904 self.check((out, '', 0), results) | 904 self.check((out, '', 0), results) |
| 905 | 905 |
| 906 | 906 |
| 907 class GClientSmokeBoth(GClientSmokeBase): | 907 class GClientSmokeBoth(GClientSmokeBase): |
| 908 def setUp(self): | 908 def setUp(self): |
| 909 super(GClientSmokeBoth, self).setUp() | 909 super(GClientSmokeBoth, self).setUp() |
| 910 self.enabled = self.FAKE_REPOS.setUpSVN() and self.FAKE_REPOS.setUpGIT() | 910 self.enabled = self.FAKE_REPOS.set_up_svn() and self.FAKE_REPOS.set_up_git() |
| 911 | 911 |
| 912 def testMultiSolutions(self): | 912 def testMultiSolutions(self): |
| 913 if not self.enabled: | 913 if not self.enabled: |
| 914 return | 914 return |
| 915 self.gclient(['config', '--spec', | 915 self.gclient(['config', '--spec', |
| 916 'solutions=[' | 916 'solutions=[' |
| 917 '{"name": "src",' | 917 '{"name": "src",' |
| 918 ' "url": "' + self.svn_base + 'trunk/src/"},' | 918 ' "url": "' + self.svn_base + 'trunk/src/"},' |
| 919 '{"name": "src-git",' | 919 '{"name": "src-git",' |
| 920 '"url": "' + self.git_base + 'repo_1"}]']) | 920 '"url": "' + self.git_base + 'repo_1"}]']) |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path)) | 1063 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path)) |
| 1064 for (scm, url, path) in expected_source] | 1064 for (scm, url, path) in expected_source] |
| 1065 | 1065 |
| 1066 self.assertEquals(sorted(entries), sorted(expected)) | 1066 self.assertEquals(sorted(entries), sorted(expected)) |
| 1067 | 1067 |
| 1068 | 1068 |
| 1069 class GClientSmokeFromCheckout(GClientSmokeBase): | 1069 class GClientSmokeFromCheckout(GClientSmokeBase): |
| 1070 # WebKit abuses this. It has a .gclient and a DEPS from a checkout. | 1070 # WebKit abuses this. It has a .gclient and a DEPS from a checkout. |
| 1071 def setUp(self): | 1071 def setUp(self): |
| 1072 super(GClientSmokeFromCheckout, self).setUp() | 1072 super(GClientSmokeFromCheckout, self).setUp() |
| 1073 self.enabled = self.FAKE_REPOS.setUpSVN() | 1073 self.enabled = self.FAKE_REPOS.set_up_svn() |
| 1074 os.rmdir(self.root_dir) | 1074 os.rmdir(self.root_dir) |
| 1075 if self.enabled: | 1075 if self.enabled: |
| 1076 usr, pwd = self.FAKE_REPOS.USERS[0] | 1076 usr, pwd = self.FAKE_REPOS.USERS[0] |
| 1077 check_call( | 1077 check_call( |
| 1078 ['svn', 'checkout', 'svn://127.0.0.1/svn/trunk/webkit', | 1078 ['svn', 'checkout', 'svn://127.0.0.1/svn/trunk/webkit', |
| 1079 self.root_dir, '-q', | 1079 self.root_dir, '-q', |
| 1080 '--non-interactive', '--no-auth-cache', | 1080 '--non-interactive', '--no-auth-cache', |
| 1081 '--username', usr, '--password', pwd]) | 1081 '--username', usr, '--password', pwd]) |
| 1082 | 1082 |
| 1083 def testSync(self): | 1083 def testSync(self): |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 | 1166 |
| 1167 if '-c' in sys.argv: | 1167 if '-c' in sys.argv: |
| 1168 COVERAGE = True | 1168 COVERAGE = True |
| 1169 sys.argv.remove('-c') | 1169 sys.argv.remove('-c') |
| 1170 if os.path.exists('.coverage'): | 1170 if os.path.exists('.coverage'): |
| 1171 os.remove('.coverage') | 1171 os.remove('.coverage') |
| 1172 os.environ['COVERAGE_FILE'] = os.path.join( | 1172 os.environ['COVERAGE_FILE'] = os.path.join( |
| 1173 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1173 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 1174 '.coverage') | 1174 '.coverage') |
| 1175 unittest.main() | 1175 unittest.main() |
| OLD | NEW |