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

Side by Side Diff: tests/gclient_smoketest.py

Issue 189913020: gclient: print a warning if a dep would get deleted or moved in the future (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix warning Created 6 years, 8 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
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.
11 """ 11 """
12 12
13 import logging 13 import logging
14 import os 14 import os
15 import re 15 import re
16 import subprocess 16 import subprocess
17 import sys 17 import sys
18 import unittest 18 import unittest
19 19
20 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 20 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21 sys.path.insert(0, ROOT_DIR) 21 sys.path.insert(0, ROOT_DIR)
22 22
23 from testing_support.fake_repos import join, write 23 from testing_support.fake_repos import join, write
24 from testing_support.fake_repos import FakeReposTestBase, FakeRepoTransitive 24 from testing_support.fake_repos import FakeReposTestBase, FakeRepoTransitive
25 # TODO(borenet): Uncomment these includes once
26 # gclient_scm.SCMWrapper._DeleteOrMove is enabled.
27 #from testing_support.fake_repos import FakeReposTestBase, FakeRepoTransitive, \
28 # FakeRepoSkiaDEPS
25 29
26 import gclient_utils 30
31 #import gclient_utils
32 #import scm as gclient_scm
27 33
28 import subprocess2 34 import subprocess2
29 35
30 GCLIENT_PATH = os.path.join(ROOT_DIR, 'gclient') 36 GCLIENT_PATH = os.path.join(ROOT_DIR, 'gclient')
31 COVERAGE = False 37 COVERAGE = False
32 38
33 39
34 class GClientSmokeBase(FakeReposTestBase): 40 class GClientSmokeBase(FakeReposTestBase):
35 def setUp(self): 41 def setUp(self):
36 super(GClientSmokeBase, self).setUp() 42 super(GClientSmokeBase, self).setUp()
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 return 762 return
757 self.gclient(['config', self.svn_base + 'trunk/src/']) 763 self.gclient(['config', self.svn_base + 'trunk/src/'])
758 self.gclient(['sync']) 764 self.gclient(['sync'])
759 # Cripple the checkout. 765 # Cripple the checkout.
760 os.remove(join(self.root_dir, '.gclient_entries')) 766 os.remove(join(self.root_dir, '.gclient_entries'))
761 src = join(self.root_dir, 'src') 767 src = join(self.root_dir, 'src')
762 res = self.gclient(['sync', '--jobs', '1'], src) 768 res = self.gclient(['sync', '--jobs', '1'], src)
763 self.checkBlock(res[0], 769 self.checkBlock(res[0],
764 ['running', 'running', 'running']) 770 ['running', 'running', 'running'])
765 771
766 def testUnversionedRepository(self): 772 # TODO(borenet): Uncomment this test once
767 # Check that gclient automatically deletes crippled SVN repositories. 773 # gclient_scm.SCMWrapper._DeleteOrMove is enabled.
768 if not self.enabled: 774 # def testUnversionedRepository(self):
769 return 775 # # Check that gclient automatically deletes crippled SVN repositories.
770 self.gclient(['config', self.svn_base + 'trunk/src/']) 776 # if not self.enabled:
771 cmd = ['sync', '--jobs', '1', '--delete_unversioned_trees', '--reset'] 777 # return
772 self.assertEquals(0, self.gclient(cmd)[-1]) 778 # self.gclient(['config', self.svn_base + 'trunk/src/'])
773 third_party = join(self.root_dir, 'src', 'third_party') 779 # cmd = ['sync', '--jobs', '1', '--delete_unversioned_trees', '--reset']
774 subprocess2.check_call(['svn', 'propset', '-q', 'svn:ignore', 'foo', '.'], 780 # self.assertEquals(0, self.gclient(cmd)[-1])
775 cwd=third_party) 781 # third_party = join(self.root_dir, 'src', 'third_party')
776 782 # subprocess2.check_call(['svn', 'propset', '-q', 'svn:ignore', 'foo', '.'],
777 # Cripple src/third_party/foo and make sure gclient still succeeds. 783 # cwd=third_party)
778 gclient_utils.rmtree(join(third_party, 'foo', '.svn')) 784 #
779 self.assertEquals(0, self.gclient(cmd)[-1]) 785 # # Cripple src/third_party/foo and make sure gclient still succeeds.
786 # gclient_utils.rmtree(join(third_party, 'foo', '.svn'))
787 # self.assertEquals(0, self.gclient(cmd)[-1])
780 788
781 789
782 class GClientSmokeSVNTransitive(GClientSmokeBase): 790 class GClientSmokeSVNTransitive(GClientSmokeBase):
783 FAKE_REPOS_CLASS = FakeRepoTransitive 791 FAKE_REPOS_CLASS = FakeRepoTransitive
784 792
785 def setUp(self): 793 def setUp(self):
786 super(GClientSmokeSVNTransitive, self).setUp() 794 super(GClientSmokeSVNTransitive, self).setUp()
787 self.enabled = self.FAKE_REPOS.set_up_svn() 795 self.enabled = self.FAKE_REPOS.set_up_svn()
788 796
789 def testSyncTransitive(self): 797 def testSyncTransitive(self):
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 ('git', 'repo_2@' + self.githash('repo_2', 1)[:7], 'src/repo2'), 1356 ('git', 'repo_2@' + self.githash('repo_2', 1)[:7], 'src/repo2'),
1349 ('git', 'repo_3', 'src/repo2/repo_renamed'), 1357 ('git', 'repo_3', 'src/repo2/repo_renamed'),
1350 ('svn', 'trunk/third_party/foo@1', 'src/third_party/foo'), 1358 ('svn', 'trunk/third_party/foo@1', 'src/third_party/foo'),
1351 ] 1359 ]
1352 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path)) 1360 expected = [(scm, bases[scm] + url, os.path.join(self.root_dir, path))
1353 for (scm, url, path) in expected_source] 1361 for (scm, url, path) in expected_source]
1354 1362
1355 self.assertEquals(sorted(entries), sorted(expected)) 1363 self.assertEquals(sorted(entries), sorted(expected))
1356 1364
1357 1365
1366 # TODO(borenet): Uncomment the following tests once
1367 # gclient_scm.SCMWrapper._DeleteOrMove is enabled.
1368 # class SkiaDEPSTransitionSmokeTest(GClientSmokeBase):
1369 # """Simulate the behavior of bisect bots as they transition across the Skia
1370 # DEPS change."""
1371 #
1372 # FAKE_REPOS_CLASS = FakeRepoSkiaDEPS
1373 #
1374 # def setUp(self):
1375 # super(SkiaDEPSTransitionSmokeTest, self).setUp()
1376 # self.enabled = (self.FAKE_REPOS.set_up_git() and
1377 # self.FAKE_REPOS.set_up_svn())
1378 #
1379 # def testSkiaDEPSChangeSVN(self):
1380 # if not self.enabled:
1381 # return
1382 #
1383 # # Create an initial checkout:
1384 # # - Single checkout at the root.
1385 # # - Multiple checkouts in a shared subdirectory.
1386 # self.gclient(['config', '--spec',
1387 # 'solutions=['
1388 # '{"name": "src",'
1389 # ' "url": "' + self.svn_base + 'trunk/src/",'
1390 # '}]'])
1391 #
1392 # checkout_path = os.path.join(self.root_dir, 'src')
1393 # skia = os.path.join(checkout_path, 'third_party', 'skia')
1394 # skia_gyp = os.path.join(skia, 'gyp')
1395 # skia_include = os.path.join(skia, 'include')
1396 # skia_src = os.path.join(skia, 'src')
1397 #
1398 # gyp_svn_url = self.svn_base + 'skia/gyp'
1399 # include_svn_url = self.svn_base + 'skia/include'
1400 # src_svn_url = self.svn_base + 'skia/src'
1401 # skia_git_url = self.git_base + 'repo_1'
1402 #
1403 # # Initial sync. Verify that we get the expected checkout.
1404 # res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@2'])
1405 # self.assertEqual(res[2], 0, 'Initial sync failed.')
1406 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_gyp)['URL'],
1407 # gyp_svn_url)
1408 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([],
1409 # skia_include)['URL'],
1410 # include_svn_url)
1411 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_src)['URL'],
1412 # src_svn_url)
1413 #
1414 # # Verify that the sync succeeds. Verify that we have the expected merged
1415 # # checkout.
1416 # res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@3'])
1417 # self.assertEqual(res[2], 0, 'DEPS change sync failed.')
1418 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1419 # skia), skia_git_url)
1420 #
1421 # # Sync again. Verify that we still have the expected merged checkout.
1422 # res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@3'])
1423 # self.assertEqual(res[2], 0, 'Subsequent sync failed.')
1424 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1425 # skia), skia_git_url)
1426 #
1427 # # Sync back to the original DEPS. Verify that we get the original
1428 # # structure.
1429 # res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@2'])
1430 # self.assertEqual(res[2], 0, 'Reverse sync failed.')
1431 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_gyp)['URL'],
1432 # gyp_svn_url)
1433 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([],
1434 # skia_include)['URL'],
1435 # include_svn_url)
1436 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_src)['URL'],
1437 # src_svn_url)
1438 #
1439 # # Sync again. Verify that we still have the original structure.
1440 # res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@2'])
1441 # self.assertEqual(res[2], 0, 'Subsequent sync #2 failed.')
1442 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_gyp)['URL'],
1443 # gyp_svn_url)
1444 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([],
1445 # skia_include)['URL'],
1446 # include_svn_url)
1447 # self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_src)['URL'],
1448 # src_svn_url)
1449 #
1450 # def testSkiaDEPSChangeGit(self):
1451 # if not self.enabled:
1452 # return
1453 #
1454 # # Create an initial checkout:
1455 # # - Single checkout at the root.
1456 # # - Multiple checkouts in a shared subdirectory.
1457 # self.gclient(['config', '--spec',
1458 # 'solutions=['
1459 # '{"name": "src",'
1460 # ' "url": "' + self.git_base + 'repo_2",'
1461 # '}]'])
1462 #
1463 # checkout_path = os.path.join(self.root_dir, 'src')
1464 # skia = os.path.join(checkout_path, 'third_party', 'skia')
1465 # skia_gyp = os.path.join(skia, 'gyp')
1466 # skia_include = os.path.join(skia, 'include')
1467 # skia_src = os.path.join(skia, 'src')
1468 #
1469 # gyp_git_url = self.git_base + 'repo_3'
1470 # include_git_url = self.git_base + 'repo_4'
1471 # src_git_url = self.git_base + 'repo_5'
1472 # skia_git_url = self.FAKE_REPOS.git_base + 'repo_1'
1473 #
1474 # pre_hash = self.githash('repo_2', 1)
1475 # post_hash = self.githash('repo_2', 2)
1476 #
1477 # # Initial sync. Verify that we get the expected checkout.
1478 # res = self.gclient(['sync', '--deps', 'mac', '--revision',
1479 # 'src@%s' % pre_hash])
1480 # self.assertEqual(res[2], 0, 'Initial sync failed.')
1481 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1482 # skia_gyp), gyp_git_url)
1483 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1484 # skia_include), include_git_url)
1485 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1486 # skia_src), src_git_url)
1487 #
1488 # # Verify that the sync succeeds. Verify that we have the expected merged
1489 # # checkout.
1490 # res = self.gclient(['sync', '--deps', 'mac', '--revision',
1491 # 'src@%s' % post_hash])
1492 # self.assertEqual(res[2], 0, 'DEPS change sync failed.')
1493 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1494 # skia), skia_git_url)
1495 #
1496 # # Sync again. Verify that we still have the expected merged checkout.
1497 # res = self.gclient(['sync', '--deps', 'mac', '--revision',
1498 # 'src@%s' % post_hash])
1499 # self.assertEqual(res[2], 0, 'Subsequent sync failed.')
1500 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1501 # skia), skia_git_url)
1502 #
1503 # # Sync back to the original DEPS. Verify that we get the original
1504 # # structure.
1505 # res = self.gclient(['sync', '--deps', 'mac', '--revision',
1506 # 'src@%s' % pre_hash])
1507 # self.assertEqual(res[2], 0, 'Reverse sync failed.')
1508 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1509 # skia_gyp), gyp_git_url)
1510 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1511 # skia_include), include_git_url)
1512 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1513 # skia_src), src_git_url)
1514 #
1515 # # Sync again. Verify that we still have the original structure.
1516 # res = self.gclient(['sync', '--deps', 'mac', '--revision',
1517 # 'src@%s' % pre_hash])
1518 # self.assertEqual(res[2], 0, 'Subsequent sync #2 failed.')
1519 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1520 # skia_gyp), gyp_git_url)
1521 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1522 # skia_include), include_git_url)
1523 # self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
1524 # skia_src), src_git_url)
1525
1526
1358 class GClientSmokeFromCheckout(GClientSmokeBase): 1527 class GClientSmokeFromCheckout(GClientSmokeBase):
1359 # WebKit abuses this. It has a .gclient and a DEPS from a checkout. 1528 # WebKit abuses this. It has a .gclient and a DEPS from a checkout.
1360 def setUp(self): 1529 def setUp(self):
1361 super(GClientSmokeFromCheckout, self).setUp() 1530 super(GClientSmokeFromCheckout, self).setUp()
1362 self.enabled = self.FAKE_REPOS.set_up_svn() 1531 self.enabled = self.FAKE_REPOS.set_up_svn()
1363 os.rmdir(self.root_dir) 1532 os.rmdir(self.root_dir)
1364 if self.enabled: 1533 if self.enabled:
1365 usr, pwd = self.FAKE_REPOS.USERS[0] 1534 usr, pwd = self.FAKE_REPOS.USERS[0]
1366 subprocess2.check_call( 1535 subprocess2.check_call(
1367 ['svn', 'checkout', self.svn_base + '/trunk/webkit', 1536 ['svn', 'checkout', self.svn_base + '/trunk/webkit',
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 1624
1456 if '-c' in sys.argv: 1625 if '-c' in sys.argv:
1457 COVERAGE = True 1626 COVERAGE = True
1458 sys.argv.remove('-c') 1627 sys.argv.remove('-c')
1459 if os.path.exists('.coverage'): 1628 if os.path.exists('.coverage'):
1460 os.remove('.coverage') 1629 os.remove('.coverage')
1461 os.environ['COVERAGE_FILE'] = os.path.join( 1630 os.environ['COVERAGE_FILE'] = os.path.join(
1462 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 1631 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
1463 '.coverage') 1632 '.coverage')
1464 unittest.main() 1633 unittest.main()
OLDNEW
« gclient_scm.py ('K') | « tests/gclient_scm_test.py ('k') | tests/scm_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698