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

Side by Side Diff: tests/gclient_smoketest.py

Issue 18328003: Add a git cache for gclient sync operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Make cache_dir .gclient only, and move it to GitWrapper Created 7 years, 5 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/gclient_scm_test.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/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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return 'svn://random.server/svn/' 163 return 'svn://random.server/svn/'
164 164
165 @property 165 @property
166 def git_base(self): 166 def git_base(self):
167 return 'git://random.server/git/' 167 return 'git://random.server/git/'
168 168
169 def testHelp(self): 169 def testHelp(self):
170 """testHelp: make sure no new command was added.""" 170 """testHelp: make sure no new command was added."""
171 result = self.gclient(['help']) 171 result = self.gclient(['help'])
172 # Roughly, not too short, not too long. 172 # Roughly, not too short, not too long.
173 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2100, 173 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2300,
174 'Too much written to stdout: %d bytes' % len(result[0])) 174 'Too much written to stdout: %d bytes' % len(result[0]))
175 self.assertEquals(0, len(result[1])) 175 self.assertEquals(0, len(result[1]))
176 self.assertEquals(0, result[2]) 176 self.assertEquals(0, result[2])
177 177
178 def testUnknown(self): 178 def testUnknown(self):
179 result = self.gclient(['foo']) 179 result = self.gclient(['foo'])
180 # Roughly, not too short, not too long. 180 # Roughly, not too short, not too long.
181 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2100, 181 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2300,
182 'Too much written to stdout: %d bytes' % len(result[0])) 182 'Too much written to stdout: %d bytes' % len(result[0]))
183 self.assertEquals(0, len(result[1])) 183 self.assertEquals(0, len(result[1]))
184 self.assertEquals(0, result[2]) 184 self.assertEquals(0, result[2])
185 185
186 def testNotConfigured(self): 186 def testNotConfigured(self):
187 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1) 187 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1)
188 self.check(res, self.gclient(['cleanup'])) 188 self.check(res, self.gclient(['cleanup']))
189 self.check(res, self.gclient(['diff'])) 189 self.check(res, self.gclient(['diff']))
190 self.check(res, self.gclient(['pack'])) 190 self.check(res, self.gclient(['pack']))
191 self.check(res, self.gclient(['revert'])) 191 self.check(res, self.gclient(['revert']))
(...skipping 15 matching lines...) Expand all
207 test(['config', self.svn_base + 'trunk/src/'], 207 test(['config', self.svn_base + 'trunk/src/'],
208 ('solutions = [\n' 208 ('solutions = [\n'
209 ' { "name" : "src",\n' 209 ' { "name" : "src",\n'
210 ' "url" : "%strunk/src",\n' 210 ' "url" : "%strunk/src",\n'
211 ' "deps_file" : "DEPS",\n' 211 ' "deps_file" : "DEPS",\n'
212 ' "managed" : True,\n' 212 ' "managed" : True,\n'
213 ' "custom_deps" : {\n' 213 ' "custom_deps" : {\n'
214 ' },\n' 214 ' },\n'
215 ' "safesync_url": "",\n' 215 ' "safesync_url": "",\n'
216 ' },\n' 216 ' },\n'
217 ']\n') % self.svn_base) 217 ']\n'
218 'cache_dir = None\n') % self.svn_base)
218 219
219 test(['config', self.git_base + 'repo_1', '--name', 'src'], 220 test(['config', self.git_base + 'repo_1', '--name', 'src'],
220 ('solutions = [\n' 221 ('solutions = [\n'
221 ' { "name" : "src",\n' 222 ' { "name" : "src",\n'
222 ' "url" : "%srepo_1",\n' 223 ' "url" : "%srepo_1",\n'
223 ' "deps_file" : "DEPS",\n' 224 ' "deps_file" : "DEPS",\n'
224 ' "managed" : True,\n' 225 ' "managed" : True,\n'
225 ' "custom_deps" : {\n' 226 ' "custom_deps" : {\n'
226 ' },\n' 227 ' },\n'
227 ' "safesync_url": "",\n' 228 ' "safesync_url": "",\n'
228 ' },\n' 229 ' },\n'
229 ']\n') % self.git_base) 230 ']\n'
231 'cache_dir = None\n') % self.git_base)
230 232
231 test(['config', 'foo', 'faa'], 233 test(['config', 'foo', 'faa'],
232 'solutions = [\n' 234 'solutions = [\n'
233 ' { "name" : "foo",\n' 235 ' { "name" : "foo",\n'
234 ' "url" : "foo",\n' 236 ' "url" : "foo",\n'
235 ' "deps_file" : "DEPS",\n' 237 ' "deps_file" : "DEPS",\n'
236 ' "managed" : True,\n' 238 ' "managed" : True,\n'
237 ' "custom_deps" : {\n' 239 ' "custom_deps" : {\n'
238 ' },\n' 240 ' },\n'
239 ' "safesync_url": "faa",\n' 241 ' "safesync_url": "faa",\n'
240 ' },\n' 242 ' },\n'
241 ']\n') 243 ']\n'
244 'cache_dir = None\n')
242 245
243 test(['config', 'foo', '--deps', 'blah'], 246 test(['config', 'foo', '--deps', 'blah'],
244 'solutions = [\n' 247 'solutions = [\n'
245 ' { "name" : "foo",\n' 248 ' { "name" : "foo",\n'
246 ' "url" : "foo",\n' 249 ' "url" : "foo",\n'
247 ' "deps_file" : "blah",\n' 250 ' "deps_file" : "blah",\n'
248 ' "managed" : True,\n' 251 ' "managed" : True,\n'
249 ' "custom_deps" : {\n' 252 ' "custom_deps" : {\n'
250 ' },\n' 253 ' },\n'
251 ' "safesync_url": "",\n' 254 ' "safesync_url": "",\n'
252 ' },\n' 255 ' },\n'
253 ']\n') 256 ']\n'
257 'cache_dir = None\n')
254 258
255 test(['config', '--spec', '["blah blah"]'], '["blah blah"]') 259 test(['config', '--spec', '["blah blah"]'], '["blah blah"]')
256 260
257 os.remove(p) 261 os.remove(p)
258 results = self.gclient(['config', 'foo', 'faa', 'fuu']) 262 results = self.gclient(['config', 'foo', 'faa', 'fuu'])
259 err = ('Usage: gclient.py config [options] [url] [safesync url]\n\n' 263 err = ('Usage: gclient.py config [options] [url] [safesync url]\n\n'
260 'gclient.py: error: Inconsistent arguments. Use either --spec or one' 264 'gclient.py: error: Inconsistent arguments. Use either --spec or one'
261 ' or 2 args\n') 265 ' or 2 args\n')
262 self.check(('', err, 2), results) 266 self.check(('', err, 2), results)
263 self.assertFalse(os.path.exists(join(self.root_dir, '.gclient'))) 267 self.assertFalse(os.path.exists(join(self.root_dir, '.gclient')))
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 1325
1322 if '-c' in sys.argv: 1326 if '-c' in sys.argv:
1323 COVERAGE = True 1327 COVERAGE = True
1324 sys.argv.remove('-c') 1328 sys.argv.remove('-c')
1325 if os.path.exists('.coverage'): 1329 if os.path.exists('.coverage'):
1326 os.remove('.coverage') 1330 os.remove('.coverage')
1327 os.environ['COVERAGE_FILE'] = os.path.join( 1331 os.environ['COVERAGE_FILE'] = os.path.join(
1328 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 1332 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
1329 '.coverage') 1333 '.coverage')
1330 unittest.main() 1334 unittest.main()
OLDNEW
« no previous file with comments | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698