[PATCH] run-tests.py: skip test if HGPORT(s) already in use
Mads Kiilerich
mads at kiilerich.com
Mon Feb 8 00:53:36 UTC 2010
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1265590414 -3600
# Node ID 078c24394e202b8708e5a4af2f8c09d77ce0cfc1
# Parent a5576908b5896b4ff04fd836252f225b5a4027b6
run-tests.py: skip test if HGPORT(s) already in use
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -52,6 +52,7 @@
import sys
import tempfile
import time
+import socket
closefds = os.name == 'posix'
def Popen4(cmd, bufsize=-1):
@@ -563,6 +564,16 @@
return skip("not executable")
cmd = '"%s"' % testpath
+ if "HGPORT" in file(testpath).read():
+ for i in xrange(3):
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ try:
+ s.bind(('', options.port + i))
+ except socket.error, e:
+ return skip("*:%s not available: %s" %
+ (options.port + i, e))
+ s.close()
+
if options.timeout > 0:
signal.alarm(options.timeout)
More information about the Mercurial-devel
mailing list