diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-03-19 18:33:16 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-03-19 18:33:16 +0000 |
commit | 62ed5e88346685d53ffc6c367058f199d4c53419 (patch) | |
tree | e418e4ee7156c1d9f1099adb8a11ddd4bcf910e7 /java/config/TestUtil.py | |
parent | bug fix for identity parsing (diff) | |
download | ice-62ed5e88346685d53ffc6c367058f199d4c53419.tar.bz2 ice-62ed5e88346685d53ffc6c367058f199d4c53419.tar.xz ice-62ed5e88346685d53ffc6c367058f199d4c53419.zip |
adding Glacier test
Diffstat (limited to 'java/config/TestUtil.py')
-rw-r--r-- | java/config/TestUtil.py | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/java/config/TestUtil.py b/java/config/TestUtil.py index 80e4401e95b..50f116bb81a 100644 --- a/java/config/TestUtil.py +++ b/java/config/TestUtil.py @@ -64,6 +64,48 @@ clientOptions = clientProtocol + defaultHost clientServerOptions = commonServerOptions + clientServerProtocol + defaultHost collocatedOptions = clientServerProtocol +serverPids = [] + +# +# Only used for C++ programs +# +def killServers(): + + global serverPids + + for pid in serverPids: + if sys.platform == "cygwin": + print "killServers(): not implemented for cygwin python." + sys.exit(1) + elif sys.platform == "win32": + try: + import win32api + handle = win32api.OpenProcess(1, 0, pid) + win32api.TerminateProcess(handle, 0) + except: + pass # Ignore errors, such as non-existing processes. + else: + try: + os.kill(pid, 9) + except: + pass # Ignore errors, such as non-existing processes. + + serverPids = [] + +# +# Only used for C++ programs +# +def getServerPid(serverPipe): + + output = serverPipe.readline().strip() + + if not output: + print "failed!" + killServers() + sys.exit(1) + + serverPids.append(int(output)) + def getAdapterReady(serverPipe): output = serverPipe.readline().strip() @@ -105,6 +147,39 @@ def clientServerTest(toplevel, name): serverPipe.close() clientPipe.close() +def clientServerHybridTest(toplevel, name): + + testdir = os.path.join(toplevel, "test", name) + classpath = os.path.join(toplevel, "lib") + sep + os.path.join(testdir, "classes") + sep + os.environ['CLASSPATH'] + server = "java -classpath \"" + classpath + "\" Server " + client = "java -classpath \"" + classpath + "\" Client " + + updatedServerOptions = clientServerOptions.replace("TOPLEVELDIR", toplevel) + updatedClientOptions = updatedServerOptions + + print "starting server...", + serverPipe = os.popen(server + updatedServerOptions) + getAdapterReady(serverPipe) + print "ok" + + print "starting client...", + clientPipe = os.popen(client + updatedClientOptions) + output = clientPipe.readline() + if not output: + print "failed!" + serverPipe.close() + clientPipe.close() + sys.exit(1) + print "ok" + while 1: + output = clientPipe.readline() + if not output: + break; + print output, + killServers() + serverPipe.close() + clientPipe.close() + def collocatedTest(toplevel, name): testdir = os.path.join(toplevel, "test", name) |