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

Side by Side Diff: tests/gclient_smoketest.py

Issue 61623008: If the destination directory doesn't contain the desired repo, delete it (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Rebase Created 7 years, 1 month 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
« tests/gclient_scm_test.py ('K') | « 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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 ('svn', 'trunk/other', 'src/other'), 1336 ('svn', 'trunk/other', 'src/other'),
1337 ('git', 'repo_2@' + self.githash('repo_2', 1)[:7], 'src/repo2'), 1337 ('git', 'repo_2@' + self.githash('repo_2', 1)[:7], 'src/repo2'),
1338 ('git', 'repo_3', 'src/repo2/repo_renamed'), 1338 ('git', 'repo_3', 'src/repo2/repo_renamed'),
1339 ('svn', 'trunk/third_party/foo@1', 'src/third_party/foo'), 1339 ('svn', 'trunk/third_party/foo@1', 'src/third_party/foo'),
1340 ] 1340 ]
1341 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path)) 1341 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path))
1342 for (scm, url, path) in expected_source] 1342 for (scm, url, path) in expected_source]
1343 1343
1344 self.assertEquals(sorted(entries), sorted(expected)) 1344 self.assertEquals(sorted(entries), sorted(expected))
1345 1345
1346 def testDeleteConflictingCheckout(self):
1347 if not self.enabled:
1348 return
1349
1350 # Create an initial svn checkout.
1351 self.gclient(['config', '--spec',
1352 'solutions=['
1353 '{"name": "src",'
1354 ' "url": "' + self.svn_base + 'trunk/src"},'
1355 ']'
1356 ])
1357 results = self.gclient(['sync', '--deps', 'mac'])
1358 self.assertEqual(results[2], 0, 'Sync failed!')
1359
1360 # Verify that we have the expected svn checkout.
1361 results = self.gclient(['revinfo', '--deps', 'mac'])
1362 actual = sorted(results[0].splitlines())
1363 expected = sorted([
iannucci 2013/11/13 06:26:30 not sure the sorted is necessary, since the prefix
borenet 2013/11/13 19:12:24 Done.
1364 'src: %strunk/src' % self.svn_base,
1365 'src/other: %strunk/other' % self.svn_base,
1366 'src/file/other: File("%strunk/other/DEPS")' % self.svn_base,
1367 'src/third_party/foo: %strunk/third_party/foo@1' % self.svn_base,
1368 ])
1369 self.assertEquals(actual, expected)
1370
1371 # Change the desired checkout to git.
1372 self.gclient(['config', '--spec',
1373 'solutions=['
1374 '{"name": "src",'
1375 ' "url": "' + self.git_base + 'repo_1"},'
1376 ']'
1377 ])
1378
1379 # Verify that the sync succeeds.
1380 results = self.gclient(['sync', '--deps', 'mac'])
1381 self.assertEqual(results[2], 0, 'Sync failed!')
1382
1383 # Verify that we got the desired git checkout.
1384 results = self.gclient(['revinfo', '--deps', 'mac'])
1385 actual = sorted(results[0].splitlines())
1386 expected = sorted([
1387 'src: %srepo_1' % self.git_base,
1388 'src/repo2: %srepo_2@%s' % (self.git_base, self.githash('repo_2', 1)[:7]),
1389 'src/repo2/repo_renamed: %srepo_3' % self.git_base,
1390 ])
1391 self.assertEquals(actual, expected)
1392
1393 # Change the desired checkout back to svn.
1394 self.gclient(['config', '--spec',
1395 'solutions=['
1396 '{"name": "src",'
1397 ' "url": "' + self.svn_base + 'trunk/src"},'
1398 ']'
1399 ])
1400
1401 # Verify that the sync succeeds.
1402 results = self.gclient(['sync', '--deps', 'mac'])
1403 self.assertEqual(results[2], 0, 'Sync failed!')
1404
1405 # Verify that we have the expected svn checkout.
1406 results = self.gclient(['revinfo', '--deps', 'mac'])
1407 actual = sorted(results[0].splitlines())
1408 expected = sorted([
1409 'src: %strunk/src' % self.svn_base,
1410 'src/other: %strunk/other' % self.svn_base,
1411 'src/file/other: File("%strunk/other/DEPS")' % self.svn_base,
1412 'src/third_party/foo: %strunk/third_party/foo@1' % self.svn_base,
1413 ])
1414 self.assertEquals(actual, expected)
1415
1346 1416
1347 class GClientSmokeFromCheckout(GClientSmokeBase): 1417 class GClientSmokeFromCheckout(GClientSmokeBase):
1348 # WebKit abuses this. It has a .gclient and a DEPS from a checkout. 1418 # WebKit abuses this. It has a .gclient and a DEPS from a checkout.
1349 def setUp(self): 1419 def setUp(self):
1350 super(GClientSmokeFromCheckout, self).setUp() 1420 super(GClientSmokeFromCheckout, self).setUp()
1351 self.enabled = self.FAKE_REPOS.set_up_svn() 1421 self.enabled = self.FAKE_REPOS.set_up_svn()
1352 os.rmdir(self.root_dir) 1422 os.rmdir(self.root_dir)
1353 if self.enabled: 1423 if self.enabled:
1354 usr, pwd = self.FAKE_REPOS.USERS[0] 1424 usr, pwd = self.FAKE_REPOS.USERS[0]
1355 subprocess2.check_call( 1425 subprocess2.check_call(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 1514
1445 if '-c' in sys.argv: 1515 if '-c' in sys.argv:
1446 COVERAGE = True 1516 COVERAGE = True
1447 sys.argv.remove('-c') 1517 sys.argv.remove('-c')
1448 if os.path.exists('.coverage'): 1518 if os.path.exists('.coverage'):
1449 os.remove('.coverage') 1519 os.remove('.coverage')
1450 os.environ['COVERAGE_FILE'] = os.path.join( 1520 os.environ['COVERAGE_FILE'] = os.path.join(
1451 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 1521 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
1452 '.coverage') 1522 '.coverage')
1453 unittest.main() 1523 unittest.main()
OLDNEW
« tests/gclient_scm_test.py ('K') | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698