Merge 7.0.10 into PSI-7.0
This commit is contained in:
@@ -61,7 +61,7 @@ static void runBench(size_t nelem, size_t niter, size_t nrep)
|
||||
tdat.addr.field_type = DBF_SHORT;
|
||||
tdat.addr.field_size = nelem*sizeof(*tdat.input);
|
||||
tdat.addr.no_elements = nelem;
|
||||
tdat.addr.pfield = (void*)tdat.input;
|
||||
tdat.addr.pfield = tdat.input;
|
||||
|
||||
for(i=0; i<nelem; i++)
|
||||
tdat.input[i] = (short)i;
|
||||
|
||||
@@ -144,13 +144,13 @@ static void testNativeLink(void)
|
||||
|
||||
nReq = 1;
|
||||
temp = 0x0f0f0f0f;
|
||||
testOk1(dbGetLink(psrclnk, DBR_LONG, (void*)&temp, NULL, &nReq)==0);
|
||||
testOk1(dbGetLink(psrclnk, DBR_LONG, &temp, NULL, &nReq)==0);
|
||||
testOp("%d",temp,==,42);
|
||||
dbScanUnlock((dbCommon*)psrc);
|
||||
|
||||
temp = 1010;
|
||||
nReq = 1;
|
||||
putLink(psrclnk, DBR_LONG, (void*)&temp, nReq);
|
||||
putLink(psrclnk, DBR_LONG, &temp, nReq);
|
||||
|
||||
dbScanLock((dbCommon*)ptarg);
|
||||
testOk1(ptarg->val==1010);
|
||||
@@ -226,12 +226,12 @@ static void testStringLink(void)
|
||||
|
||||
nReq = 1;
|
||||
memset(temp, '!', sizeof(temp));
|
||||
testOk1(dbGetLink(psrclnk, DBR_STRING, (void*)&temp, NULL, &nReq)==0);
|
||||
testOk1(dbGetLink(psrclnk, DBR_STRING, &temp, NULL, &nReq)==0);
|
||||
testOk(strcmp(temp, "hello")==0, "%s == hello", temp);
|
||||
dbScanUnlock((dbCommon*)psrc);
|
||||
|
||||
strcpy(temp, "world");
|
||||
putLink(psrclnk, DBR_STRING, (void*)&temp, nReq);
|
||||
putLink(psrclnk, DBR_STRING, &temp, nReq);
|
||||
|
||||
dbScanLock((dbCommon*)ptarg);
|
||||
testOk(strcmp(ptarg->desc, "world")==0, "%s == world", ptarg->desc);
|
||||
|
||||
@@ -92,13 +92,13 @@ static void testLinkParse(void)
|
||||
for (;td->str; td++) {
|
||||
int i, N;
|
||||
testDiag("Parsing \"%s\"", td->str);
|
||||
testOk(dbParseLink(td->str, DBF_INLINK, &info) == 0, "Parser returned OK");
|
||||
testOk(dbParseLink(td->str, DBF_INLINK, &info, "dummy","INP") == 0, "Parser returned OK");
|
||||
if (!testOk(info.ltype == td->info.ltype, "Link type value"))
|
||||
testDiag("Expected %d, got %d", td->info.ltype, info.ltype);
|
||||
if (td->info.target && info.target)
|
||||
testStrcmp(0, info.target, td->info.target);
|
||||
else if(!!td->info.target ^ !!info.target)
|
||||
testFail("info target NULL mis-match %s %s", info.target, td->info.target);
|
||||
testFail("info target NULL mismatch %s %s", info.target, td->info.target);
|
||||
else
|
||||
testPass("info target NULL as expected");
|
||||
if (info.ltype == td->info.ltype) {
|
||||
@@ -121,6 +121,16 @@ static void testLinkParse(void)
|
||||
dbFreeLinkInfo(&info);
|
||||
}
|
||||
|
||||
info.modifiers |= pvlOptCPP;
|
||||
dbParseLink("something CPP", DBF_OUTLINK, &info, "dummy","OUT");
|
||||
testOk(info.modifiers == 0, "CPP modifier was discarded");
|
||||
dbFreeLinkInfo(&info);
|
||||
|
||||
info.modifiers |= pvlOptCP;
|
||||
dbParseLink("something CP", DBF_OUTLINK, &info, "dummy","OUT");
|
||||
testOk(info.modifiers == 0, "CP modifier was discarded");
|
||||
dbFreeLinkInfo(&info);
|
||||
|
||||
testIocShutdownOk();
|
||||
|
||||
testdbCleanup();
|
||||
@@ -155,7 +165,7 @@ static void testLinkFailParse(void)
|
||||
eltc(1);
|
||||
|
||||
for(;*td; td++) {
|
||||
testOk(dbParseLink(*td, DBF_INLINK, &info) == S_dbLib_badField,
|
||||
testOk(dbParseLink(*td, DBF_INLINK, &info, "dummy","INP") == S_dbLib_badField,
|
||||
"dbParseLink correctly rejected \"%s\"", *td);
|
||||
}
|
||||
|
||||
@@ -705,7 +715,7 @@ void testTSEL(void)
|
||||
|
||||
MAIN(dbPutLinkTest)
|
||||
{
|
||||
testPlan(352);
|
||||
testPlan(354);
|
||||
testLinkParse();
|
||||
testLinkFailParse();
|
||||
testCADBSet();
|
||||
|
||||
@@ -29,7 +29,7 @@ static dbCommon *prec;
|
||||
|
||||
static void onceComp(void *junk, dbCommon *prec)
|
||||
{
|
||||
testOk1(junk==(void*)&waiter);
|
||||
testOk1(junk==&waiter);
|
||||
testOk1(strcmp(prec->name, "reca")==0);
|
||||
called = 1;
|
||||
epicsEventMustTrigger(waiter);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# ERROR: alias using name of exising alias for different record
|
||||
# ERROR: alias using name of existing alias for different record
|
||||
alias("testrec", "testaliasAgain1")
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# ERROR: alias using name of exising record fails
|
||||
# ERROR: alias using name of existing record fails
|
||||
alias("testrecAgain", "testrec")
|
||||
|
||||
@@ -35,7 +35,7 @@ record(x, "testdelrec8") {
|
||||
}
|
||||
|
||||
record("#", "no:such:record") { }
|
||||
record("#", "also:non:existant") {
|
||||
record("#", "also:non:existent") {
|
||||
field(FOO, "5")
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ xdrv *xdrv_get(int group)
|
||||
return curd;
|
||||
}
|
||||
}
|
||||
cantProceed("xdrv_get() for non-existant group");
|
||||
cantProceed("xdrv_get() for non-existent group");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ static void testBasicPut(void)
|
||||
addr.field_type = DBF_SHORT;
|
||||
addr.field_size = s_input_len*sizeof(*scratch);
|
||||
addr.no_elements = s_input_len;
|
||||
addr.pfield = (void*)scratch;
|
||||
addr.pfield = scratch;
|
||||
|
||||
testDiag("Test dbPutConvertRoutine[DBF_SHORT][DBF_SHORT]");
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ ok(msi('-I. -I.. -S ../t12-substitute.txt'), slurp('../t12-result.txt'));
|
||||
delete @ENV{ keys %envs }; # Not really needed
|
||||
|
||||
# Substitution file, relative path includes
|
||||
ok(msi('-I @TOP@/modules -S ../t13-substitute.txt'), slurp('../t13-result.txt'));
|
||||
ok(msi('-I ../.. -S ../t13-substitute.txt'), slurp('../t13-result.txt'));
|
||||
|
||||
# Template file, relative path includes
|
||||
ok(msi('-I @TOP@/modules ../t14-template.txt'), slurp('../t14-result.txt'));
|
||||
ok(msi('-I ../.. ../t14-template.txt'), slurp('../t14-result.txt'));
|
||||
|
||||
# Test support routines
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
file database/test/ioc/dbtemplate/t13-template.txt {
|
||||
file dbtemplate/t13-template.txt {
|
||||
{ a=foo }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
This is t14-template.txt
|
||||
|
||||
include "database/test/ioc/dbtemplate/t14-include.txt"
|
||||
include "dbtemplate/t14-include.txt"
|
||||
|
||||
End of t14-template.txt
|
||||
|
||||
@@ -107,6 +107,13 @@ testHarness_SRCS += boTest.c
|
||||
TESTFILES += ../boTest.db
|
||||
TESTS += boTest
|
||||
|
||||
TESTPROD_HOST += dfanoutTest
|
||||
dfanoutTest_SRCS += dfanoutTest.c
|
||||
dfanoutTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp
|
||||
testHarness_SRCS += dfanoutTest.c
|
||||
TESTFILES += ../dfanoutTest.db
|
||||
TESTS += dfanoutTest
|
||||
|
||||
TESTPROD_HOST += biTest
|
||||
biTest_SRCS += biTest.c
|
||||
biTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp
|
||||
|
||||
@@ -214,18 +214,18 @@ MAIN(analogMonitorTest)
|
||||
/* Loop over all tested deadband values */
|
||||
for (idbnd = 0; idbnd < NO_OF_DEADBANDS; idbnd++) {
|
||||
testDiag("Test %s%s = %g", t_Record[irec], t_DbndType[ityp], t_Deadband[idbnd]);
|
||||
dbPutField(&daddr, DBR_DOUBLE, (void*) &t_Deadband[idbnd], 1);
|
||||
dbPutField(&daddr, DBR_DOUBLE, &t_Deadband[idbnd], 1);
|
||||
memset(t_ReceivedUpdates, 0, sizeof(t_ReceivedUpdates));
|
||||
|
||||
/* Loop over all test patterns */
|
||||
for (itest = 0; itest < NO_OF_PATTERNS; itest++) {
|
||||
iseq = -1;
|
||||
val = 0.0;
|
||||
dbPutField(&vaddr, DBR_DOUBLE, (void*) &val, 1);
|
||||
dbPutField(&vaddr, DBR_DOUBLE, &val, 1);
|
||||
|
||||
/* Loop over the test sequence */
|
||||
for (iseq = 0; iseq < NO_OF_VALUES_PER_SEQUENCE; iseq++) {
|
||||
dbPutField(&vaddr, DBR_DOUBLE, (void*) &t_SetValues[itest][iseq], 1);
|
||||
dbPutField(&vaddr, DBR_DOUBLE, &t_SetValues[itest][iseq], 1);
|
||||
}
|
||||
/* Check expected vs. actual monitors */
|
||||
testOk( (t_ExpectedUpdates[idbnd][itest][0] == t_ReceivedUpdates[itest][0]) &&
|
||||
|
||||
@@ -14,7 +14,7 @@ record(sub, "done1") {
|
||||
|
||||
|
||||
# original problem case
|
||||
# async record chained after syncronous record
|
||||
# async record chained after synchronous record
|
||||
record(calcout, "chain2:1") {
|
||||
field(CALC, "A:=A+1;B")
|
||||
# ODLY=0 synchronous
|
||||
|
||||
@@ -53,7 +53,7 @@ static void test_high(void){
|
||||
/* set VAL to process record */
|
||||
testdbPutFieldOk("test_bo_rec.VAL", DBF_SHORT, TRUE);
|
||||
|
||||
/* wait and verfiy time */
|
||||
/* wait and verify time */
|
||||
testMonitorWait(test_mon);
|
||||
epicsTimeGetCurrent(&endTime);
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2023 Marco Montevechi Filho
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
#include "dbUnitTest.h"
|
||||
#include "testMain.h"
|
||||
#include "errlog.h"
|
||||
#include "dbAccess.h"
|
||||
#include "menuIvoa.h"
|
||||
#include "epicsThread.h"
|
||||
#include "epicsMath.h"
|
||||
#include "dfanoutRecord.h"
|
||||
|
||||
static const char *dfanout_OUT_pvs[] = {
|
||||
"test_dfanout_record.OUTA", "test_dfanout_record.OUTB",
|
||||
"test_dfanout_record.OUTC", "test_dfanout_record.OUTD",
|
||||
"test_dfanout_record.OUTE", "test_dfanout_record.OUTF",
|
||||
"test_dfanout_record.OUTG", "test_dfanout_record.OUTH",
|
||||
"test_dfanout_record.OUTI", "test_dfanout_record.OUTJ",
|
||||
"test_dfanout_record.OUTK", "test_dfanout_record.OUTL",
|
||||
"test_dfanout_record.OUTM", "test_dfanout_record.OUTN",
|
||||
"test_dfanout_record.OUTO", "test_dfanout_record.OUTP"};
|
||||
|
||||
static const char *dfanout_receivers[] = {
|
||||
"test_dfanout_outa", "test_dfanout_outb",
|
||||
"test_dfanout_outc", "test_dfanout_outd",
|
||||
"test_dfanout_oute", "test_dfanout_outf",
|
||||
"test_dfanout_outg", "test_dfanout_outh",
|
||||
"test_dfanout_outi", "test_dfanout_outj",
|
||||
"test_dfanout_outk", "test_dfanout_outl",
|
||||
"test_dfanout_outm", "test_dfanout_outn",
|
||||
"test_dfanout_outo", "test_dfanout_outp"};
|
||||
|
||||
void recTestIoc_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
static void test_all(double val, int exception){
|
||||
|
||||
// if mask == -1 then it tests all.
|
||||
int i;
|
||||
for (i = 0; i < NELEMENTS(dfanout_receivers); ++i) {
|
||||
if ( i == exception) continue;
|
||||
testdbGetFieldEqual(dfanout_receivers[i], DBF_DOUBLE, val);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_all_output(void){
|
||||
|
||||
/* set output fields */
|
||||
int i;
|
||||
for (i = 0; i < NELEMENTS(dfanout_OUT_pvs); ++i) {
|
||||
testdbPutFieldOk(dfanout_OUT_pvs[i], DBF_STRING, dfanout_receivers[i]);
|
||||
}
|
||||
|
||||
/* set VAL from src to any random number */
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_LONG, 5);
|
||||
|
||||
/* verify that OUT records are updated */
|
||||
test_all(5, -1);
|
||||
|
||||
}
|
||||
|
||||
static void test_selm_specified() {
|
||||
|
||||
/* Resetting values */
|
||||
testDiag("Testing Specified");
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_LONG, 0);
|
||||
test_all(0, -1);
|
||||
|
||||
testdbPutFieldOk("test_dfanout_record.SELM", DBF_STRING, "Specified");
|
||||
testdbPutFieldOk("test_dfanout_record.SELN", DBF_LONG, 0);
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_LONG, 10);
|
||||
test_all(0, -1);
|
||||
|
||||
int val;
|
||||
for (val = 0; val < NELEMENTS(dfanout_receivers); ++val) {
|
||||
testdbPutFieldOk("test_dfanout_record.SELN", DBF_LONG, val + 1);
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_LONG, val + 1);
|
||||
|
||||
testdbGetFieldEqual(dfanout_receivers[val], DBF_LONG, val + 1);
|
||||
|
||||
int not_seln, not_seln_val;
|
||||
for (not_seln = 0; not_seln < NELEMENTS(dfanout_receivers); ++not_seln) {
|
||||
if (not_seln == val) continue;
|
||||
if (not_seln < val) { // If record has already been tested, expected value is index + 1
|
||||
not_seln_val = not_seln + 1;
|
||||
} else { // If record hasn't been tested yet, expected value is 0
|
||||
not_seln_val = 0;
|
||||
}
|
||||
testdbGetFieldEqual(dfanout_receivers[not_seln], DBF_LONG, not_seln_val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void test_selm_mask() {
|
||||
|
||||
/* Resetting values */
|
||||
testdbPutFieldOk("test_dfanout_record.SELM", DBF_STRING, "All");
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_LONG, 0);
|
||||
test_all(0, -1);
|
||||
|
||||
/* Testing all 65535 possible masks seems a bit excessive -- just test some patterns */
|
||||
epicsUInt32 mask = 0x100055aa;
|
||||
while (1) {
|
||||
testDiag("Testing mask 0x%04x", mask);
|
||||
/* Resets values. Tests if fields in bitmask have been set */
|
||||
testdbPutFieldOk("test_dfanout_record.SELM", DBF_STRING, "All"); //Setting all values to 1 so we know what to compare with.
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_LONG, 1);
|
||||
|
||||
testdbPutFieldOk("test_dfanout_record.SELM", DBF_STRING, "Mask");
|
||||
testdbPutFieldOk("test_dfanout_record.SELN", DBF_LONG, mask);
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_LONG, 9);
|
||||
|
||||
int item;
|
||||
for (item = 0; item < NELEMENTS(dfanout_receivers); ++item) {
|
||||
|
||||
if ( mask & (1 << item) ) { // If i represents a set bit in the bitmask
|
||||
testdbGetFieldEqual(dfanout_receivers[item], DBF_LONG, 9);
|
||||
} else {
|
||||
testdbGetFieldEqual(dfanout_receivers[item], DBF_LONG, 1);
|
||||
}
|
||||
|
||||
}
|
||||
if (!mask) break;
|
||||
mask >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void test_ivoa() {
|
||||
|
||||
|
||||
testDiag("Testing IVOA = Continue normally");
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_LONG, 1);
|
||||
testdbPutFieldOk("test_dfanout_record.IVOA", DBF_STRING, "Continue normally");
|
||||
testdbPutFieldOk("test_dfanout_record.SELM", DBF_STRING, "All");
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_DOUBLE, epicsNAN);
|
||||
test_all(epicsNAN, -1);
|
||||
testdbGetFieldEqual("test_dfanout_record.VAL", DBF_DOUBLE, epicsNAN);
|
||||
|
||||
testDiag("Testing IVOA = Don't drive outputs");
|
||||
testdbPutFieldOk("test_dfanout_record.IVOA", DBF_STRING, "Don't drive outputs");
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_DOUBLE, 1.2345);
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_DOUBLE, epicsNAN);
|
||||
test_all(1.2345, -1);
|
||||
testdbGetFieldEqual("test_dfanout_record.VAL", DBF_DOUBLE, epicsNAN);
|
||||
|
||||
testDiag("Testing IVOA = Set output to IVOV");
|
||||
testdbPutFieldOk("test_dfanout_record.IVOA", DBF_STRING, "Set output to IVOV");
|
||||
testdbPutFieldOk("test_dfanout_record.IVOV", DBF_DOUBLE, 3.1415);
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_DOUBLE, 42);
|
||||
testdbPutFieldOk("test_dfanout_src.VAL", DBF_DOUBLE, epicsNAN);
|
||||
test_all(3.1415, -1);
|
||||
testdbGetFieldEqual("test_dfanout_record.VAL", DBF_DOUBLE, 3.1415);
|
||||
}
|
||||
|
||||
MAIN(dfanoutTest) {
|
||||
|
||||
testPlan(1067);
|
||||
|
||||
testdbPrepare();
|
||||
testdbReadDatabase("recTestIoc.dbd", NULL, NULL);
|
||||
recTestIoc_registerRecordDeviceDriver(pdbbase);
|
||||
|
||||
testdbReadDatabase("dfanoutTest.db", NULL, NULL);
|
||||
|
||||
eltc(0);
|
||||
testIocInitOk();
|
||||
eltc(1);
|
||||
|
||||
test_all_output();
|
||||
test_selm_specified();
|
||||
test_selm_mask();
|
||||
test_ivoa();
|
||||
|
||||
testIocShutdownOk();
|
||||
testdbCleanup();
|
||||
|
||||
return testDone();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
record(ao, "test_dfanout_src") {
|
||||
field(FLNK, "test_dfanout_record")
|
||||
}
|
||||
|
||||
record(dfanout, "test_dfanout_record") {
|
||||
field(OMSL, "closed_loop")
|
||||
field(DOL, "test_dfanout_src")
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outa") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outb") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outc") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outd") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_oute") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outf") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outg") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outh") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outi") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outj") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outk") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outl") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outm") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outn") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outo") {
|
||||
}
|
||||
|
||||
record(ai, "test_dfanout_outp") {
|
||||
}
|
||||
Reference in New Issue
Block a user