Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: tests/gclient_smoketest.py

Issue 6725042: Forcibly uses a non-standard port for local svn and git servers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix presubmit checks Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/gcl_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 """Work around svn status difference between svn 1.5 and svn 1.6 135 """Work around svn status difference between svn 1.5 and svn 1.6
136 I don't know why but on Windows they are reversed. So sorts the items.""" 136 I don't know why but on Windows they are reversed. So sorts the items."""
137 for i in xrange(len(out)): 137 for i in xrange(len(out)):
138 if len(out[i]) < 2: 138 if len(out[i]) < 2:
139 continue 139 continue
140 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]]) 140 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]])
141 return out 141 return out
142 142
143 143
144 class GClientSmoke(GClientSmokeBase): 144 class GClientSmoke(GClientSmokeBase):
145 """Doesn't require neither svnserve nor git-daemon.""" 145 """Doesn't require either svnserve nor git-daemon."""
146 @property
147 def svn_base(self):
148 return 'svn://random.server/svn/'
149
150 @property
151 def git_base(self):
152 return 'git://random.server/git/'
153
146 def testHelp(self): 154 def testHelp(self):
147 """testHelp: make sure no new command was added.""" 155 """testHelp: make sure no new command was added."""
148 result = self.gclient(['help']) 156 result = self.gclient(['help'])
149 # Roughly, not too short, not too long. 157 # Roughly, not too short, not too long.
150 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2000) 158 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2000)
151 self.assertEquals(0, len(result[1])) 159 self.assertEquals(0, len(result[1]))
152 self.assertEquals(0, result[2]) 160 self.assertEquals(0, result[2])
153 161
154 def testUnknown(self): 162 def testUnknown(self):
155 result = self.gclient(['foo']) 163 result = self.gclient(['foo'])
(...skipping 18 matching lines...) Expand all
174 def testConfig(self): 182 def testConfig(self):
175 p = join(self.root_dir, '.gclient') 183 p = join(self.root_dir, '.gclient')
176 def test(cmd, expected): 184 def test(cmd, expected):
177 if os.path.exists(p): 185 if os.path.exists(p):
178 os.remove(p) 186 os.remove(p)
179 results = self.gclient(cmd) 187 results = self.gclient(cmd)
180 self.check(('', '', 0), results) 188 self.check(('', '', 0), results)
181 self.checkString(expected, open(p, 'rU').read()) 189 self.checkString(expected, open(p, 'rU').read())
182 190
183 test(['config', self.svn_base + 'trunk/src/'], 191 test(['config', self.svn_base + 'trunk/src/'],
184 'solutions = [\n' 192 ('solutions = [\n'
185 ' { "name" : "src",\n' 193 ' { "name" : "src",\n'
186 ' "url" : "svn://127.0.0.1/svn/trunk/src",\n' 194 ' "url" : "%strunk/src",\n'
187 ' "custom_deps" : {\n' 195 ' "custom_deps" : {\n'
188 ' },\n' 196 ' },\n'
189 ' "safesync_url": "",\n' 197 ' "safesync_url": "",\n'
190 ' },\n' 198 ' },\n'
191 ']\n') 199 ']\n') % self.svn_base)
192 200
193 test(['config', self.git_base + 'repo_1', '--name', 'src'], 201 test(['config', self.git_base + 'repo_1', '--name', 'src'],
194 'solutions = [\n' 202 ('solutions = [\n'
195 ' { "name" : "src",\n' 203 ' { "name" : "src",\n'
196 ' "url" : "git://127.0.0.1/git/repo_1",\n' 204 ' "url" : "%srepo_1",\n'
197 ' "custom_deps" : {\n' 205 ' "custom_deps" : {\n'
198 ' },\n' 206 ' },\n'
199 ' "safesync_url": "",\n' 207 ' "safesync_url": "",\n'
200 ' },\n' 208 ' },\n'
201 ']\n') 209 ']\n') % self.git_base)
202 210
203 test(['config', 'foo', 'faa'], 211 test(['config', 'foo', 'faa'],
204 'solutions = [\n' 212 'solutions = [\n'
205 ' { "name" : "foo",\n' 213 ' { "name" : "foo",\n'
206 ' "url" : "foo",\n' 214 ' "url" : "foo",\n'
207 ' "custom_deps" : {\n' 215 ' "custom_deps" : {\n'
208 ' },\n' 216 ' },\n'
209 ' "safesync_url": "faa",\n' 217 ' "safesync_url": "faa",\n'
210 ' },\n' 218 ' },\n'
211 ']\n') 219 ']\n')
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 1076
1069 class GClientSmokeFromCheckout(GClientSmokeBase): 1077 class GClientSmokeFromCheckout(GClientSmokeBase):
1070 # WebKit abuses this. It has a .gclient and a DEPS from a checkout. 1078 # WebKit abuses this. It has a .gclient and a DEPS from a checkout.
1071 def setUp(self): 1079 def setUp(self):
1072 super(GClientSmokeFromCheckout, self).setUp() 1080 super(GClientSmokeFromCheckout, self).setUp()
1073 self.enabled = self.FAKE_REPOS.set_up_svn() 1081 self.enabled = self.FAKE_REPOS.set_up_svn()
1074 os.rmdir(self.root_dir) 1082 os.rmdir(self.root_dir)
1075 if self.enabled: 1083 if self.enabled:
1076 usr, pwd = self.FAKE_REPOS.USERS[0] 1084 usr, pwd = self.FAKE_REPOS.USERS[0]
1077 check_call( 1085 check_call(
1078 ['svn', 'checkout', 'svn://127.0.0.1/svn/trunk/webkit', 1086 ['svn', 'checkout', self.svn_base + '/trunk/webkit',
1079 self.root_dir, '-q', 1087 self.root_dir, '-q',
1080 '--non-interactive', '--no-auth-cache', 1088 '--non-interactive', '--no-auth-cache',
1081 '--username', usr, '--password', pwd]) 1089 '--username', usr, '--password', pwd])
1082 1090
1083 def testSync(self): 1091 def testSync(self):
1084 if not self.enabled: 1092 if not self.enabled:
1085 return 1093 return
1086 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], 1094 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'],
1087 ['running', 'running']) 1095 ['running', 'running'])
1088 tree = self.mangle_svn_tree( 1096 tree = self.mangle_svn_tree(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 ('trunk/webkit@2', ''), 1138 ('trunk/webkit@2', ''),
1131 ('trunk/third_party/foo@1', 'foo/bar')) 1139 ('trunk/third_party/foo@1', 'foo/bar'))
1132 self.assertTree(tree) 1140 self.assertTree(tree)
1133 1141
1134 def testRevInfo(self): 1142 def testRevInfo(self):
1135 if not self.enabled: 1143 if not self.enabled:
1136 return 1144 return
1137 self.gclient(['sync', '--deps', 'mac']) 1145 self.gclient(['sync', '--deps', 'mac'])
1138 results = self.gclient(['revinfo', '--deps', 'mac']) 1146 results = self.gclient(['revinfo', '--deps', 'mac'])
1139 expected = ( 1147 expected = (
1140 './: None\nfoo/bar: svn://127.0.0.1/svn/trunk/third_party/foo@1\n', 1148 './: None\nfoo/bar: %strunk/third_party/foo@1\n' % self.svn_base,
1141 '', 0) 1149 '', 0)
1142 self.check(expected, results) 1150 self.check(expected, results)
1143 # TODO(maruel): To be added after the refactor. 1151 # TODO(maruel): To be added after the refactor.
1144 #results = self.gclient(['revinfo', '--snapshot']) 1152 #results = self.gclient(['revinfo', '--snapshot'])
1145 #expected = ( 1153 #expected = (
1146 # './: None\nfoo/bar: svn://127.0.0.1/svn/trunk/third_party/foo@1\n', 1154 # './: None\nfoo/bar: %strunk/third_party/foo@1\n' % self.svn_base,
1147 # '', 0) 1155 # '', 0)
1148 #self.check(expected, results) 1156 #self.check(expected, results)
1149 1157
1150 def testRest(self): 1158 def testRest(self):
1151 if not self.enabled: 1159 if not self.enabled:
1152 return 1160 return
1153 self.gclient(['sync']) 1161 self.gclient(['sync'])
1154 # TODO(maruel): This is incorrect, it should run on ./ too. 1162 # TODO(maruel): This is incorrect, it should run on ./ too.
1155 self.parseGclient( 1163 self.parseGclient(
1156 ['cleanup', '--deps', 'mac', '--verbose', '--jobs', '1'], 1164 ['cleanup', '--deps', 'mac', '--verbose', '--jobs', '1'],
1157 [('running', join(self.root_dir, 'foo', 'bar'))]) 1165 [('running', join(self.root_dir, 'foo', 'bar'))])
1158 self.parseGclient( 1166 self.parseGclient(
1159 ['diff', '--deps', 'mac', '--verbose', '--jobs', '1'], 1167 ['diff', '--deps', 'mac', '--verbose', '--jobs', '1'],
1160 [('running', join(self.root_dir, 'foo', 'bar'))]) 1168 [('running', join(self.root_dir, 'foo', 'bar'))])
1161 1169
1162 1170
1163 if __name__ == '__main__': 1171 if __name__ == '__main__':
1164 if '-v' in sys.argv: 1172 if '-v' in sys.argv:
1165 logging.basicConfig(level=logging.DEBUG) 1173 logging.basicConfig(level=logging.DEBUG)
1166 1174
1167 if '-c' in sys.argv: 1175 if '-c' in sys.argv:
1168 COVERAGE = True 1176 COVERAGE = True
1169 sys.argv.remove('-c') 1177 sys.argv.remove('-c')
1170 if os.path.exists('.coverage'): 1178 if os.path.exists('.coverage'):
1171 os.remove('.coverage') 1179 os.remove('.coverage')
1172 os.environ['COVERAGE_FILE'] = os.path.join( 1180 os.environ['COVERAGE_FILE'] = os.path.join(
1173 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 1181 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
1174 '.coverage') 1182 '.coverage')
1175 unittest.main() 1183 unittest.main()
OLDNEW
« no previous file with comments | « tests/gcl_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698