diff options
author | Michi Henning <michi@zeroc.com> | 2007-06-15 15:32:38 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2007-06-15 15:32:38 +1000 |
commit | d20a908a06e260c39bac12426495a943a9d1f50b (patch) | |
tree | b2aea880e028d343660285ea913c22d12667bbde /cpp/test/Ice/gc/Client.cpp | |
parent | Do not recreate ProcessI on refreshPublishedEndpoints (diff) | |
download | ice-d20a908a06e260c39bac12426495a943a9d1f50b.tar.bz2 ice-d20a908a06e260c39bac12426495a943a9d1f50b.tar.xz ice-d20a908a06e260c39bac12426495a943a9d1f50b.zip |
Bug 2257.
Diffstat (limited to 'cpp/test/Ice/gc/Client.cpp')
-rw-r--r-- | cpp/test/Ice/gc/Client.cpp | 17 |
1 files changed, 15 insertions, 2 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; |