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

Side by Side Diff: tests/gclient_smoketest.py

Issue 3333028: Improve the testing situation on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 10 years, 3 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/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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 """Work around svn status difference between svn 1.5 and svn 1.6 131 """Work around svn status difference between svn 1.5 and svn 1.6
132 I don't know why but on Windows they are reversed. So sorts the items.""" 132 I don't know why but on Windows they are reversed. So sorts the items."""
133 for i in xrange(len(out)): 133 for i in xrange(len(out)):
134 if len(out[i]) < 2: 134 if len(out[i]) < 2:
135 continue 135 continue
136 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]]) 136 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]])
137 return out 137 return out
138 138
139 139
140 class GClientSmoke(GClientSmokeBase): 140 class GClientSmoke(GClientSmokeBase):
141 """Doesn't require neither svnserve nor git-daemon."""
141 def testHelp(self): 142 def testHelp(self):
142 """testHelp: make sure no new command was added.""" 143 """testHelp: make sure no new command was added."""
143 result = self.gclient(['help']) 144 result = self.gclient(['help'])
144 # Roughly, not too short, not too long. 145 # Roughly, not too short, not too long.
145 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2000) 146 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2000)
146 self.assertEquals(0, len(result[1])) 147 self.assertEquals(0, len(result[1]))
147 self.assertEquals(0, result[2]) 148 self.assertEquals(0, result[2])
148 149
149 def testUnknown(self): 150 def testUnknown(self):
150 result = self.gclient(['foo']) 151 result = self.gclient(['foo'])
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 'deps = { "src": "%strunk/src" }' % (self.svn_base)) 246 'deps = { "src": "%strunk/src" }' % (self.svn_base))
246 src = join(self.root_dir, 'src') 247 src = join(self.root_dir, 'src')
247 os.mkdir(src) 248 os.mkdir(src)
248 res = self.gclient(['status', '--jobs', '1'], src) 249 res = self.gclient(['status', '--jobs', '1'], src)
249 self.checkBlock(res[0], [('running', deps), ('running', src)]) 250 self.checkBlock(res[0], [('running', deps), ('running', src)])
250 251
251 252
252 class GClientSmokeSVN(GClientSmokeBase): 253 class GClientSmokeSVN(GClientSmokeBase):
253 def setUp(self): 254 def setUp(self):
254 GClientSmokeBase.setUp(self) 255 GClientSmokeBase.setUp(self)
255 self.FAKE_REPOS.setUpSVN() 256 self.enabled = self.FAKE_REPOS.setUpSVN()
256 257
257 def testSync(self): 258 def testSync(self):
258 # TODO(maruel): safesync. 259 # TODO(maruel): safesync.
260 if not self.enabled:
261 return
259 self.gclient(['config', self.svn_base + 'trunk/src/']) 262 self.gclient(['config', self.svn_base + 'trunk/src/'])
260 # Test unversioned checkout. 263 # Test unversioned checkout.
261 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], 264 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'],
262 ['running', 'running', 265 ['running', 'running',
263 # This is due to the way svn update is called for a 266 # This is due to the way svn update is called for a
264 # single file when File() is used in a DEPS file. 267 # single file when File() is used in a DEPS file.
265 ('running', self.root_dir + '/src/file/other'), 268 ('running', self.root_dir + '/src/file/other'),
266 'running', 'running', 'running', 'running']) 269 'running', 'running', 'running', 'running'])
267 tree = self.mangle_svn_tree( 270 tree = self.mangle_svn_tree(
268 ('trunk/src@2', 'src'), 271 ('trunk/src@2', 'src'),
(...skipping 30 matching lines...) Expand all
299 ('trunk/third_party/foo@1', 'src/third_party/foo'), 302 ('trunk/third_party/foo@1', 'src/third_party/foo'),
300 ('trunk/other@2', 'src/other'), 303 ('trunk/other@2', 'src/other'),
301 ('trunk/third_party/foo@2', 'src/third_party/prout')) 304 ('trunk/third_party/foo@2', 'src/third_party/prout'))
302 tree['src/file/other/DEPS'] = ( 305 tree['src/file/other/DEPS'] = (
303 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) 306 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS'])
304 tree['src/svn_hooked1'] = 'svn_hooked1' 307 tree['src/svn_hooked1'] = 'svn_hooked1'
305 self.assertTree(tree) 308 self.assertTree(tree)
306 309
307 def testSyncIgnoredSolutionName(self): 310 def testSyncIgnoredSolutionName(self):
308 """TODO(maruel): This will become an error soon.""" 311 """TODO(maruel): This will become an error soon."""
312 if not self.enabled:
313 return
309 self.gclient(['config', self.svn_base + 'trunk/src/']) 314 self.gclient(['config', self.svn_base + 'trunk/src/'])
310 results = self.gclient( 315 results = self.gclient(
311 ['sync', '--deps', 'mac', '-r', 'invalid@1', '--jobs', '1']) 316 ['sync', '--deps', 'mac', '-r', 'invalid@1', '--jobs', '1'])
312 self.checkBlock(results[0], [ 317 self.checkBlock(results[0], [
313 'running', 'running', 318 'running', 'running',
314 # This is due to the way svn update is called for a single file when 319 # This is due to the way svn update is called for a single file when
315 # File() is used in a DEPS file. 320 # File() is used in a DEPS file.
316 ('running', self.root_dir + '/src/file/other'), 321 ('running', self.root_dir + '/src/file/other'),
317 'running', 'running', 'running', 'running']) 322 'running', 'running', 'running', 'running'])
318 self.checkString('Please fix your script, having invalid --revision flags ' 323 self.checkString('Please fix your script, having invalid --revision flags '
319 'will soon considered an error.\n', results[1]) 324 'will soon considered an error.\n', results[1])
320 self.assertEquals(0, results[2]) 325 self.assertEquals(0, results[2])
321 tree = self.mangle_svn_tree( 326 tree = self.mangle_svn_tree(
322 ('trunk/src@2', 'src'), 327 ('trunk/src@2', 'src'),
323 ('trunk/third_party/foo@1', 'src/third_party/foo'), 328 ('trunk/third_party/foo@1', 'src/third_party/foo'),
324 ('trunk/other@2', 'src/other')) 329 ('trunk/other@2', 'src/other'))
325 tree['src/file/other/DEPS'] = ( 330 tree['src/file/other/DEPS'] = (
326 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) 331 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS'])
327 tree['src/svn_hooked1'] = 'svn_hooked1' 332 tree['src/svn_hooked1'] = 'svn_hooked1'
328 self.assertTree(tree) 333 self.assertTree(tree)
329 334
330 def testSyncNoSolutionName(self): 335 def testSyncNoSolutionName(self):
331 # When no solution name is provided, gclient uses the first solution listed. 336 # When no solution name is provided, gclient uses the first solution listed.
337 if not self.enabled:
338 return
332 self.gclient(['config', self.svn_base + 'trunk/src/']) 339 self.gclient(['config', self.svn_base + 'trunk/src/'])
333 self.parseGclient(['sync', '--deps', 'mac', '-r', '1', '--jobs', '1'], 340 self.parseGclient(['sync', '--deps', 'mac', '-r', '1', '--jobs', '1'],
334 ['running', 'running', 'running', 'running']) 341 ['running', 'running', 'running', 'running'])
335 tree = self.mangle_svn_tree( 342 tree = self.mangle_svn_tree(
336 ('trunk/src@1', 'src'), 343 ('trunk/src@1', 'src'),
337 ('trunk/third_party/foo@2', 'src/third_party/fpp'), 344 ('trunk/third_party/foo@2', 'src/third_party/fpp'),
338 ('trunk/other@1', 'src/other'), 345 ('trunk/other@1', 'src/other'),
339 ('trunk/third_party/foo@2', 'src/third_party/prout')) 346 ('trunk/third_party/foo@2', 'src/third_party/prout'))
340 self.assertTree(tree) 347 self.assertTree(tree)
341 348
342 def testSyncJobs(self): 349 def testSyncJobs(self):
350 if not self.enabled:
351 return
343 # TODO(maruel): safesync. 352 # TODO(maruel): safesync.
344 self.gclient(['config', self.svn_base + 'trunk/src/']) 353 self.gclient(['config', self.svn_base + 'trunk/src/'])
345 # Test unversioned checkout. 354 # Test unversioned checkout.
346 self.parseGclient( 355 self.parseGclient(
347 ['sync', '--deps', 'mac', '--jobs', '8'], 356 ['sync', '--deps', 'mac', '--jobs', '8'],
348 ['running', 'running', 357 ['running', 'running',
349 # This is due to the way svn update is called for a 358 # This is due to the way svn update is called for a
350 # single file when File() is used in a DEPS file. 359 # single file when File() is used in a DEPS file.
351 ('running', self.root_dir + '/src/file/other'), 360 ('running', self.root_dir + '/src/file/other'),
352 'running', 'running', 'running', 'running'], 361 'running', 'running', 'running', 'running'],
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 ('trunk/third_party/foo@2', 'src/third_party/fpp'), 396 ('trunk/third_party/foo@2', 'src/third_party/fpp'),
388 ('trunk/third_party/foo@1', 'src/third_party/foo'), 397 ('trunk/third_party/foo@1', 'src/third_party/foo'),
389 ('trunk/other@2', 'src/other'), 398 ('trunk/other@2', 'src/other'),
390 ('trunk/third_party/foo@2', 'src/third_party/prout')) 399 ('trunk/third_party/foo@2', 'src/third_party/prout'))
391 tree['src/file/other/DEPS'] = ( 400 tree['src/file/other/DEPS'] = (
392 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) 401 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS'])
393 tree['src/svn_hooked1'] = 'svn_hooked1' 402 tree['src/svn_hooked1'] = 'svn_hooked1'
394 self.assertTree(tree) 403 self.assertTree(tree)
395 404
396 def testRevertAndStatus(self): 405 def testRevertAndStatus(self):
406 if not self.enabled:
407 return
397 self.gclient(['config', self.svn_base + 'trunk/src/']) 408 self.gclient(['config', self.svn_base + 'trunk/src/'])
398 # Tested in testSync. 409 # Tested in testSync.
399 self.gclient(['sync', '--deps', 'mac']) 410 self.gclient(['sync', '--deps', 'mac'])
400 write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!') 411 write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!')
401 412
402 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], 413 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'],
403 [['running', join(self.root_dir, 'src')], 414 [['running', join(self.root_dir, 'src')],
404 ['running', join(self.root_dir, 'src', 'other')]]) 415 ['running', join(self.root_dir, 'src', 'other')]])
405 out = self.svnBlockCleanup(out) 416 out = self.svnBlockCleanup(out)
406 self.checkString('file', out[0][1]) 417 self.checkString('file', out[0][1])
(...skipping 28 matching lines...) Expand all
435 out = self.svnBlockCleanup(out) 446 out = self.svnBlockCleanup(out)
436 self.checkString('file', out[0][1]) 447 self.checkString('file', out[0][1])
437 self.checkString('other', out[0][2]) 448 self.checkString('other', out[0][2])
438 self.checkString('svn_hooked1', out[0][3]) 449 self.checkString('svn_hooked1', out[0][3])
439 self.checkString('svn_hooked2', out[0][4]) 450 self.checkString('svn_hooked2', out[0][4])
440 self.checkString(join('third_party', 'foo'), out[0][5]) 451 self.checkString(join('third_party', 'foo'), out[0][5])
441 self.assertEquals(6, len(out[0])) 452 self.assertEquals(6, len(out[0]))
442 self.assertEquals(1, len(out)) 453 self.assertEquals(1, len(out))
443 454
444 def testRevertAndStatusDepsOs(self): 455 def testRevertAndStatusDepsOs(self):
456 if not self.enabled:
457 return
445 self.gclient(['config', self.svn_base + 'trunk/src/']) 458 self.gclient(['config', self.svn_base + 'trunk/src/'])
446 # Tested in testSync. 459 # Tested in testSync.
447 self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1']) 460 self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1'])
448 write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!') 461 write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!')
449 462
450 # Without --verbose, gclient won't output the directories without 463 # Without --verbose, gclient won't output the directories without
451 # modification. 464 # modification.
452 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], 465 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'],
453 [['running', join(self.root_dir, 'src')], 466 [['running', join(self.root_dir, 'src')],
454 ['running', join(self.root_dir, 'src', 'other')]]) 467 ['running', join(self.root_dir, 'src', 'other')]])
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 509
497 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], 510 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'],
498 [['running', join(self.root_dir, 'src')]]) 511 [['running', join(self.root_dir, 'src')]])
499 out = self.svnBlockCleanup(out) 512 out = self.svnBlockCleanup(out)
500 self.checkString('other', out[0][1]) 513 self.checkString('other', out[0][1])
501 self.checkString(join('third_party', 'fpp'), out[0][2]) 514 self.checkString(join('third_party', 'fpp'), out[0][2])
502 self.checkString(join('third_party', 'prout'), out[0][3]) 515 self.checkString(join('third_party', 'prout'), out[0][3])
503 self.assertEquals(4, len(out[0])) 516 self.assertEquals(4, len(out[0]))
504 517
505 def testRunHooks(self): 518 def testRunHooks(self):
519 if not self.enabled:
520 return
506 self.gclient(['config', self.svn_base + 'trunk/src/']) 521 self.gclient(['config', self.svn_base + 'trunk/src/'])
507 self.gclient(['sync', '--deps', 'mac']) 522 self.gclient(['sync', '--deps', 'mac'])
508 out = self.parseGclient(['runhooks', '--deps', 'mac'], 523 out = self.parseGclient(['runhooks', '--deps', 'mac'],
509 ['running', 'running']) 524 ['running', 'running'])
510 self.checkString(1, len(out[0])) 525 self.checkString(1, len(out[0]))
511 self.checkString(1, len(out[1])) 526 self.checkString(1, len(out[1]))
512 527
513 def testRunHooksDepsOs(self): 528 def testRunHooksDepsOs(self):
529 if not self.enabled:
530 return
514 self.gclient(['config', self.svn_base + 'trunk/src/']) 531 self.gclient(['config', self.svn_base + 'trunk/src/'])
515 self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1']) 532 self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1'])
516 out = self.parseGclient(['runhooks', '--deps', 'mac'], []) 533 out = self.parseGclient(['runhooks', '--deps', 'mac'], [])
517 self.assertEquals([], out) 534 self.assertEquals([], out)
518 535
519 def testRevInfo(self): 536 def testRevInfo(self):
537 if not self.enabled:
538 return
520 self.gclient(['config', self.svn_base + 'trunk/src/']) 539 self.gclient(['config', self.svn_base + 'trunk/src/'])
521 self.gclient(['sync', '--deps', 'mac']) 540 self.gclient(['sync', '--deps', 'mac'])
522 results = self.gclient(['revinfo', '--deps', 'mac']) 541 results = self.gclient(['revinfo', '--deps', 'mac'])
523 out = ('src: %(base)s/src\n' 542 out = ('src: %(base)s/src\n'
524 'src/file/other: File("%(base)s/other/DEPS")\n' 543 'src/file/other: File("%(base)s/other/DEPS")\n'
525 'src/other: %(base)s/other\n' 544 'src/other: %(base)s/other\n'
526 'src/third_party/foo: %(base)s/third_party/foo@1\n' % 545 'src/third_party/foo: %(base)s/third_party/foo@1\n' %
527 { 'base': self.svn_base + 'trunk' }) 546 { 'base': self.svn_base + 'trunk' })
528 self.check((out, '', 0), results) 547 self.check((out, '', 0), results)
529 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) 548 results = self.gclient(['revinfo', '--deps', 'mac', '--actual'])
(...skipping 18 matching lines...) Expand all
548 ' },\n' 567 ' },\n'
549 ' "safesync_url": "",\n' 568 ' "safesync_url": "",\n'
550 ' },\n' 569 ' },\n'
551 ']\n\n' % 570 ']\n\n' %
552 { 'base': self.svn_base + 'trunk' }) 571 { 'base': self.svn_base + 'trunk' })
553 self.check((out, '', 0), results) 572 self.check((out, '', 0), results)
554 573
555 def testWrongDirectory(self): 574 def testWrongDirectory(self):
556 # Check that we're not using a .gclient configuration which only talks 575 # Check that we're not using a .gclient configuration which only talks
557 # about a subdirectory src when we're in a different subdirectory src-other. 576 # about a subdirectory src when we're in a different subdirectory src-other.
577 if not self.enabled:
578 return
558 self.gclient(['config', self.svn_base + 'trunk/src/']) 579 self.gclient(['config', self.svn_base + 'trunk/src/'])
559 self.gclient(['sync']) 580 self.gclient(['sync'])
560 other_src = join(self.root_dir, 'src-other') 581 other_src = join(self.root_dir, 'src-other')
561 os.mkdir(other_src) 582 os.mkdir(other_src)
562 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1) 583 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1)
563 self.check(res, self.gclient(['status'], other_src)) 584 self.check(res, self.gclient(['status'], other_src))
564 585
565 def testCorrectDirectory(self): 586 def testCorrectDirectory(self):
566 # Check that when we're in the subdirectory src, the .gclient configuration 587 # Check that when we're in the subdirectory src, the .gclient configuration
567 # is used. 588 # is used.
589 if not self.enabled:
590 return
568 self.gclient(['config', self.svn_base + 'trunk/src/']) 591 self.gclient(['config', self.svn_base + 'trunk/src/'])
569 self.gclient(['sync']) 592 self.gclient(['sync'])
570 src = join(self.root_dir, 'src') 593 src = join(self.root_dir, 'src')
571 res = self.gclient(['status', '--jobs', '1'], src) 594 res = self.gclient(['status', '--jobs', '1'], src)
572 self.checkBlock(res[0], [('running', src)]) 595 self.checkBlock(res[0], [('running', src)])
573 596
574 def testInitialCheckoutNotYetDone(self): 597 def testInitialCheckoutNotYetDone(self):
575 # Check that gclient can be executed when the initial checkout hasn't been 598 # Check that gclient can be executed when the initial checkout hasn't been
576 # done yet. 599 # done yet.
600 if not self.enabled:
601 return
577 self.gclient(['config', self.svn_base + 'trunk/src/']) 602 self.gclient(['config', self.svn_base + 'trunk/src/'])
578 self.parseGclient(['sync', '--jobs', '1'], 603 self.parseGclient(['sync', '--jobs', '1'],
579 ['running', 'running', 604 ['running', 'running',
580 # This is due to the way svn update is called for a 605 # This is due to the way svn update is called for a
581 # single file when File() is used in a DEPS file. 606 # single file when File() is used in a DEPS file.
582 ('running', self.root_dir + '/src/file/other'), 607 ('running', self.root_dir + '/src/file/other'),
583 'running', 'running', 'running', 'running']) 608 'running', 'running', 'running', 'running'])
584 609
585 def testInitialCheckoutFailed(self): 610 def testInitialCheckoutFailed(self):
586 # Check that gclient can be executed from an arbitrary sub directory if the 611 # Check that gclient can be executed from an arbitrary sub directory if the
587 # initial checkout has failed. 612 # initial checkout has failed.
613 if not self.enabled:
614 return
588 self.gclient(['config', self.svn_base + 'trunk/src/']) 615 self.gclient(['config', self.svn_base + 'trunk/src/'])
589 self.gclient(['sync']) 616 self.gclient(['sync'])
590 # Cripple the checkout. 617 # Cripple the checkout.
591 os.remove(join(self.root_dir, '.gclient_entries')) 618 os.remove(join(self.root_dir, '.gclient_entries'))
592 src = join(self.root_dir, 'src') 619 src = join(self.root_dir, 'src')
593 res = self.gclient(['sync', '--jobs', '1'], src) 620 res = self.gclient(['sync', '--jobs', '1'], src)
594 self.checkBlock(res[0], 621 self.checkBlock(res[0],
595 ['running', 'running', 'running']) 622 ['running', 'running', 'running'])
596 623
597 624
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 'hash1': self.githash('repo_1', 2), 837 'hash1': self.githash('repo_1', 2),
811 'hash2': self.githash('repo_2', 1), 838 'hash2': self.githash('repo_2', 1),
812 'hash3': self.githash('repo_3', 2), 839 'hash3': self.githash('repo_3', 2),
813 }) 840 })
814 self.check((out, '', 0), results) 841 self.check((out, '', 0), results)
815 842
816 843
817 class GClientSmokeBoth(GClientSmokeBase): 844 class GClientSmokeBoth(GClientSmokeBase):
818 def setUp(self): 845 def setUp(self):
819 GClientSmokeBase.setUp(self) 846 GClientSmokeBase.setUp(self)
820 self.FAKE_REPOS.setUpSVN() 847 self.enabled = self.FAKE_REPOS.setUpSVN() and self.FAKE_REPOS.setUpGIT()
821 self.enabled = self.FAKE_REPOS.setUpGIT()
822 848
823 def testMultiSolutions(self): 849 def testMultiSolutions(self):
824 if not self.enabled: 850 if not self.enabled:
825 return 851 return
826 self.gclient(['config', '--spec', 852 self.gclient(['config', '--spec',
827 'solutions=[' 853 'solutions=['
828 '{"name": "src",' 854 '{"name": "src",'
829 ' "url": "' + self.svn_base + 'trunk/src/"},' 855 ' "url": "' + self.svn_base + 'trunk/src/"},'
830 '{"name": "src-git",' 856 '{"name": "src-git",'
831 '"url": "' + self.git_base + 'repo_1"}]']) 857 '"url": "' + self.git_base + 'repo_1"}]'])
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path)) 1002 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path))
977 for (scm, url, path) in expected_source] 1003 for (scm, url, path) in expected_source]
978 1004
979 self.assertEquals(sorted(entries), sorted(expected)) 1005 self.assertEquals(sorted(entries), sorted(expected))
980 1006
981 1007
982 class GClientSmokeFromCheckout(GClientSmokeBase): 1008 class GClientSmokeFromCheckout(GClientSmokeBase):
983 # WebKit abuses this. It has a .gclient and a DEPS from a checkout. 1009 # WebKit abuses this. It has a .gclient and a DEPS from a checkout.
984 def setUp(self): 1010 def setUp(self):
985 GClientSmokeBase.setUp(self) 1011 GClientSmokeBase.setUp(self)
986 self.FAKE_REPOS.setUpSVN() 1012 self.enabled = self.FAKE_REPOS.setUpSVN()
987 os.rmdir(self.root_dir) 1013 os.rmdir(self.root_dir)
988 check_call(['svn', 'checkout', 'svn://127.0.0.1/svn/trunk/webkit', 1014 if self.enabled:
989 self.root_dir, '-q', 1015 check_call(['svn', 'checkout', 'svn://127.0.0.1/svn/trunk/webkit',
990 '--non-interactive', '--no-auth-cache', 1016 self.root_dir, '-q',
991 '--username', 'user1', '--password', 'foo']) 1017 '--non-interactive', '--no-auth-cache',
1018 '--username', 'user1', '--password', 'foo'])
992 1019
993 def testSync(self): 1020 def testSync(self):
1021 if not self.enabled:
1022 return
994 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], 1023 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'],
995 ['running', 'running']) 1024 ['running', 'running'])
996 tree = self.mangle_svn_tree( 1025 tree = self.mangle_svn_tree(
997 ('trunk/webkit@2', ''), 1026 ('trunk/webkit@2', ''),
998 ('trunk/third_party/foo@1', 'foo/bar')) 1027 ('trunk/third_party/foo@1', 'foo/bar'))
999 self.assertTree(tree) 1028 self.assertTree(tree)
1000 1029
1001 def testRevertAndStatus(self): 1030 def testRevertAndStatus(self):
1031 if not self.enabled:
1032 return
1002 self.gclient(['sync']) 1033 self.gclient(['sync'])
1003 1034
1004 # TODO(maruel): This is incorrect. 1035 # TODO(maruel): This is incorrect.
1005 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], []) 1036 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], [])
1006 1037
1007 # Revert implies --force implies running hooks without looking at pattern 1038 # Revert implies --force implies running hooks without looking at pattern
1008 # matching. 1039 # matching.
1009 results = self.gclient(['revert', '--deps', 'mac', '--jobs', '1']) 1040 results = self.gclient(['revert', '--deps', 'mac', '--jobs', '1'])
1010 out = self.splitBlock(results[0]) 1041 out = self.splitBlock(results[0])
1011 self.assertEquals(2, len(out)) 1042 self.assertEquals(2, len(out))
1012 self.checkString(2, len(out[0])) 1043 self.checkString(2, len(out[0]))
1013 self.checkString(2, len(out[1])) 1044 self.checkString(2, len(out[1]))
1014 self.checkString('foo', out[1][1]) 1045 self.checkString('foo', out[1][1])
1015 self.checkString('', results[1]) 1046 self.checkString('', results[1])
1016 self.assertEquals(0, results[2]) 1047 self.assertEquals(0, results[2])
1017 tree = self.mangle_svn_tree( 1048 tree = self.mangle_svn_tree(
1018 ('trunk/webkit@2', ''), 1049 ('trunk/webkit@2', ''),
1019 ('trunk/third_party/foo@1', 'foo/bar')) 1050 ('trunk/third_party/foo@1', 'foo/bar'))
1020 self.assertTree(tree) 1051 self.assertTree(tree)
1021 1052
1022 # TODO(maruel): This is incorrect. 1053 # TODO(maruel): This is incorrect.
1023 out = self.parseGclient(['status', '--deps', 'mac'], []) 1054 out = self.parseGclient(['status', '--deps', 'mac'], [])
1024 1055
1025 def testRunHooks(self): 1056 def testRunHooks(self):
1057 if not self.enabled:
1058 return
1026 # Hooks aren't really tested for now since there is no hook defined. 1059 # Hooks aren't really tested for now since there is no hook defined.
1027 self.gclient(['sync', '--deps', 'mac']) 1060 self.gclient(['sync', '--deps', 'mac'])
1028 out = self.parseGclient(['runhooks', '--deps', 'mac'], ['running']) 1061 out = self.parseGclient(['runhooks', '--deps', 'mac'], ['running'])
1029 self.assertEquals(1, len(out)) 1062 self.assertEquals(1, len(out))
1030 self.assertEquals(2, len(out[0])) 1063 self.assertEquals(2, len(out[0]))
1031 self.assertEquals(3, len(out[0][0])) 1064 self.assertEquals(3, len(out[0][0]))
1032 self.checkString('foo', out[0][1]) 1065 self.checkString('foo', out[0][1])
1033 tree = self.mangle_svn_tree( 1066 tree = self.mangle_svn_tree(
1034 ('trunk/webkit@2', ''), 1067 ('trunk/webkit@2', ''),
1035 ('trunk/third_party/foo@1', 'foo/bar')) 1068 ('trunk/third_party/foo@1', 'foo/bar'))
1036 self.assertTree(tree) 1069 self.assertTree(tree)
1037 1070
1038 def testRevInfo(self): 1071 def testRevInfo(self):
1072 if not self.enabled:
1073 return
1039 self.gclient(['sync', '--deps', 'mac']) 1074 self.gclient(['sync', '--deps', 'mac'])
1040 results = self.gclient(['revinfo', '--deps', 'mac']) 1075 results = self.gclient(['revinfo', '--deps', 'mac'])
1041 expected = ( 1076 expected = (
1042 './: None\nfoo/bar: svn://127.0.0.1/svn/trunk/third_party/foo@1\n', 1077 './: None\nfoo/bar: svn://127.0.0.1/svn/trunk/third_party/foo@1\n',
1043 '', 0) 1078 '', 0)
1044 self.check(expected, results) 1079 self.check(expected, results)
1045 # TODO(maruel): To be added after the refactor. 1080 # TODO(maruel): To be added after the refactor.
1046 #results = self.gclient(['revinfo', '--snapshot']) 1081 #results = self.gclient(['revinfo', '--snapshot'])
1047 #expected = ( 1082 #expected = (
1048 # './: None\nfoo/bar: svn://127.0.0.1/svn/trunk/third_party/foo@1\n', 1083 # './: None\nfoo/bar: svn://127.0.0.1/svn/trunk/third_party/foo@1\n',
1049 # '', 0) 1084 # '', 0)
1050 #self.check(expected, results) 1085 #self.check(expected, results)
1051 1086
1052 def testRest(self): 1087 def testRest(self):
1088 if not self.enabled:
1089 return
1053 self.gclient(['sync']) 1090 self.gclient(['sync'])
1054 # TODO(maruel): This is incorrect, it should run on ./ too. 1091 # TODO(maruel): This is incorrect, it should run on ./ too.
1055 out = self.parseGclient( 1092 out = self.parseGclient(
1056 ['cleanup', '--deps', 'mac', '--verbose', '--jobs', '1'], 1093 ['cleanup', '--deps', 'mac', '--verbose', '--jobs', '1'],
1057 [('running', join(self.root_dir, 'foo', 'bar'))]) 1094 [('running', join(self.root_dir, 'foo', 'bar'))])
1058 out = self.parseGclient( 1095 out = self.parseGclient(
1059 ['diff', '--deps', 'mac', '--verbose', '--jobs', '1'], 1096 ['diff', '--deps', 'mac', '--verbose', '--jobs', '1'],
1060 [('running', join(self.root_dir, 'foo', 'bar'))]) 1097 [('running', join(self.root_dir, 'foo', 'bar'))])
1061 1098
1062 1099
1063 if __name__ == '__main__': 1100 if __name__ == '__main__':
1064 if '-c' in sys.argv: 1101 if '-c' in sys.argv:
1065 COVERAGE = True 1102 COVERAGE = True
1066 sys.argv.remove('-c') 1103 sys.argv.remove('-c')
1067 if os.path.exists('.coverage'): 1104 if os.path.exists('.coverage'):
1068 os.remove('.coverage') 1105 os.remove('.coverage')
1069 os.environ['COVERAGE_FILE'] = os.path.join( 1106 os.environ['COVERAGE_FILE'] = os.path.join(
1070 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 1107 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
1071 '.coverage') 1108 '.coverage')
1072 unittest.main() 1109 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