Add soft-channel tests for local dbCa links, both input and output

Update test descriptions.
Renamed records to match their group number.
103 more tests, but some could fail on a busy system...
This commit is contained in:
Andrew Johnson
2018-01-18 23:16:42 -06:00
parent f5cd555383
commit 1daab5fb35
2 changed files with 162 additions and 33 deletions

View File

@@ -11,6 +11,7 @@
#include "dbStaticLib.h"
#include "dbTest.h"
#include "dbUnitTest.h"
#include "epicsThread.h"
#include "errlog.h"
#include "registryFunction.h"
#include "subRecord.h"
@@ -39,10 +40,10 @@ void doProcess(const char *rec)
testdbPutFieldOk(proc, DBR_CHAR, 1);
}
/* Group 0 are all soft-channel input records with INP being a DB link
/* Group 0 are soft-channel input records with INP being a DB or CA link
* to the PV 'source'. Their VAL fields all start out with the default
* value for the type, i.e. 0 or an empty string. Triggering record
* processing should read the integer value from the 'source' PV.
* processing reads the value from the 'source' PV.
*/
static
@@ -50,14 +51,22 @@ void testGroup0(void)
{
const char ** rec;
const char * records[] = {
"ai0", "bi0", "di0", "ii0", "li0", "lsi0", "mi0", "si0", NULL
"ai0", "bi0", "di0", "ii0", "li0", "lsi0", "mi0", "si0",
"ai0c", "bi0c", "di0c", "ii0c", "li0c", "lsi0c", "mi0c", "si0c",
NULL
};
testDiag("============ Starting %s ============", EPICS_FUNCTION);
testdbPutFieldOk("source", DBR_LONG, 1);
/* The above put sends CA monitors to all of the CA links, but
* doesn't trigger record processing (the links are not CP/CPP).
* How could we wait until all of those monitors have arrived,
* instead of just waiting for an arbitrary time period?
*/
epicsThreadSleep(1.0); /* FIXME: Wait here? */
for (rec = records; *rec; rec++) {
if (strcmp(*rec, "lsi0") != 0)
if (strncmp(*rec, "lsi0", 4) != 0)
testdbGetFieldEqual(*rec, DBR_LONG, 0);
checkDtyp(*rec);
doProcess(*rec);
@@ -65,6 +74,7 @@ void testGroup0(void)
}
testdbPutFieldOk("source", DBR_LONG, 0);
epicsThreadSleep(1.0); /* FIXME: Wait here as above */
for (rec = records; *rec; rec++) {
doProcess(*rec);
testdbGetFieldEqual(*rec, DBR_LONG, 0);
@@ -129,6 +139,7 @@ static
long destSubr(subRecord *prec)
{
dest = prec->val;
prec->val = -1;
return 0;
}
@@ -138,20 +149,25 @@ void checkOutput(const char *rec, int value)
testDiag("Checking record '%s'", rec);
testdbPutFieldOk(rec, DBR_LONG, value);
/* Even with a local CA link, the dest record gets processed in
* the context of this thread (i.e. immediately). TPRO confirms.
*/
testOk(dest == value, "value %d output -> %d", value, dest);
}
/* Group 3 are all soft-channel output records with OUT being a DB link
* to the PV 'dest' with PP. Putting a value to the record writes that
* value to 'dest' and processes it.
/* Group 3 are all soft-channel output records with OUT being a DB or
* local CA link to the subRecord 'dest'; DB links have the PP flag,
* for CA links the VAL field is marked PP. Putting a value to the
* output record writes that value to 'dest'.
*/
static
void testGroup3(void)
{
const char ** rec;
const char * records[] = {
"ao0", "bo0", "io0", "lo0", "lso0", "mo0", "so0", NULL,
"ao3", "bo3", "io3", "lo3", "lso3", "mo3", "so3",
"ao3c", "bo3c", "io3c", "lo3c", "lso3c", "mo3c", "so3c",
NULL,
};
testDiag("============ Starting %s ============", EPICS_FUNCTION);
@@ -160,13 +176,16 @@ void testGroup3(void)
checkOutput(*rec, 1);
checkDtyp(*rec);
}
checkOutput("do0.B0", 1);
checkDtyp("do0");
checkOutput("do3.B0", 1);
checkDtyp("do3");
checkOutput("do3c.B0", 1);
checkDtyp("do3c");
for (rec = records; *rec; rec++) {
checkOutput(*rec, 0);
}
checkOutput("do0.B0", 0);
checkOutput("do3.B0", 0);
checkOutput("do3c.B0", 0);
}
/* Group 4 are all soft-channel output records with OUT being empty
@@ -177,7 +196,7 @@ void testGroup4(void)
{
const char ** rec;
const char * records[] = {
"ao1", "bo1", "do1.B0", "io1", "lo1", "lso1", "mo1", "so1", NULL,
"ao4", "bo4", "do4.B0", "io4", "lo4", "lso4", "mo4", "so4", NULL,
};
testDiag("============ Starting %s ============", EPICS_FUNCTION);
@@ -189,9 +208,10 @@ void testGroup4(void)
void recTestIoc_registerRecordDeviceDriver(struct dbBase *);
MAIN(softTest)
{
testPlan(163);
testPlan(266);
testdbPrepare();
testdbReadDatabase("recTestIoc.dbd", NULL, NULL);

View File

@@ -59,6 +59,60 @@ record(stringin, "si0") {
field(INP, "source")
}
record(ai, "ai0c") {
field(DTYP, "Soft Channel")
field(INP, "source CA")
}
record(bi, "bi0c") {
field(DTYP, "Soft Channel")
field(INP, "source CA")
field(ZNAM, "Zero")
field(ONAM, "One")
}
record(int64in, "ii0c") {
field(DTYP, "Soft Channel")
field(INP, "source CA")
}
record(longin, "li0c") {
field(DTYP, "Soft Channel")
field(INP, "source CA")
}
record(mbbiDirect, "di0c") {
field(DTYP, "Soft Channel")
field(NOBT, 4)
field(INP, "source CA")
}
record(mbbi, "mi0c") {
field(DTYP, "Soft Channel")
field(NOBT, 4)
field(INP, "source CA")
field(ZRST, "Zero")
field(ONST, "One")
field(TWST, "Two")
field(THST, "Three")
field(FRST, "Four")
field(FVST, "Five")
field(SXST, "Six")
field(SVST, "Seven")
field(EIST, "Eight")
field(NIST, "Nine")
field(TEST, "Ten")
field(ELST, "Eleven")
field(TWST, "Twelve")
field(TTST, "Thirteen")
field(FTST, "Fourteen")
field(FFST, "Fifteen")
}
record(lsi, "lsi0c") {
field(DTYP, "Soft Channel")
field(SIZV, 40)
field(INP, "source CA")
}
record(stringin, "si0c") {
field(DTYP, "Soft Channel")
field(INP, "source CA")
}
# Group 1 are all soft-channel input records with INP being a non-zero
# "const" JSON-link, 9 for most records, 1 for the binary. Their VAL
@@ -171,38 +225,39 @@ record(mbbi, "mi2") {
}
# Group 3 are all soft-channel output records with OUT being a DB link
# to the PV 'dest' with PP. Putting a value to the record writes that
# value to 'dest' and processes it.
# Group 3 are all soft-channel output records with OUT being a DB or
# CA link to the PV 'dest' with PP. Putting a value to the record
# under test writes the value to 'dest' and processes it.
record(sub, "dest") {
field(SNAM, "destSubr")
field(VAL, -1)
}
record(ao, "ao0") {
record(ao, "ao3") {
field(DTYP, "Soft Channel")
field(OUT, "dest PP")
}
record(bo, "bo0") {
record(bo, "bo3") {
field(DTYP, "Soft Channel")
field(OUT, "dest PP")
field(ZNAM, "Zero")
field(ONAM, "One")
}
record(int64out, "io0") {
record(int64out, "io3") {
field(DTYP, "Soft Channel")
field(OUT, "dest PP")
}
record(longout, "lo0") {
record(longout, "lo3") {
field(DTYP, "Soft Channel")
field(OUT, "dest PP")
}
record(mbboDirect, "do0") {
record(mbboDirect, "do3") {
field(DTYP, "Soft Channel")
field(NOBT, 4)
field(OUT, "dest PP")
}
record(mbbo, "mo0") {
record(mbbo, "mo3") {
field(DTYP, "Soft Channel")
field(NOBT, 4)
field(OUT, "dest PP")
@@ -223,39 +278,93 @@ record(mbbo, "mo0") {
field(FTST, "Fourteen")
field(FFST, "Fifteen")
}
record(lso, "lso0") {
record(lso, "lso3") {
field(DTYP, "Soft Channel")
field(OUT, "dest PP")
field(SIZV, 40)
}
record(stringout, "so0") {
record(stringout, "so3") {
field(DTYP, "Soft Channel")
field(OUT, "dest PP")
}
record(ao, "ao3c") {
field(DTYP, "Soft Channel")
field(OUT, "dest CA")
}
record(bo, "bo3c") {
field(DTYP, "Soft Channel")
field(OUT, "dest CA")
field(ZNAM, "Zero")
field(ONAM, "One")
}
record(int64out, "io3c") {
field(DTYP, "Soft Channel")
field(OUT, "dest CA")
}
record(longout, "lo3c") {
field(DTYP, "Soft Channel")
field(OUT, "dest CA")
}
record(mbboDirect, "do3c") {
field(DTYP, "Soft Channel")
field(NOBT, 4)
field(OUT, "dest CA")
}
record(mbbo, "mo3c") {
field(DTYP, "Soft Channel")
field(NOBT, 4)
field(OUT, "dest CA")
field(ZRST, "Zero")
field(ONST, "One")
field(TWST, "Two")
field(THST, "Three")
field(FRST, "Four")
field(FVST, "Five")
field(SXST, "Six")
field(SVST, "Seven")
field(EIST, "Eight")
field(NIST, "Nine")
field(TEST, "Ten")
field(ELST, "Eleven")
field(TWST, "Twelve")
field(TTST, "Thirteen")
field(FTST, "Fourteen")
field(FFST, "Fifteen")
}
record(lso, "lso3c") {
field(DTYP, "Soft Channel")
field(OUT, "dest CA")
field(SIZV, 40)
}
record(stringout, "so3c") {
field(DTYP, "Soft Channel")
field(OUT, "dest CA")
}
# Group 4 are all soft-channel output records with OUT being empty
# (i.e. a CONSTANT link). Putting a value to the record must succeed.
record(ao, "ao1") {
record(ao, "ao4") {
field(DTYP, "Soft Channel")
}
record(bo, "bo1") {
record(bo, "bo4") {
field(DTYP, "Soft Channel")
field(ZNAM, "Zero")
field(ONAM, "One")
}
record(int64out, "io1") {
record(int64out, "io4") {
field(DTYP, "Soft Channel")
}
record(longout, "lo1") {
record(longout, "lo4") {
field(DTYP, "Soft Channel")
}
record(mbboDirect, "do1") {
record(mbboDirect, "do4") {
field(DTYP, "Soft Channel")
field(NOBT, 4)
}
record(mbbo, "mo1") {
record(mbbo, "mo4") {
field(DTYP, "Soft Channel")
field(NOBT, 4)
field(ZRST, "Zero")
@@ -275,10 +384,10 @@ record(mbbo, "mo1") {
field(FTST, "Fourteen")
field(FFST, "Fifteen")
}
record(lso, "lso1") {
record(lso, "lso4") {
field(DTYP, "Soft Channel")
field(SIZV, 40)
}
record(stringout, "so1") {
record(stringout, "so4") {
field(DTYP, "Soft Channel")
}