summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/IceStorm/stress/Subscriber.cpp60
-rwxr-xr-xcpp/test/IceStorm/stress/run.py24
2 files changed, 45 insertions, 39 deletions
diff --git a/cpp/test/IceStorm/stress/Subscriber.cpp b/cpp/test/IceStorm/stress/Subscriber.cpp
index 50b49962fab..79c28b12cbb 100644
--- a/cpp/test/IceStorm/stress/Subscriber.cpp
+++ b/cpp/test/IceStorm/stress/Subscriber.cpp
@@ -205,7 +205,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
return EXIT_FAILURE;
}
- IceStorm::QoS qos;
+ IceStorm::QoS cmdLineQos;
vector<string> sqos = opts.argVec("qos");
for(vector<string>::const_iterator q = sqos.begin(); q != sqos.end(); ++q)
@@ -216,7 +216,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
cerr << argv[0] << ": parse error: no , in QoS" << endl;
return EXIT_FAILURE;
}
- qos[q->substr(0, off)] = q->substr(off+1);
+ cmdLineQos[q->substr(0, off)] = q->substr(off+1);
}
bool slow = opts.isSet("slow");
@@ -253,13 +253,9 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
vector<Subscription> subs;
- ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SubscriberAdapter", "default");
-
- string reliability = "";
- EventIPtr servant;
if(erratic)
{
- for(int i = 0 ; i< erraticNum; ++i)
+ for(int i = 0 ; i < erraticNum; ++i)
{
ostringstream os;
os << "SubscriberAdapter" << i;
@@ -272,38 +268,26 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
}
else if(slow)
{
- servant = new SlowEventI(communicator, events);
+ Subscription item;
+ item.adapter = communicator->createObjectAdapterWithEndpoints("SubscriberAdapter", "default");
+ item.servant = new SlowEventI(communicator, events);
+ item.qos = cmdLineQos;
+ subs.push_back(item);
}
else
{
- map<string, string>::iterator p = qos.find("reliability");
- if(p != qos.end())
- {
- reliability = p->second;
- if(reliability != "ordered")
- {
- qos.erase(p);
- }
- }
- if(reliability == "ordered")
+ Subscription item;
+ item.adapter = communicator->createObjectAdapterWithEndpoints("SubscriberAdapter", "default");
+ item.qos = cmdLineQos;
+ map<string, string>::const_iterator p = item.qos.find("reliability");
+ if(p != item.qos.end() && p->second == "ordered")
{
- servant = new OrderEventI(communicator, events);
+ item.servant = new OrderEventI(communicator, events);
}
else
{
- servant = new CountEventI(communicator, events);
+ item.servant = new CountEventI(communicator, events);
}
- }
-
- //
- // Activate the servants.
- //
- if(subs.empty())
- {
- Subscription item;
- item.adapter = adapter;
- item.servant = servant;
- item.qos = qos;
subs.push_back(item);
}
@@ -322,10 +306,22 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
for(vector<Subscription>::iterator p = subs.begin(); p != subs.end(); ++p)
{
p->obj = p->adapter->addWithUUID(p->servant);
- if(reliability == "twoway" || reliability == "ordered")
+
+ IceStorm::QoS qos;
+ string reliability = "";
+ IceStorm::QoS::const_iterator q = p->qos.find("reliability");
+ if(q != p->qos.end())
+ {
+ reliability = q->second;
+ }
+ if(reliability == "twoway")
{
// Do nothing.
}
+ else if(reliability == "ordered")
+ {
+ qos["reliability"] = "ordered";
+ }
else if(reliability == "batch")
{
p->obj = p->obj->ice_batchOneway();
diff --git a/cpp/test/IceStorm/stress/run.py b/cpp/test/IceStorm/stress/run.py
index 0bf39f16d9c..d73eec19349 100755
--- a/cpp/test/IceStorm/stress/run.py
+++ b/cpp/test/IceStorm/stress/run.py
@@ -66,7 +66,8 @@ def doTest(subOpts, pubOpts):
if type(subOpts) != type([]):
subOpts = [ subOpts ]
for opts in subOpts:
- command = subscriber + TestUtil.clientServerOptions + r' ' + opts
+ # We don't want the subscribers to time out.
+ command = subscriber + TestUtil.clientServerOptions + r' --Ice.ServerIdleTime=0 ' + opts
if TestUtil.debug:
print "(" + command + ")",
sys.stdout.flush()
@@ -90,7 +91,7 @@ def doTest(subOpts, pubOpts):
for p in subscriberPipes:
try:
sys.stdout.flush()
- subscriberStatus = TestUtil.specificServerStatus(p, 30)
+ subscriberStatus = TestUtil.specificServerStatus(p)
except:
print "(subscriber failed)",
return 1
@@ -262,17 +263,26 @@ stopServers(server1, server2)
server1, server2 = startServers()
print "Sending 20000 unordered events with erratic subscriber... ",
-status = doTest(['--erratic 10 --events 20000' + iceStormReference, '--events 20000 ' + iceStormReference], '--events 20000 --oneway')
+status = doTest(\
+ [ '--erratic 5 --events 20000' + iceStormReference, \
+ '--erratic 5 --qos "reliability,ordered" --events 20000' + iceStormReference, \
+ '--events 20000' + iceStormReference], \
+ '--events 20000 --oneway')
if status:
print "failed!"
TestUtil.killServers()
sys.exit(1)
print "ok"
-print "Sending 20000 unordered events with erratic subscriber across a link... ",
-status = doTest(['--erratic 10 --events 20000' + iceStormReference, '--events 20000 ' + iceStormReference, \
- '--erratic 10 --events 20000' + iceStormReference2, '--events 20000 ' + iceStormReference2], \
- '--events 20000 --oneway')
+print "Sending 5000 unordered events with erratic subscriber across a link... ",
+status = doTest( \
+ [ '--events 5000' + iceStormReference, \
+ '--erratic 3 --qos "reliability,ordered" --events 5000 ' + iceStormReference, \
+ '--erratic 3 --events 5000 ' + iceStormReference, \
+ '--erratic 3 --events 5000 ' + iceStormReference2, \
+ '--erratic 3 --qos "reliability,ordered" --events 5000 ' + iceStormReference2, \
+ '--events 5000' + iceStormReference2 ], \
+ '--events 5000 --oneway ')
if status:
print "failed!"
TestUtil.killServers()