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

Unified Diff: tests/gclient_smoketest.py

Issue 2430001: Move all revision parsing code to _EnforceRevisions. (Closed)
Patch Set: Make the doc a bit clearer Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/fake_repos.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_smoketest.py
diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py
index 27f98a57860199d4effb6f0e54c41d3e65b3f814..c91f3ee4bbda8515d937a57ad94c001f8ebd316c 100755
--- a/tests/gclient_smoketest.py
+++ b/tests/gclient_smoketest.py
@@ -177,7 +177,7 @@ class GClientSmokeSVN(GClientSmokeBase):
self.checkString('', results[1])
self.assertEquals(0, results[2])
tree = mangle_svn_tree(
- (join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[-1]),
+ (join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[2]),
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'),
self.FAKE_REPOS.svn_revs[2]),
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'),
@@ -191,9 +191,29 @@ class GClientSmokeSVN(GClientSmokeBase):
tree[join('src', 'svn_hooked1')] = 'svn_hooked1'
self.assertTree(tree)
- def SyncAtRev1(self, arg):
+ def testSyncIgnoredSolutionName(self):
+ """TODO(maruel): This will become an error soon."""
self.gclient(['config', self.svn_base + 'trunk/src/'])
- results = self.gclient(['sync', '--deps', 'mac', '-r', arg])
+ results = self.gclient(['sync', '--deps', 'mac', '-r', 'invalid@1'])
+ out = results[0].splitlines(False)
+ self.assertEquals(17, len(out))
+ self.checkString('Please fix your script, having invalid --revision flags '
+ 'will soon considered an error.\n', results[1])
+ self.assertEquals(0, results[2])
+ tree = mangle_svn_tree(
+ (join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[2]),
+ (join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'),
+ self.FAKE_REPOS.svn_revs[1]),
+ (join('trunk', 'other'), join('src', 'other'),
+ self.FAKE_REPOS.svn_revs[2]),
+ )
+ tree[join('src', 'svn_hooked1')] = 'svn_hooked1'
+ self.assertTree(tree)
+
+ def testSyncNoSolutionName(self):
+ # When no solution name is provided, gclient uses the first solution listed.
+ self.gclient(['config', self.svn_base + 'trunk/src/'])
+ results = self.gclient(['sync', '--deps', 'mac', '-r', '1'])
out = results[0].splitlines(False)
self.assertEquals(19, len(out))
self.checkString('', results[1])
@@ -210,12 +230,6 @@ class GClientSmokeSVN(GClientSmokeBase):
)
self.assertTree(tree)
- def testSyncIgnoredSolutionName(self):
- self.SyncAtRev1('ignored@1')
-
- def testSyncNoSolutionName(self):
- self.SyncAtRev1('1')
-
def testRevertAndStatus(self):
self.gclient(['config', self.svn_base + 'trunk/src/'])
# Tested in testSync.
@@ -420,6 +434,54 @@ class GClientSmokeGIT(GClientSmokeBase):
tree[join('src', 'git_hooked2')] = 'git_hooked2'
self.assertTree(tree)
+ def testSyncIgnoredSolutionName(self):
+ """TODO(maruel): This will become an error soon."""
+ self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
+ results = self.gclient([
+ 'sync', '--deps', 'mac', '--revision',
+ 'invalid@' + self.FAKE_REPOS.git_hashes['repo_1'][0][0],
+ ])
+ out = results[0].splitlines(False)
+
+ self.assertEquals(13, len(out))
+ # TODO(maruel): git shouldn't output to stderr...
+ self.checkString('Please fix your script, having invalid --revision flags '
+ 'will soon considered an error.\nSwitched to a new branch \'%s\'\n' %
+ self.FAKE_REPOS.git_hashes['repo_2'][0][0][:7],
+ results[1])
+ self.assertEquals(0, results[2])
+ tree = mangle_git_tree(
+ ('src', self.FAKE_REPOS.git_hashes['repo_1'][1][1]),
+ (join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
+ (join('src', 'repo2', 'repo_renamed'),
+ self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
+ )
+ tree[join('src', 'git_hooked1')] = 'git_hooked1'
+ tree[join('src', 'git_hooked2')] = 'git_hooked2'
+ self.assertTree(tree)
+
+ def testSyncNoSolutionName(self):
+ # When no solution name is provided, gclient uses the first solution listed.
+ self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
+ results = self.gclient([
+ 'sync', '--deps', 'mac', '--revision',
+ self.FAKE_REPOS.git_hashes['repo_1'][0][0],
+ ])
+ out = results[0].splitlines(False)
+ self.assertEquals(12, len(out))
+ # TODO(maruel): git shouldn't output to stderr...
+ self.checkString('Switched to a new branch \'%s\'\n'
+ % self.FAKE_REPOS.git_hashes['repo_1'][0][0], results[1])
+ self.assertEquals(0, results[2])
+ tree = mangle_git_tree(
+ ('src', self.FAKE_REPOS.git_hashes['repo_1'][0][1]),
+ (join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
+ (join('src', 'repo2', 'repo3'),
+ self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
+ (join('src', 'repo4'), self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
+ )
+ self.assertTree(tree)
+
def testRevertAndStatus(self):
"""TODO(maruel): Remove this line once this test is fixed."""
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
« no previous file with comments | « tests/fake_repos.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698