summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-08-21 19:53:51 +0000
committerMarc Laukien <marc@zeroc.com>2001-08-21 19:53:51 +0000
commitb350b65a5be2b2b320953edb2d0283bbac7909eb (patch)
treeaa86af74cb20090d4d18d9803a485739e0c24708 /cpp/test
parent--Ice... (diff)
downloadice-b350b65a5be2b2b320953edb2d0283bbac7909eb.tar.bz2
ice-b350b65a5be2b2b320953edb2d0283bbac7909eb.tar.xz
ice-b350b65a5be2b2b320953edb2d0283bbac7909eb.zip
Ice.PrintProcessId, run.py cleanup
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Ice/exceptions/Server.cpp25
-rwxr-xr-xcpp/test/Ice/exceptions/run.py8
-rw-r--r--cpp/test/Ice/faultTolerance/Server.cpp13
-rw-r--r--cpp/test/Ice/faultTolerance/TestI.cpp4
-rwxr-xr-xcpp/test/Ice/faultTolerance/run.py18
-rw-r--r--cpp/test/Ice/inheritance/Server.cpp25
-rwxr-xr-xcpp/test/Ice/inheritance/run.py8
-rw-r--r--cpp/test/Ice/locationForward/Server.cpp13
-rwxr-xr-xcpp/test/Ice/locationForward/run.py24
-rw-r--r--cpp/test/Ice/operations/Server.cpp25
-rwxr-xr-xcpp/test/Ice/operations/run.py8
-rw-r--r--cpp/test/IcePack/simple/Server.cpp25
-rwxr-xr-xcpp/test/IcePack/simple/run.py14
-rwxr-xr-xcpp/test/Slice/errorDetection/run.py12
14 files changed, 52 insertions, 170 deletions
diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp
index 8b17fadd310..3789d6fa6b2 100644
--- a/cpp/test/Ice/exceptions/Server.cpp
+++ b/cpp/test/Ice/exceptions/Server.cpp
@@ -13,39 +13,14 @@
using namespace std;
-void
-usage(const char* n)
-{
- cerr << "Usage: " << n << " [--pid]\n";
-}
-
int
run(int argc, char* argv[], Ice::CommunicatorPtr communicator)
{
- bool pid = false;
- for (int i = 1; i < argc; ++i)
- {
- if(strcmp(argv[i], "--pid") == 0)
- {
- pid = true;
- }
- else
- {
- cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- }
-
string endpts("tcp -p 12345 -t 2000");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts);
Ice::ObjectPtr object = new ThrowerI(adapter);
adapter->add(object, "thrower");
adapter->activate();
- if (pid)
- {
- cout << getpid() << endl;
- }
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
diff --git a/cpp/test/Ice/exceptions/run.py b/cpp/test/Ice/exceptions/run.py
index c6390222383..2873635c052 100755
--- a/cpp/test/Ice/exceptions/run.py
+++ b/cpp/test/Ice/exceptions/run.py
@@ -11,16 +11,16 @@
import os, sys
-for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]:
- if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")):
break
else:
raise "can't find toplevel directory!"
-sys.path.append(os.path.join(toplevel, "config"))
+sys.path.append(os.path.normpath(toplevel + "/config"))
import TestUtil
-name = os.path.join("Ice", "exceptions")
+name = "Ice/exceptions"
TestUtil.clientServerTest(toplevel, name)
TestUtil.collocatedTest(toplevel, name)
sys.exit(1)
diff --git a/cpp/test/Ice/faultTolerance/Server.cpp b/cpp/test/Ice/faultTolerance/Server.cpp
index 71eb516e31e..61795f3b5b8 100644
--- a/cpp/test/Ice/faultTolerance/Server.cpp
+++ b/cpp/test/Ice/faultTolerance/Server.cpp
@@ -17,21 +17,16 @@ using namespace std;
void
usage(const char* n)
{
- cerr << "Usage: " << n << " [--pid] port\n";
+ cerr << "Usage: " << n << " port\n";
}
int
run(int argc, char* argv[], Ice::CommunicatorPtr communicator)
{
int port = 0;
- bool pid = false;
for (int i = 1; i < argc; ++i)
{
- if(strcmp(argv[i], "--pid") == 0)
- {
- pid = true;
- }
- else if (argv[i][0] == '-')
+ if (argv[i][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
usage(argv[0]);
@@ -61,10 +56,6 @@ run(int argc, char* argv[], Ice::CommunicatorPtr communicator)
Ice::ObjectPtr object = new TestI(adapter);
adapter->add(object, "test");
adapter->activate();
- if (pid)
- {
- cout << getpid() << endl;
- }
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
diff --git a/cpp/test/Ice/faultTolerance/TestI.cpp b/cpp/test/Ice/faultTolerance/TestI.cpp
index 74a5e5d37a1..ead6826629a 100644
--- a/cpp/test/Ice/faultTolerance/TestI.cpp
+++ b/cpp/test/Ice/faultTolerance/TestI.cpp
@@ -37,5 +37,9 @@ TestI::nonmutatingAbort()
Ice::Int
TestI::pid()
{
+#ifdef WIN32
+ return _getpid();
+#else
return getpid();
+#endif
}
diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py
index 13f5b0a432b..884b1360fdf 100755
--- a/cpp/test/Ice/faultTolerance/run.py
+++ b/cpp/test/Ice/faultTolerance/run.py
@@ -11,20 +11,18 @@
import os, sys
-for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]:
- if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")):
break
else:
raise "can't find toplevel directory!"
-sys.path.append(os.path.join(toplevel, "config"))
+sys.path.append(os.path.normpath(toplevel + "/config"))
import TestUtil
-name = os.path.join("Ice", "faultTolerance")
-
-testdir = os.path.join(toplevel, "test", name)
-server = os.path.join(testdir, "server")
-client = os.path.join(testdir, "client")
+testdir = os.path.normpath(toplevel + "/test/Ice/faultTolerance")
+server = os.path.normpath(testdir + "/server")
+client = os.path.normpath(testdir + "/client")
num = 8
base = 12340
@@ -32,7 +30,7 @@ base = 12340
serverPipes = { }
for i in range(0, num):
print "starting server #%d..." % (i + 1),
- serverPipes[i] = os.popen(os.path.join(testdir, "server --pid %d" % (base + i)))
+ serverPipes[i] = os.popen(server + " --Ice.PrintProcessId %d" % (base + i))
output = serverPipes[i].readline().strip()
if not output:
print "failed!"
@@ -44,7 +42,7 @@ print "starting client...",
ports = ""
for i in range(0, num):
ports = "%s %d" % (ports, base + i)
-clientPipe = os.popen(os.path.join(testdir, "client" + ports))
+clientPipe = os.popen(client + " " + ports)
output = clientPipe.readline()
if not output:
print "failed!"
diff --git a/cpp/test/Ice/inheritance/Server.cpp b/cpp/test/Ice/inheritance/Server.cpp
index af907c9e1e9..9468768ebfd 100644
--- a/cpp/test/Ice/inheritance/Server.cpp
+++ b/cpp/test/Ice/inheritance/Server.cpp
@@ -13,39 +13,14 @@
using namespace std;
-void
-usage(const char* n)
-{
- cerr << "Usage: " << n << " [--pid]\n";
-}
-
int
run(int argc, char* argv[], Ice::CommunicatorPtr communicator)
{
- bool pid = false;
- for (int i = 1; i < argc; ++i)
- {
- if(strcmp(argv[i], "--pid") == 0)
- {
- pid = true;
- }
- else
- {
- cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- }
-
string endpts("tcp -p 12345 -t 2000");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts);
Ice::ObjectPtr object = new InitialI(adapter);
adapter->add(object, "initial");
adapter->activate();
- if (pid)
- {
- cout << getpid() << endl;
- }
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
diff --git a/cpp/test/Ice/inheritance/run.py b/cpp/test/Ice/inheritance/run.py
index 11efe6c5045..f687cef2beb 100755
--- a/cpp/test/Ice/inheritance/run.py
+++ b/cpp/test/Ice/inheritance/run.py
@@ -11,16 +11,16 @@
import os, sys
-for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]:
- if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")):
break
else:
raise "can't find toplevel directory!"
-sys.path.append(os.path.join(toplevel, "config"))
+sys.path.append(os.path.normpath(toplevel + "/config"))
import TestUtil
-name = os.path.join("Ice", "inheritance")
+name = "Ice/inheritance"
TestUtil.clientServerTest(toplevel, name)
TestUtil.collocatedTest(toplevel, name)
sys.exit(1)
diff --git a/cpp/test/Ice/locationForward/Server.cpp b/cpp/test/Ice/locationForward/Server.cpp
index 9e2878bbbd0..2157d7c9556 100644
--- a/cpp/test/Ice/locationForward/Server.cpp
+++ b/cpp/test/Ice/locationForward/Server.cpp
@@ -17,22 +17,17 @@ using namespace std;
void
usage(const char* n)
{
- cerr << "Usage: " << n << " [--pid] [--fwd reference] port\n";
+ cerr << "Usage: " << n << " [--fwd reference] port\n";
}
int
run(int argc, char* argv[], Ice::CommunicatorPtr communicator)
{
int port = 0;
- bool pid = false;
Ice::ObjectPrx fwd;
for (int i = 1; i < argc; ++i)
{
- if(strcmp(argv[i], "--pid") == 0)
- {
- pid = true;
- }
- else if (strcmp(argv[i], "--fwd") == 0)
+ if (strcmp(argv[i], "--fwd") == 0)
{
if (i + 1 >= argc)
{
@@ -73,10 +68,6 @@ run(int argc, char* argv[], Ice::CommunicatorPtr communicator)
Ice::ObjectPtr object = new TestI(adapter, fwd);
adapter->add(object, "test");
adapter->activate();
- if (pid)
- {
- cout << getpid() << endl;
- }
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
diff --git a/cpp/test/Ice/locationForward/run.py b/cpp/test/Ice/locationForward/run.py
index f09af503ef4..3685b9f7c31 100755
--- a/cpp/test/Ice/locationForward/run.py
+++ b/cpp/test/Ice/locationForward/run.py
@@ -11,20 +11,18 @@
import os, sys
-for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]:
- if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")):
break
else:
raise "can't find toplevel directory!"
-sys.path.append(os.path.join(toplevel, "config"))
+sys.path.append(os.path.normpath(toplevel + "/config"))
import TestUtil
-name = os.path.join("Ice", "locationForward")
-
-testdir = os.path.join(toplevel, "test", name)
-server = os.path.join(testdir, "server")
-client = os.path.join(testdir, "client")
+testdir = os.path.normpath(toplevel + "/test/Ice/locationForward")
+server = os.path.normpath(testdir + "/server")
+client = os.path.normpath(testdir + "/client")
num = 5
base = 12340
@@ -33,10 +31,10 @@ serverPipes = { }
for i in range(0, num):
print "starting server #%d..." % (i + 1),
if i + 1 < num:
- s = "server --pid --fwd \"test:tcp -t 2000 -p %d\" %d" % ((base + i + 1), (base + i))
+ s = "--Ice.PrintProcessId --fwd \"test:tcp -t 2000 -p %d\" %d" % ((base + i + 1), (base + i))
else:
- s = "server --pid %d" % (base + i)
- serverPipes[i] = os.popen(os.path.join(testdir, s))
+ s = "--Ice.PrintProcessId %d" % (base + i)
+ serverPipes[i] = os.popen(server + " " + s)
output = serverPipes[i].readline().strip()
if not output:
print "failed!"
@@ -45,8 +43,8 @@ for i in range(0, num):
print "ok"
print "starting client...",
-s = "client %d %d" % (base, (base + num - 1))
-clientPipe = os.popen(os.path.join(testdir, s))
+s = "%d %d" % (base, (base + num - 1))
+clientPipe = os.popen(client + " " + s)
output = clientPipe.readline()
if not output:
print "failed!"
diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp
index 634b675aa72..009addc9d65 100644
--- a/cpp/test/Ice/operations/Server.cpp
+++ b/cpp/test/Ice/operations/Server.cpp
@@ -13,39 +13,14 @@
using namespace std;
-void
-usage(const char* n)
-{
- cerr << "Usage: " << n << " [--pid]\n";
-}
-
int
run(int argc, char* argv[], Ice::CommunicatorPtr communicator)
{
- bool pid = false;
- for (int i = 1; i < argc; ++i)
- {
- if(strcmp(argv[i], "--pid") == 0)
- {
- pid = true;
- }
- else
- {
- cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- }
-
string endpts("tcp -p 12345 -t 2000");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts);
Ice::ObjectPtr object = new MyDerivedClassI(adapter);
adapter->add(object, "test");
adapter->activate();
- if (pid)
- {
- cout << getpid() << endl;
- }
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
diff --git a/cpp/test/Ice/operations/run.py b/cpp/test/Ice/operations/run.py
index 166c21d0430..4117811f191 100755
--- a/cpp/test/Ice/operations/run.py
+++ b/cpp/test/Ice/operations/run.py
@@ -11,16 +11,16 @@
import os, sys
-for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]:
- if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")):
break
else:
raise "can't find toplevel directory!"
-sys.path.append(os.path.join(toplevel, "config"))
+sys.path.append(os.path.normpath(toplevel + "/config"))
import TestUtil
-name = os.path.join("Ice", "operations")
+name = "Ice/operations"
TestUtil.clientServerTest(toplevel, name)
TestUtil.collocatedTest(toplevel, name)
sys.exit(1)
diff --git a/cpp/test/IcePack/simple/Server.cpp b/cpp/test/IcePack/simple/Server.cpp
index 1099747e251..075d4a084f4 100644
--- a/cpp/test/IcePack/simple/Server.cpp
+++ b/cpp/test/IcePack/simple/Server.cpp
@@ -13,39 +13,14 @@
using namespace std;
-void
-usage(const char* n)
-{
- cerr << "Usage: " << n << " [--pid]\n";
-}
-
int
run(int argc, char* argv[], Ice::CommunicatorPtr communicator)
{
- bool pid = false;
- for (int i = 1; i < argc; ++i)
- {
- if(strcmp(argv[i], "--pid") == 0)
- {
- pid = true;
- }
- else
- {
- cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- }
-
string endpts("tcp -p 12345 -t 2000");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts);
Ice::ObjectPtr object = new TestI(adapter);
adapter->add(object, "test");
adapter->activate();
- if (pid)
- {
- cout << getpid() << endl;
- }
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
diff --git a/cpp/test/IcePack/simple/run.py b/cpp/test/IcePack/simple/run.py
index f4276492f29..01973ddd333 100755
--- a/cpp/test/IcePack/simple/run.py
+++ b/cpp/test/IcePack/simple/run.py
@@ -11,20 +11,20 @@
import os, sys
-for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]:
- if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")):
break
else:
raise "can't find toplevel directory!"
-sys.path.append(os.path.join(toplevel, "config"))
+sys.path.append(os.path.normpath(toplevel + "/config"))
import TestUtil
-icePack = os.path.join(toplevel, "bin", "icepack")
-icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin")
+icePack = os.path.normpath(toplevel + "/bin/icepack")
+icePackAdmin = os.path.normpath(toplevel + "/bin/icepackadmin")
print "starting icepack...",
-icePackPipe = os.popen(icePack + ' --nowarn --pid' + \
+icePackPipe = os.popen(icePack + ' --Ice.PrintProcessId --nowarn' + \
' "--Ice.Adapter.Forward.Endpoints=tcp -p 12346 -t 2000"' + \
' "--Ice.Adapter.Admin.Endpoints=tcp -p 12347 -t 2000"')
output = icePackPipe.readline().strip()
@@ -41,7 +41,7 @@ icePackAdminPipe = os.popen(icePackAdmin + \
icePackAdminPipe.close()
print "ok"
-name = os.path.join("IcePack", "simple")
+name = "IcePack/simple"
TestUtil.clientServerTest(toplevel, name)
TestUtil.collocatedTest(toplevel, name)
diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py
index 895e5cf397a..713818fa60d 100755
--- a/cpp/test/Slice/errorDetection/run.py
+++ b/cpp/test/Slice/errorDetection/run.py
@@ -11,14 +11,14 @@
import os, sys, re
-for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]:
- if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")):
break
else:
raise "can't find toplevel directory!"
-directory = os.path.join(toplevel, "test", "Slice", "errorDetection")
-slice2cpp = os.path.join(toplevel, "bin", "slice2cpp")
+directory = os.path.normpath(toplevel + "/test/Slice/errorDetection")
+slice2cpp = os.path.normpath(toplevel + "/bin/slice2cpp")
regex1 = re.compile(r".ice$", re.IGNORECASE)
files = []
@@ -30,9 +30,9 @@ for file in files:
print file + "...",
- stdin, stdout, stderr = os.popen3(slice2cpp + " " + os.path.join(directory, file))
+ stdin, stdout, stderr = os.popen3(slice2cpp + " " + os.path.normpath(directory + "/" + file))
lines1 = stderr.readlines()
- lines2 = open(os.path.join(directory, regex1.sub(".err", file)), "r").readlines()
+ lines2 = open(os.path.normpath(directory + "/" + regex1.sub(".err", file)), "r").readlines()
if len(lines1) != len(lines2):
print "failed!"