test/rec: add tests for new SIML fetch failure behavior
This commit is contained in:
6
test/std/rec/simmSimlFail.db
Normal file
6
test/std/rec/simmSimlFail.db
Normal file
@@ -0,0 +1,6 @@
|
||||
# siml target doesn't exist
|
||||
record(ao, "ao-0") {
|
||||
field(SIML, "non-exist")
|
||||
field(HIGH, "1.5")
|
||||
field(HSV, "MINOR")
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <epicsTime.h>
|
||||
#include <epicsThread.h>
|
||||
#include <errlog.h>
|
||||
#include <alarm.h>
|
||||
|
||||
#include "recSup.h"
|
||||
#include "aiRecord.h"
|
||||
@@ -138,6 +139,38 @@ void testSimmSetup(void)
|
||||
testOk(precai->sdly == 0.345, "ai-3.SDLY = %g == 0.345", precai->sdly);
|
||||
}
|
||||
|
||||
/*
|
||||
* Invalid SIML link sets LINK/NO_ALARM if in NO_ALARM
|
||||
*/
|
||||
static
|
||||
void testSimlFail(void)
|
||||
{
|
||||
aoRecord *precao;
|
||||
|
||||
testDiag("##### Behavior for failing SIML #####");
|
||||
|
||||
precao = (aoRecord*)testdbRecordPtr("ao-0");
|
||||
/* before anything: UDF INVALID */
|
||||
testOk(precao->stat == UDF_ALARM, "ao-0.STAT = %u [%s] == %u [UDF]",
|
||||
precao->stat, epicsAlarmConditionStrings[precao->stat], UDF_ALARM);
|
||||
testOk(precao->sevr == INVALID_ALARM, "ao-0.SEVR = %u [%s] == %u [INVALID]",
|
||||
precao->sevr, epicsAlarmSeverityStrings[precao->sevr], INVALID_ALARM);
|
||||
|
||||
/* legal value: LINK NO_ALARM */
|
||||
testdbPutFieldOk("ao-0.VAL", DBR_DOUBLE, 1.0);
|
||||
testOk(precao->stat == LINK_ALARM, "ao-0.STAT = %u [%s] == %u [LINK]",
|
||||
precao->stat, epicsAlarmConditionStrings[precao->stat], LINK_ALARM);
|
||||
testOk(precao->sevr == NO_ALARM, "ao-0.SEVR = %u [%s] == %u [NO_ALARM]",
|
||||
precao->sevr, epicsAlarmSeverityStrings[precao->sevr], NO_ALARM);
|
||||
|
||||
/* HIGH/MINOR overrides */
|
||||
testdbPutFieldOk("ao-0.VAL", DBR_DOUBLE, 2.0);
|
||||
testOk(precao->stat == HIGH_ALARM, "ao-0.STAT = %u [%s] == %u [HIGH]",
|
||||
precao->stat, epicsAlarmConditionStrings[precao->stat], HIGH_ALARM);
|
||||
testOk(precao->sevr == MINOR_ALARM, "ao-0.SEVR = %u [%s] == %u [MINOR]",
|
||||
precao->sevr, epicsAlarmSeverityStrings[precao->sevr], MINOR_ALARM);
|
||||
}
|
||||
|
||||
/*
|
||||
* SIMM triggered SCAN swapping, by writing to SIMM and through SIML
|
||||
*/
|
||||
@@ -402,7 +435,7 @@ void testSimmDelay(const char *name,
|
||||
testdbPutFieldOk(namePROC, DBR_LONG, 0);
|
||||
testdbGetFieldEqual(namePACT, DBR_USHORT, 1);
|
||||
epicsTimeGetCurrent(&now);
|
||||
epicsThreadSleep(1.5*delay);
|
||||
epicsThreadSleep(1.75*delay);
|
||||
testdbGetFieldEqual(namePACT, DBR_USHORT, 0);
|
||||
testOk(epicsTimeLessThan(&now, mytime), "time stamp taken from second pass processing");
|
||||
|
||||
@@ -456,10 +489,11 @@ void testAllRecTypes(void)
|
||||
|
||||
MAIN(simmTest)
|
||||
{
|
||||
testPlan(0);
|
||||
testPlan(1176);
|
||||
startSimmTestIoc("simmTest.db");
|
||||
|
||||
testSimmSetup();
|
||||
testSimlFail();
|
||||
testAllRecTypes();
|
||||
|
||||
testIocShutdownOk();
|
||||
|
||||
@@ -27,4 +27,6 @@ file "simmTestHistogram.template" {
|
||||
}
|
||||
file "simmSetup.db" {
|
||||
{}
|
||||
file "simmSimlFail.db" {
|
||||
{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user