fixups
This commit is contained in:
@@ -162,6 +162,90 @@ struct TestMonitor {
|
||||
mon->destroy();
|
||||
mon2->destroy();
|
||||
}
|
||||
|
||||
void test_ds_no_start()
|
||||
{
|
||||
testDiag("Test downstream monitor never start()s");
|
||||
|
||||
TestChannelMonitorRequester::shared_pointer mreq(new TestChannelMonitorRequester);
|
||||
pvd::Monitor::shared_pointer mon(client->createMonitor(mreq, makeRequest(2)));
|
||||
if(!mon) testAbort("Failed to create monitor");
|
||||
|
||||
upstream->dispatch(); // trigger monitorEvent() from upstream to gateway
|
||||
|
||||
testOk1(mreq->eventCnt==0);
|
||||
testOk1(!mon->poll());
|
||||
|
||||
pvd::BitSet changed;
|
||||
changed.set(1);
|
||||
test1_x=50;
|
||||
test1->post(changed, false);
|
||||
test1_x=51;
|
||||
test1->post(changed, false);
|
||||
test1_x=52;
|
||||
test1->post(changed, false);
|
||||
test1_x=53;
|
||||
test1->post(changed);
|
||||
|
||||
testOk1(!mon->poll());
|
||||
|
||||
mon->destroy();
|
||||
}
|
||||
|
||||
void test_overflow_upstream()
|
||||
{
|
||||
testDiag("Check behavour when upstream monitor overflows (mostly transparent)");
|
||||
|
||||
TestChannelMonitorRequester::shared_pointer mreq(new TestChannelMonitorRequester);
|
||||
pvd::Monitor::shared_pointer mon(client->createMonitor(mreq, makeRequest(2)));
|
||||
if(!mon) testAbort("Failed to create monitor");
|
||||
|
||||
testOk1(mreq->eventCnt==0);
|
||||
testOk1(mon->start().isSuccess());
|
||||
upstream->dispatch(); // trigger monitorEvent() from upstream to gateway
|
||||
testOk1(mreq->eventCnt==1);
|
||||
|
||||
testDiag("poll initial update");
|
||||
pvd::MonitorElementPtr elem(mon->poll());
|
||||
testOk1(!!elem.get());
|
||||
if(elem) mon->release(elem);
|
||||
|
||||
pvd::BitSet changed;
|
||||
changed.set(1);
|
||||
test1_x=50;
|
||||
test1->post(changed, false);
|
||||
test1_x=51;
|
||||
test1->post(changed, false);
|
||||
test1_x=52;
|
||||
test1->post(changed, false);
|
||||
test1_x=53;
|
||||
test1->post(changed);
|
||||
|
||||
elem = mon->poll();
|
||||
testOk1(!!elem.get());
|
||||
|
||||
testOk1(elem && elem->pvStructurePtr->getSubFieldT<pvd::PVInt>("x")->get()==50);
|
||||
testOk1(elem && elem->changedBitSet->nextSetBit(0)==1);
|
||||
testOk1(elem && elem->changedBitSet->nextSetBit(2)==-1);
|
||||
testOk1(elem && elem->overrunBitSet->nextSetBit(0)==-1);
|
||||
|
||||
if(elem) mon->release(elem);
|
||||
|
||||
elem = mon->poll();
|
||||
testOk1(!!elem.get());
|
||||
|
||||
testOk1(elem && elem->pvStructurePtr->getSubFieldT<pvd::PVInt>("x")->get()==53);
|
||||
testOk1(elem && elem->changedBitSet->nextSetBit(0)==1);
|
||||
testOk1(elem && elem->changedBitSet->nextSetBit(2)==-1);
|
||||
testOk1(elem && elem->overrunBitSet->nextSetBit(0)==1);
|
||||
testOk1(elem && elem->overrunBitSet->nextSetBit(2)==-1);
|
||||
|
||||
if(elem) mon->release(elem);
|
||||
|
||||
testOk1(!mon->poll());
|
||||
|
||||
mon->destroy();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@@ -171,6 +255,8 @@ MAIN(testmon)
|
||||
testPlan(0);
|
||||
TEST_METHOD(TestMonitor, test_event);
|
||||
TEST_METHOD(TestMonitor, test_share);
|
||||
TEST_METHOD(TestMonitor, test_ds_no_start);
|
||||
TEST_METHOD(TestMonitor, test_overflow_upstream);
|
||||
TestProvider::testCounts();
|
||||
int ok = 1;
|
||||
size_t temp;
|
||||
|
||||
Reference in New Issue
Block a user