summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Ice/gc/Client.cpp17
-rwxr-xr-xcpp/test/Ice/gc/run.py5
2 files changed, 19 insertions, 3 deletions
diff --git a/cpp/test/Ice/gc/Client.cpp b/cpp/test/Ice/gc/Client.cpp
index 86d599a91fb..61d77fb93fb 100644
--- a/cpp/test/Ice/gc/Client.cpp
+++ b/cpp/test/Ice/gc/Client.cpp
@@ -256,6 +256,12 @@ public:
int
MyApplication::run(int argc, char* argv[])
{
+ if(argc < 2 || argc > 3)
+ {
+ cerr << "usage: " << argv[0] << " [testoptions] seedfile [seed]" << endl;
+ return EXIT_FAILURE;
+ }
+
cout << "testing single instance... " << flush;
{
NPtr n = new N;
@@ -607,10 +613,17 @@ MyApplication::run(int argc, char* argv[])
#endif
cout << "testing for race conditions... " << flush;
+ string seedfile = argv[1];
+ ofstream file(seedfile.c_str());
+ if(!file)
+ {
+ cerr << argv[0] << ": cannot open `" << seedfile << "' for writing" << endl;
+ return EXIT_FAILURE;
+ }
::IceUtil::Time t = ::IceUtil::Time::now();
- int seed = argc > 1 ? atoi(argv[1]) : static_cast<int>(t.toMilliSeconds());
- ofstream file("seed");
+ int seed = argc > 2 ? atoi(argv[2]) : static_cast<int>(t.toMilliSeconds());
file << seed << "\n";
+ file.close();
srand(seed);
typedef ::IceUtil::Handle<GarbageProducer> GarbageThreadPtr;
diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py
index 9eea4f939ee..0430fd0fe33 100755
--- a/cpp/test/Ice/gc/run.py
+++ b/cpp/test/Ice/gc/run.py
@@ -26,7 +26,8 @@ testdir = os.path.join(toplevel, "test", name)
client = os.path.join(testdir, "client")
print "starting client...",
-clientPipe = os.popen(client + TestUtil.clientOptions + " 2>&1")
+seedfile = testdir + "/seed"
+clientPipe = os.popen(client + TestUtil.clientOptions + " " + seedfile + " 2>&1")
print "ok"
TestUtil.printOutputFromPipe(clientPipe)
@@ -36,4 +37,6 @@ clientStatus = TestUtil.closePipe(clientPipe)
if clientStatus:
sys.exit(1)
+os.remove(seedfile)
+
sys.exit(0)