more monitor testing

This commit is contained in:
Michael Davidsaver
2016-03-17 17:54:56 -04:00
parent 302d2ec0a3
commit 454b793b75
5 changed files with 41 additions and 0 deletions

View File

@ -256,6 +256,7 @@ public:
} else {
changed |= updated;
if(p_postone())
req = requester;
oflow = inoverflow = false;
@ -280,6 +281,7 @@ public:
} else {
changed |= updated;
if(p_postone())
req = requester;
oflow = inoverflow = false;

View File

@ -322,6 +322,7 @@ void PDBGroupMonitor::onStart()
}
pv->initial_waits = ievts;
pv->scratch.clear();
pv->scratch.set(0);
} else if(pv->initial_waits==0) {
// new subscriber and already had initial update
post();

View File

@ -86,6 +86,8 @@ struct TestMonitor {
testOk1(mreq->eventCnt==1);
pvd::MonitorElementPtr elem(mon->poll());
testOk1(!!elem.get());
if(!!elem.get()) testEqual(toString(*elem->changedBitSet), "{0}");
else testFail("oops");
testOk1(elem && elem->pvStructurePtr->getSubFieldT<pvd::PVInt>("x")->get()==1);
if(elem) mon->release(elem);

View File

@ -305,6 +305,8 @@ void testSingleMonitor(const PDBProvider::shared_pointer& prov)
e = mon.poll();
testOk1(!!e);
if(!!e) testEqual(toString(*e.elem->changedBitSet), "{1, 3, 4}");
else testFail("oops");
testFieldEqual<pvd::PVDouble>(e, "value", 11.0);
e = mon.poll();
@ -318,6 +320,8 @@ void testSingleMonitor(const PDBProvider::shared_pointer& prov)
e = mon.poll();
testOk1(!!e);
if(!!e) testEqual(toString(*e.elem->changedBitSet), "{11, 12, 14, 15, 17, 18}");
else testFail("oops");
testFieldEqual<pvd::PVDouble>(e, "display.limitHigh", 50.0);
e = mon.poll();
@ -346,6 +350,8 @@ void testGroupMonitor(const PDBProvider::shared_pointer& prov)
e = mon.poll();
testOk1(!!e);
if(!!e) testEqual(toString(*e.elem->changedBitSet), "{0, 2, 4, 5, 12, 13, 15, 16, 18, 19, 22, 24, 25, 32, 33, 35, 36, 38, 39, 42, 44, 45, 52, 53, 55, 56, 58, 59, 62, 64, 65, 72, 73, 75, 76, 78, 79}");
else testFail("oops");
testFieldEqual<pvd::PVDouble>(e, "fld1.value", 3.0);
testFieldEqual<pvd::PVInt>(e, "fld2.value", 30);
testFieldEqual<pvd::PVDouble>(e, "fld3.value", 4.0);
@ -354,6 +360,22 @@ void testGroupMonitor(const PDBProvider::shared_pointer& prov)
testFieldEqual<pvd::PVDouble>(e, "fld1.display.limitLow", -200.0);
testFieldEqual<pvd::PVDouble>(e, "fld2.display.limitHigh", 2147483647.0);
testFieldEqual<pvd::PVDouble>(e, "fld2.display.limitLow", -2147483648.0);
e = mon.poll();
testOk1(!e);
testdbPutFieldOk("rec3", DBR_DOUBLE, 32.0);
testDiag("Wait for event");
testOk1(mon.monreq->waitForEvent());
testDiag("event");
e = mon.poll();
testOk1(!!e);
if(!!e) testEqual(toString(*e.elem->changedBitSet), "{2, 4, 5}");
else testFail("oops");
testFieldEqual<pvd::PVDouble>(e, "fld1.value", 32.0);
}
} // namespace

View File

@ -75,6 +75,9 @@ void testScalar()
pvif_li->put(mask, DBE_VALUE|DBE_ALARM|DBE_PROPERTY, NULL);
dbScanUnlock((dbCommon*)prec_li);
testEqual(toString(mask), "{2, 4, 5, 12, 13, 15, 16, 18, 19}");
mask.clear();
dbScanLock((dbCommon*)prec_ai);
prec_ai->time.secPastEpoch = 0x12345678;
prec_ai->time.nsec = 12345678;
@ -82,12 +85,18 @@ void testScalar()
pvif_ai_rval->put(mask, DBE_VALUE|DBE_ALARM|DBE_PROPERTY, NULL);
dbScanUnlock((dbCommon*)prec_ai);
testEqual(toString(mask), "{22, 24, 25, 32, 33, 35, 36, 38, 39, 42, 44, 45, 52, 53, 55, 56, 58, 59}");
mask.clear();
dbScanLock((dbCommon*)prec_mbbi);
prec_mbbi->time.secPastEpoch = 0x12345678;
prec_mbbi->time.nsec = 12345678;
pvif_mbbi->put(mask, DBE_VALUE|DBE_ALARM|DBE_PROPERTY, NULL);
dbScanUnlock((dbCommon*)prec_mbbi);
testEqual(toString(mask), "{63, 64, 66, 67}");
mask.clear();
testFieldEqual<pvd::PVInt>(root, "li.value", 102042);
testFieldEqual<pvd::PVInt>(root, "li.alarm.severity", 1);
testFieldEqual<pvd::PVLong>(root, "li.timeStamp.secondsPastEpoch", 0x12345678);
@ -130,6 +139,11 @@ void testScalar()
root->getSubFieldT<pvd::PVDouble>("ai.value")->put(44.4);
root->getSubFieldT<pvd::PVInt>("mbbi.value.index")->put(2);
mask.clear();
mask.set(root->getSubFieldT<pvd::PVInt>("li.value")->getFieldOffset());
mask.set(root->getSubFieldT<pvd::PVDouble>("ai.value")->getFieldOffset());
mask.set(root->getSubFieldT<pvd::PVInt>("mbbi.value.index")->getFieldOffset());
dbScanLock((dbCommon*)prec_li);
pvif_li->get(mask);
testOk1(prec_li->val==102043);