Improve the testing situation on Windows.

For now that involves disabling a lot of tests when they can't be run.

I'm unsure about the ascii encoding, it fails here if I keep this call on a French UI.

TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3333028

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@59137 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
maruel@chromium.org 15 years ago
parent 5f2a196ca6
commit 5631746743

@ -56,7 +56,11 @@ def RunPylint(input_api, output_api):
files.append('git-try')
# It uses non-standard pylint exceptions that makes pylint always fail.
files.remove('cpplint.py')
try:
proc = input_api.subprocess.Popen(['pylint', '-E'] + files)
except WindowsError:
# It's windows, give up.
return []
proc.communicate()
if proc.returncode:
return [output_api.PresubmitError('Fix pylint errors first.')]

@ -115,7 +115,7 @@ class OutputApi(object):
output_stream.write(' ' + ' \\\n '.join(map(str, self._items)) + '\n')
if self._long_text:
output_stream.write('\n***************\n%s\n***************\n' %
self._long_text.encode('ascii', 'replace'))
self._long_text)
if self.ShouldPrompt() and may_prompt:
if not PromptYesNo(input_stream, output_stream,

@ -286,10 +286,14 @@ class FakeRepos(object):
def setUpSVN(self):
"""Creates subversion repositories and start the servers."""
if self.svnserve:
return
return True
self.setUp()
root = join(self.repos_dir, 'svn')
try:
check_call(['svnadmin', 'create', root])
except OSError:
self.svn_enabled = False
return False
write(join(root, 'conf', 'svnserve.conf'),
'[general]\n'
'anon-access = read\n'
@ -306,6 +310,7 @@ class FakeRepos(object):
cmd.append('--listen-host=127.0.0.1')
self.svnserve = Popen(cmd, cwd=root)
self.populateSvn()
return True
def populateSvn(self):
"""Creates a few revisions of changes including DEPS files."""

@ -597,6 +597,8 @@ from :3
self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path)
def tearDown(self):
if not self.enabled:
self.checkstdout('')
GCBaseTestCase.tearDown(self)
TestCaseUtils.tearDown(self)
unittest.TestCase.tearDown(self)
@ -611,6 +613,7 @@ from :3
# If you add a member, be sure to add the relevant test!
self.compareMembers(gclient_scm.CreateSCM(url=self.url), members)
if self.enabled:
self.checkstdout('')
def testRevertMissing(self):

@ -138,6 +138,7 @@ class GClientSmokeBase(FakeReposTestBase):
class GClientSmoke(GClientSmokeBase):
"""Doesn't require neither svnserve nor git-daemon."""
def testHelp(self):
"""testHelp: make sure no new command was added."""
result = self.gclient(['help'])
@ -252,10 +253,12 @@ class GClientSmoke(GClientSmokeBase):
class GClientSmokeSVN(GClientSmokeBase):
def setUp(self):
GClientSmokeBase.setUp(self)
self.FAKE_REPOS.setUpSVN()
self.enabled = self.FAKE_REPOS.setUpSVN()
def testSync(self):
# TODO(maruel): safesync.
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
# Test unversioned checkout.
self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'],
@ -306,6 +309,8 @@ class GClientSmokeSVN(GClientSmokeBase):
def testSyncIgnoredSolutionName(self):
"""TODO(maruel): This will become an error soon."""
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
results = self.gclient(
['sync', '--deps', 'mac', '-r', 'invalid@1', '--jobs', '1'])
@ -329,6 +334,8 @@ class GClientSmokeSVN(GClientSmokeBase):
def testSyncNoSolutionName(self):
# When no solution name is provided, gclient uses the first solution listed.
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.parseGclient(['sync', '--deps', 'mac', '-r', '1', '--jobs', '1'],
['running', 'running', 'running', 'running'])
@ -340,6 +347,8 @@ class GClientSmokeSVN(GClientSmokeBase):
self.assertTree(tree)
def testSyncJobs(self):
if not self.enabled:
return
# TODO(maruel): safesync.
self.gclient(['config', self.svn_base + 'trunk/src/'])
# Test unversioned checkout.
@ -394,6 +403,8 @@ class GClientSmokeSVN(GClientSmokeBase):
self.assertTree(tree)
def testRevertAndStatus(self):
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
# Tested in testSync.
self.gclient(['sync', '--deps', 'mac'])
@ -442,6 +453,8 @@ class GClientSmokeSVN(GClientSmokeBase):
self.assertEquals(1, len(out))
def testRevertAndStatusDepsOs(self):
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
# Tested in testSync.
self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1'])
@ -503,6 +516,8 @@ class GClientSmokeSVN(GClientSmokeBase):
self.assertEquals(4, len(out[0]))
def testRunHooks(self):
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.gclient(['sync', '--deps', 'mac'])
out = self.parseGclient(['runhooks', '--deps', 'mac'],
@ -511,12 +526,16 @@ class GClientSmokeSVN(GClientSmokeBase):
self.checkString(1, len(out[1]))
def testRunHooksDepsOs(self):
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1'])
out = self.parseGclient(['runhooks', '--deps', 'mac'], [])
self.assertEquals([], out)
def testRevInfo(self):
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.gclient(['sync', '--deps', 'mac'])
results = self.gclient(['revinfo', '--deps', 'mac'])
@ -555,6 +574,8 @@ class GClientSmokeSVN(GClientSmokeBase):
def testWrongDirectory(self):
# Check that we're not using a .gclient configuration which only talks
# about a subdirectory src when we're in a different subdirectory src-other.
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.gclient(['sync'])
other_src = join(self.root_dir, 'src-other')
@ -565,6 +586,8 @@ class GClientSmokeSVN(GClientSmokeBase):
def testCorrectDirectory(self):
# Check that when we're in the subdirectory src, the .gclient configuration
# is used.
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.gclient(['sync'])
src = join(self.root_dir, 'src')
@ -574,6 +597,8 @@ class GClientSmokeSVN(GClientSmokeBase):
def testInitialCheckoutNotYetDone(self):
# Check that gclient can be executed when the initial checkout hasn't been
# done yet.
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.parseGclient(['sync', '--jobs', '1'],
['running', 'running',
@ -585,6 +610,8 @@ class GClientSmokeSVN(GClientSmokeBase):
def testInitialCheckoutFailed(self):
# Check that gclient can be executed from an arbitrary sub directory if the
# initial checkout has failed.
if not self.enabled:
return
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.gclient(['sync'])
# Cripple the checkout.
@ -817,8 +844,7 @@ class GClientSmokeGIT(GClientSmokeBase):
class GClientSmokeBoth(GClientSmokeBase):
def setUp(self):
GClientSmokeBase.setUp(self)
self.FAKE_REPOS.setUpSVN()
self.enabled = self.FAKE_REPOS.setUpGIT()
self.enabled = self.FAKE_REPOS.setUpSVN() and self.FAKE_REPOS.setUpGIT()
def testMultiSolutions(self):
if not self.enabled:
@ -983,14 +1009,17 @@ class GClientSmokeFromCheckout(GClientSmokeBase):
# WebKit abuses this. It has a .gclient and a DEPS from a checkout.
def setUp(self):
GClientSmokeBase.setUp(self)
self.FAKE_REPOS.setUpSVN()
self.enabled = self.FAKE_REPOS.setUpSVN()
os.rmdir(self.root_dir)
if self.enabled:
check_call(['svn', 'checkout', 'svn://127.0.0.1/svn/trunk/webkit',
self.root_dir, '-q',
'--non-interactive', '--no-auth-cache',
'--username', 'user1', '--password', 'foo'])
def testSync(self):
if not self.enabled:
return
self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'],
['running', 'running'])
tree = self.mangle_svn_tree(
@ -999,6 +1028,8 @@ class GClientSmokeFromCheckout(GClientSmokeBase):
self.assertTree(tree)
def testRevertAndStatus(self):
if not self.enabled:
return
self.gclient(['sync'])
# TODO(maruel): This is incorrect.
@ -1023,6 +1054,8 @@ class GClientSmokeFromCheckout(GClientSmokeBase):
out = self.parseGclient(['status', '--deps', 'mac'], [])
def testRunHooks(self):
if not self.enabled:
return
# Hooks aren't really tested for now since there is no hook defined.
self.gclient(['sync', '--deps', 'mac'])
out = self.parseGclient(['runhooks', '--deps', 'mac'], ['running'])
@ -1036,6 +1069,8 @@ class GClientSmokeFromCheckout(GClientSmokeBase):
self.assertTree(tree)
def testRevInfo(self):
if not self.enabled:
return
self.gclient(['sync', '--deps', 'mac'])
results = self.gclient(['revinfo', '--deps', 'mac'])
expected = (
@ -1050,6 +1085,8 @@ class GClientSmokeFromCheckout(GClientSmokeBase):
#self.check(expected, results)
def testRest(self):
if not self.enabled:
return
self.gclient(['sync'])
# TODO(maruel): This is incorrect, it should run on ./ too.
out = self.parseGclient(

Loading…
Cancel
Save