summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-07-30 18:56:23 +0000
committerMarc Laukien <marc@zeroc.com>2001-07-30 18:56:23 +0000
commite95b78d4ff1a27bd638c53332a0405fb26149c23 (patch)
treed9fcf088694715eaa351e6e3e61beb61468eafc9 /cpp
parentbug fix (diff)
downloadice-e95b78d4ff1a27bd638c53332a0405fb26149c23.tar.bz2
ice-e95b78d4ff1a27bd638c53332a0405fb26149c23.tar.xz
ice-e95b78d4ff1a27bd638c53332a0405fb26149c23.zip
TestUtil changes
Diffstat (limited to 'cpp')
-rw-r--r--cpp/config/TestUtil.py91
-rw-r--r--cpp/include/Ice/Config.h3
2 files changed, 53 insertions, 41 deletions
diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py
index 3e692c36426..00f77770c2b 100644
--- a/cpp/config/TestUtil.py
+++ b/cpp/config/TestUtil.py
@@ -1,58 +1,67 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2002
+# MutableRealms, Inc.
+# Huntsville, AL, USA
+#
+# All Rights Reserved
+#
+# **********************************************************************
+
import sys, os, string
-def start(path):
- pipein, pipeout = os.pipe()
- pid = os.fork()
- if(pid == 0):
- os.close(pipein)
- os.dup2(pipeout, sys.stdout.fileno())
- os.execv(path, [])
- else:
- os.close(pipeout)
- return os.fdopen(pipein), pid
-
-pids = []
-def terminate(status):
- for pid in pids:
- if(os.name == "nt"):
+serverPids = []
+
+def killServers():
+
+ global serverPids
+
+ for pid in serverPids:
+ if os.name == "nt":
import win32api
handle = win32api.OpenProcess(1, 0, pid)
return (0 != win32api.TerminateProcess(handle, 0))
else:
os.kill(pid, 9)
- sys.exit(status)
-def server():
+ serverPids = []
+
+def clientServerTest(toplevel, name):
+
+ testdir = os.path.join(toplevel, "test", name)
+ server = os.path.join(testdir, "server")
+ client = os.path.join(testdir, "client")
+
print "starting server...",
- server, pid = start("./server")
- pids.append(pid)
- ready = string.strip(server.readline())
- if ready != "ready":
+ serverPipe = os.popen(os.path.join(testdir, "server --pid"))
+ output = serverPipe.readline().strip()
+ if not output:
print "failed!"
- terminate(0)
- else:
- print "ok"
-
-def client():
+ sys.exit(0)
+ serverPids.append(int(output))
+ print "ok"
+
print "starting client...",
- client, pid = start("./client")
- pids.append(pid)
- output = client.read()
+ clientPipe = os.popen(os.path.join(testdir, "client"))
+ output = clientPipe.read().strip()
if not output:
print "failed!"
- terminate(0)
- else:
- print "ok"
- print output,
+ killServers()
+ sys.exit(0)
+ print "ok"
+ print output
+
+def collocatedTest(toplevel, name):
+
+ testdir = os.path.join(toplevel, "test", name)
+ collocated = os.path.join(testdir, "collocated")
-def collocated():
print "starting collocated...",
- client, pid = start("./collocated")
- pids.append(pid)
- output = client.read()
+ collocatedPipe = os.popen(os.path.join(testdir, "collocated"))
+ output = collocatedPipe.read().strip()
if not output:
print "failed!"
- terminate(0)
- else:
- print "ok"
- print output,
+ sys.exit(0)
+ print "ok"
+ print output
diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h
index 885e45c7a07..0795655adf6 100644
--- a/cpp/include/Ice/Config.h
+++ b/cpp/include/Ice/Config.h
@@ -59,6 +59,9 @@ const bool bigendian = false;
#elif defined(__linux__) && defined(i386)
+# include <sys/types.h>
+# include <unistd.h>
+
# define ICE_API /**/
namespace Ice