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

Unified Diff: tests/fake_repos.py

Issue 6681019: make unit tests pass on the mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: update with better comments Created 9 years, 9 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 | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/fake_repos.py
diff --git a/tests/fake_repos.py b/tests/fake_repos.py
index 5f8c54ef823a59560a0bd97d61615df35f770d61..7706bb25377970634aeef363ad452688acd4048f 100755
--- a/tests/fake_repos.py
+++ b/tests/fake_repos.py
@@ -7,6 +7,7 @@
import atexit
import datetime
+import errno
import logging
import os
import pprint
@@ -15,6 +16,7 @@ import socket
import subprocess
import sys
import tempfile
+import time
# trial_dir must be first for non-system libraries.
from tests import trial_dir
@@ -237,7 +239,11 @@ class FakeReposBase(object):
def tear_down_svn(self):
if self.svnserve:
logging.debug('Killing svnserve pid %s' % self.svnserve.pid)
- self.svnserve.kill()
+ try:
+ self.svnserve.kill()
+ except OSError, e:
+ if e.errno != errno.ESRCH: # no such process
+ raise
self.wait_for_port_to_free(self.svn_port)
self.svnserve = None
if not self.trial.SHOULD_LEAK:
@@ -303,6 +309,12 @@ class FakeReposBase(object):
text += ''.join('%s = %s\n' % (usr, pwd) for usr, pwd in self.USERS)
write(join(self.svn_repo, 'conf', 'passwd'), text)
+ # Mac 10.6 ships with a buggy subversion build and we need this line
+ # to work around the bug.
+ write(join(self.svn_repo, 'db', 'fsfs.conf'),
+ '[rep-sharing]\n'
+ 'enable-rep-sharing = false\n')
+
# Start the daemon.
cmd = ['svnserve', '-d', '--foreground', '-r', self.root_dir]
if self.host == '127.0.0.1':
@@ -376,6 +388,14 @@ class FakeReposBase(object):
def wait_for_port_to_bind(self, port, process):
sock = socket.socket()
+
+ if sys.platform == 'darwin':
+ # On Mac SnowLeopard, if we attempt to connect to the socket
+ # immediately, it fails with EINVAL and never gets a chance to
+ # connect (putting us into a hard spin and then failing).
+ # Linux doesn't need this.
+ time.sleep(0.1)
+
try:
start = datetime.datetime.utcnow()
maxdelay = datetime.timedelta(seconds=30)
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698