summaryrefslogtreecommitdiff
path: root/java/config/TestUtil.py
diff options
context:
space:
mode:
Diffstat (limited to 'java/config/TestUtil.py')
-rw-r--r--java/config/TestUtil.py45
1 files changed, 37 insertions, 8 deletions
diff --git a/java/config/TestUtil.py b/java/config/TestUtil.py
index 6f09c10560d..75cde1bc7f7 100644
--- a/java/config/TestUtil.py
+++ b/java/config/TestUtil.py
@@ -50,6 +50,7 @@ else:
defaultHost = ""
sep = ""
+
if sys.platform == "win32":
sep = ";"
elif sys.platform == "cygwin":
@@ -65,6 +66,22 @@ clientOptions = clientProtocol + defaultHost
clientServerOptions = commonServerOptions + clientServerProtocol + defaultHost
collocatedOptions = clientServerProtocol
+def isCygwin():
+
+ # The substring on sys.platform is required because some cygwin
+ # versions return variations like "cygwin_nt-4.01".
+ if sys.platform[:6] == "cygwin":
+ return 1
+ else:
+ return 0
+
+def isWin32():
+
+ if sys.platform == "win32" or isCygwin():
+ return 1
+ else:
+ return 0
+
# Only used for C++ programs
serverPids = []
def killServers():
@@ -111,7 +128,7 @@ def getAdapterReady(serverPipe):
killServers()
sys.exit(1)
-def clientServerTest(toplevel, name):
+def clientServerTestWithOptions(toplevel, name, additionalServerOptions, additionalClientOptions):
testdir = os.path.join(toplevel, "test", name)
classpath = os.path.join(toplevel, "lib") + sep + os.path.join(testdir, "classes") + sep + \
@@ -123,12 +140,12 @@ def clientServerTest(toplevel, name):
updatedClientOptions = clientOptions.replace("TOPLEVELDIR", toplevel)
print "starting server...",
- serverPipe = os.popen(server + updatedServerOptions)
+ serverPipe = os.popen(server + updatedServerOptions + additionalServerOptions)
getAdapterReady(serverPipe)
print "ok"
print "starting client...",
- clientPipe = os.popen(client + updatedClientOptions)
+ clientPipe = os.popen(client + updatedClientOptions + additionalClientOptions)
print "ok"
for output in clientPipe.xreadlines():
@@ -141,7 +158,11 @@ def clientServerTest(toplevel, name):
killServers()
sys.exit(1)
-def mixedClientServerTest(toplevel, name):
+def clientServerTest(toplevel, name):
+
+ clientServerTestWithOptions(toplevel, name, "", "")
+
+def mixedClientServerTestWithOptions(toplevel, name, additionalServerOptions, additionalClientOptions):
testdir = os.path.join(toplevel, "test", name)
classpath = os.path.join(toplevel, "lib") + sep + os.path.join(testdir, "classes") + sep + \
@@ -153,12 +174,12 @@ def mixedClientServerTest(toplevel, name):
updatedClientOptions = updatedServerOptions
print "starting server...",
- serverPipe = os.popen(server + updatedServerOptions)
+ serverPipe = os.popen(server + updatedServerOptions + additionalServerOptions)
getAdapterReady(serverPipe)
print "ok"
print "starting client...",
- clientPipe = os.popen(client + updatedClientOptions)
+ clientPipe = os.popen(client + updatedClientOptions + additionalClientOptions)
print "ok"
for output in clientPipe.xreadlines():
@@ -171,7 +192,11 @@ def mixedClientServerTest(toplevel, name):
killServers()
sys.exit(1)
-def collocatedTest(toplevel, name):
+def mixedClientServerTest(toplevel, name):
+
+ mixedClientServerTestWithOptions(toplevel, name, "", "")
+
+def collocatedTestWithOptions(toplevel, name, additionalOptions):
testdir = os.path.join(toplevel, "test", name)
classpath = os.path.join(toplevel, "lib") + sep + os.path.join(testdir, "classes") + sep + \
@@ -181,7 +206,7 @@ def collocatedTest(toplevel, name):
updatedCollocatedOptions = collocatedOptions.replace("TOPLEVELDIR", toplevel)
print "starting collocated...",
- collocatedPipe = os.popen(collocated + updatedCollocatedOptions)
+ collocatedPipe = os.popen(collocated + updatedCollocatedOptions + additionalOptions)
print "ok"
for output in collocatedPipe.xreadlines():
@@ -193,6 +218,10 @@ def collocatedTest(toplevel, name):
killServers()
sys.exit(1)
+def collocatedTest(toplevel, name):
+
+ collocatedTestWithOptions(toplevel, name, "")
+
def cleanDbDir(path):
files = os.listdir(path)