Index: tests/gclient_smoketest.py |
diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py |
index 427699816bc97b0429879697ae46f659014fa4b1..f57aaffe9a4fdccd813707d98ef44c88ff5a86bc 100755 |
--- a/tests/gclient_smoketest.py |
+++ b/tests/gclient_smoketest.py |
@@ -21,9 +21,11 @@ ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
sys.path.insert(0, ROOT_DIR) |
from testing_support.fake_repos import join, write |
-from testing_support.fake_repos import FakeReposTestBase, FakeRepoTransitive |
+from testing_support.fake_repos import FakeReposTestBase, FakeRepoTransitive, \ |
+ FakeRepoSkiaDEPS |
import gclient_utils |
+import scm as gclient_scm |
import subprocess2 |
@@ -1397,6 +1399,170 @@ class GClientSmokeBoth(GClientSmokeBase): |
self.assertEquals(sorted(entries), sorted(expected)) |
+class SkiaDEPSTransitionSmokeTest(GClientSmokeBase): |
+ """Simulate the behavior of bisect bots as they transition across the Skia |
+ DEPS change.""" |
+ |
+ FAKE_REPOS_CLASS = FakeRepoSkiaDEPS |
+ |
+ def setUp(self): |
+ super(SkiaDEPSTransitionSmokeTest, self).setUp() |
+ self.enabled = self.FAKE_REPOS.set_up_git() and self.FAKE_REPOS.set_up_svn() |
+ |
+ def testSkiaDEPSChangeSVN(self): |
+ if not self.enabled: |
+ return |
+ |
+ # Create an initial checkout: |
+ # - Single checkout at the root. |
+ # - Multiple checkouts in a shared subdirectory. |
+ self.gclient(['config', '--spec', |
+ 'solutions=[' |
+ '{"name": "src",' |
+ ' "url": "' + self.svn_base + 'trunk/src/",' |
+ '}]']) |
+ |
+ checkout_path = os.path.join(self.root_dir, 'src') |
+ skia = os.path.join(checkout_path, 'third_party', 'skia') |
+ skia_gyp = os.path.join(skia, 'gyp') |
+ skia_include = os.path.join(skia, 'include') |
+ skia_src = os.path.join(skia, 'src') |
+ |
+ gyp_svn_url = self.svn_base + 'skia/gyp' |
+ include_svn_url = self.svn_base + 'skia/include' |
+ src_svn_url = self.svn_base + 'skia/src' |
+ skia_git_url = self.git_base + 'repo_1' |
+ |
+ # Initial sync. Verify that we get the expected checkout. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@2']) |
+ self.assertEqual(res[2], 0, 'Initial sync failed.') |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_gyp)['URL'], |
+ gyp_svn_url) |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_include)['URL'], |
+ include_svn_url) |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_src)['URL'], |
+ src_svn_url) |
+ |
+ # Try to sync the new DEPS. Verify that the sync fails without --force. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@3']) |
+ self.assertEquals(res[2], 1, 'New DEPS sync succeeded unexpectedly.') |
+ |
+ # Verify that the sync succeeds with --force. Verify that we have the |
+ # expected merged checkout. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@3', |
+ '--force']) |
+ self.assertEqual(res[2], 0, 'DEPS change sync failed with --force.') |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia), skia_git_url) |
+ |
+ # Sync again. Verify that we still have the expected merged checkout. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@3']) |
+ self.assertEqual(res[2], 0, 'Subsequent sync failed.') |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia), skia_git_url) |
+ |
+ # Sync back to the original DEPS. Verify that we get the original structure. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@2', |
+ '--force']) |
+ self.assertEqual(res[2], 0, 'Reverse sync failed.') |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_gyp)['URL'], |
+ gyp_svn_url) |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_include)['URL'], |
+ include_svn_url) |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_src)['URL'], |
+ src_svn_url) |
+ |
+ # Sync again. Verify that we still have the original structure. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', 'src@2']) |
+ self.assertEqual(res[2], 0, 'Subsequent sync #2 failed.') |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_gyp)['URL'], |
+ gyp_svn_url) |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_include)['URL'], |
+ include_svn_url) |
+ self.assertEqual(gclient_scm.SVN.CaptureLocalInfo([], skia_src)['URL'], |
+ src_svn_url) |
+ |
+ def testSkiaDEPSChangeGit(self): |
+ if not self.enabled: |
+ return |
+ |
+ # Create an initial checkout: |
+ # - Single checkout at the root. |
+ # - Multiple checkouts in a shared subdirectory. |
+ self.gclient(['config', '--spec', |
+ 'solutions=[' |
+ '{"name": "src",' |
+ ' "url": "' + self.git_base + 'repo_2",' |
+ '}]']) |
+ |
+ checkout_path = os.path.join(self.root_dir, 'src') |
+ skia = os.path.join(checkout_path, 'third_party', 'skia') |
+ skia_gyp = os.path.join(skia, 'gyp') |
+ skia_include = os.path.join(skia, 'include') |
+ skia_src = os.path.join(skia, 'src') |
+ |
+ gyp_git_url = self.git_base + 'repo_3' |
+ include_git_url = self.git_base + 'repo_4' |
+ src_git_url = self.git_base + 'repo_5' |
+ skia_git_url = self.FAKE_REPOS.git_base + 'repo_1' |
+ |
+ pre_hash = self.githash('repo_2', 1) |
+ post_hash = self.githash('repo_2', 2) |
+ |
+ # Initial sync. Verify that we get the expected checkout. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', |
+ 'src@%s' % pre_hash]) |
+ self.assertEqual(res[2], 0, 'Initial sync failed.') |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_gyp), gyp_git_url) |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_include), include_git_url) |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_src), src_git_url) |
+ |
+ # Try to sync the new DEPS. Verify that the sync fails without --force. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', |
+ 'src@%s' % post_hash]) |
+ self.assertEquals(res[2], 1, 'New DEPS sync succeeded unexpectedly.') |
+ |
+ # Verify that the sync succeeds with --force. Verify that we have the |
+ # expected merged checkout. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', |
+ 'src@%s' % post_hash, '--force']) |
+ self.assertEqual(res[2], 0, 'DEPS change sync failed with --force.') |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia), skia_git_url) |
+ |
+ # Sync again. Verify that we still have the expected merged checkout. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', |
+ 'src@%s' % post_hash]) |
+ self.assertEqual(res[2], 0, 'Subsequent sync failed.') |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia), skia_git_url) |
+ |
+ # Sync back to the original DEPS. Verify that we get the original structure. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', |
+ 'src@%s' % pre_hash, '--force']) |
+ self.assertEqual(res[2], 0, 'Reverse sync failed.') |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_gyp), gyp_git_url) |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_include), include_git_url) |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_src), src_git_url) |
+ |
+ # Sync again. Verify that we still have the original structure. |
+ res = self.gclient(['sync', '--deps', 'mac', '--revision', |
+ 'src@%s' % pre_hash]) |
+ self.assertEqual(res[2], 0, 'Subsequent sync #2 failed.') |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_gyp), gyp_git_url) |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_include), include_git_url) |
+ self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'], |
+ skia_src), src_git_url) |
+ |
+ |
class GClientSmokeFromCheckout(GClientSmokeBase): |
# WebKit abuses this. It has a .gclient and a DEPS from a checkout. |
def setUp(self): |