Merge branch '7.0' into add-simm-to-ao-records
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "dbStaticLib.h"
|
||||
#include "dbAccessDefs.h"
|
||||
#include "db_field_log.h"
|
||||
@@ -46,6 +47,7 @@ static void fl_setup(dbChannel *chan, db_field_log *pfl) {
|
||||
pfl->stat = prec->stat;
|
||||
pfl->sevr = prec->sevr;
|
||||
pfl->time = prec->time;
|
||||
pfl->mask = DBE_VALUE;
|
||||
pfl->field_type = dbChannelFieldType(chan);
|
||||
pfl->field_size = dbChannelFieldSize(chan);
|
||||
pfl->no_elements = dbChannelElements(chan);
|
||||
|
||||
@@ -37,9 +37,8 @@ TESTS += arrayOpTest
|
||||
|
||||
TESTPROD_HOST += recMiscTest
|
||||
recMiscTest_SRCS += recMiscTest.c
|
||||
ifeq (NO,$(STATIC_BUILD))
|
||||
recMiscTest_CFLAGS += -DLINK_DYNAMIC
|
||||
endif
|
||||
recMiscTest_CFLAGS_NO = -DLINK_DYNAMIC
|
||||
recMiscTest_CFLAGS += $(recMiscTest_CFLAGS_$(STATIC_BUILD))
|
||||
recMiscTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp
|
||||
testHarness_SRCS += recMiscTest.c
|
||||
TESTFILES += ../recMiscTest.db
|
||||
@@ -128,6 +127,8 @@ regressTest_SRCS += regressTest.c
|
||||
regressTest_SRCS += regressTest_registerRecordDeviceDriver.cpp
|
||||
TESTFILES += $(COMMON_DIR)/regressTest.dbd ../regressArray1.db ../regressHex.db ../regressLinkMS.db
|
||||
TESTFILES += ../badCaLink.db
|
||||
TESTFILES += ../regressLongCalc.db
|
||||
TESTFILES += ../regressLinkSevr.db
|
||||
TESTS += regressTest
|
||||
|
||||
TARGETS += $(COMMON_DIR)/simmTest.dbd
|
||||
@@ -166,12 +167,11 @@ testHarness_SRCS += linkFilterTest.c
|
||||
TESTFILES += ../linkFilterTest.db
|
||||
TESTS += linkFilterTest
|
||||
|
||||
# dbHeader* is only a compile test
|
||||
# no need to actually run
|
||||
TESTPROD += dbHeaderTest
|
||||
dbHeaderTest_SRCS += dbHeaderTest.cpp
|
||||
TESTPROD += dbHeaderTestxx
|
||||
dbHeaderTestxx_SRCS += dbHeaderTestxx.cpp
|
||||
# These are compile-time tests, no need to link or run
|
||||
TARGETS += dbHeaderTest$(OBJ)
|
||||
TARGET_SRCS += dbHeaderTest.cpp
|
||||
TARGETS += dbHeaderTestxx$(OBJ)
|
||||
TARGET_SRCS += dbHeaderTestxx.cpp
|
||||
|
||||
ifeq ($(T_A),$(EPICS_HOST_ARCH))
|
||||
# Host-only tests of softIoc/softIocPVA, caget and pvget (if present)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define EPICS_DBCA_PRIVATE_API
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "dbStaticLib.h"
|
||||
#include "dbTest.h"
|
||||
@@ -116,6 +118,8 @@ void checkAsyncOutput(const char *rec, dbCommon *async)
|
||||
strcpy(proc, rec);
|
||||
strcat(proc, ".PROC");
|
||||
|
||||
testdbCaWaitForConnect(dbGetDevLink(testdbRecordPtr(rec)));
|
||||
|
||||
testdbPutFieldOk(proc, DBF_CHAR, 1);
|
||||
|
||||
epicsEventWait(asyncEvent);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
\*************************************************************************/
|
||||
|
||||
/* This test includes all public headers from libCom and database modules
|
||||
* to ensure they are all syntaxtically correct in both C and C++
|
||||
* to ensure they are all syntactically correct in both C and C++
|
||||
*/
|
||||
|
||||
#include <aaiRecord.h>
|
||||
|
||||
@@ -33,15 +33,16 @@
|
||||
#include "epicsExport.h"
|
||||
|
||||
static
|
||||
void testmbbioFields(const char* rec, unsigned int value)
|
||||
void testmbbioFields(char dir, unsigned n, unsigned int value)
|
||||
{
|
||||
char field[40];
|
||||
unsigned int i;
|
||||
|
||||
testdbGetFieldEqual(rec, DBF_ULONG, value);
|
||||
sprintf(field,"d%c%d", dir, n);
|
||||
testdbGetFieldEqual(field, DBF_ULONG, value);
|
||||
for (i=0; i < 32; i++)
|
||||
{
|
||||
sprintf(field,"%s.B%X", rec, i);
|
||||
sprintf(field,"d%c%d.B%X", dir, n, i);
|
||||
testdbGetFieldEqual(field, DBF_ULONG, (value>>i)&1);
|
||||
}
|
||||
}
|
||||
@@ -49,16 +50,14 @@ void testmbbioFields(const char* rec, unsigned int value)
|
||||
static
|
||||
void testmbbioRecords(unsigned int count, unsigned int value)
|
||||
{
|
||||
char rec[40];
|
||||
unsigned int i;
|
||||
|
||||
for (i = 1; i <= count; i++)
|
||||
{
|
||||
sprintf(rec, "do%d", i);
|
||||
testDiag(" ### %s ###", rec);
|
||||
testmbbioFields(rec, value);
|
||||
sprintf(rec, "di%d", i);
|
||||
testmbbioFields(rec, value);
|
||||
testDiag(" ### do%d ###", i);
|
||||
testmbbioFields('o', i, value);
|
||||
testDiag(" ### di%d ###", i);
|
||||
testmbbioFields('i', i, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
record(ai, "ai") {}
|
||||
|
||||
record(stringin, "si1") {
|
||||
field(INP, "ai.SEVR")
|
||||
field(FLNK, "li1")
|
||||
}
|
||||
record(longin, "li1") {
|
||||
field(INP, "ai.SEVR")
|
||||
field(FLNK, "si2")
|
||||
}
|
||||
|
||||
record(stringin, "si2") {
|
||||
field(INP, "ai.SEVR CA")
|
||||
field(FLNK, "li2")
|
||||
}
|
||||
record(longin, "li2") {
|
||||
field(INP, "ai.SEVR CA")
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
record(calc, "test_calc")
|
||||
{
|
||||
field(SCAN, "1 second")
|
||||
field(CALC, "RNDM*100")
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
#define EPICS_DBCA_PRIVATE_API
|
||||
|
||||
#include <dbUnitTest.h>
|
||||
#include <testMain.h>
|
||||
#include <dbAccess.h>
|
||||
@@ -23,6 +25,8 @@ void regressTest_registerRecordDeviceDriver(struct dbBase *);
|
||||
static
|
||||
void startRegressTestIoc(const char *dbfile)
|
||||
{
|
||||
testDiag("Testing with %s", dbfile);
|
||||
|
||||
testdbPrepare();
|
||||
testdbReadDatabase("regressTest.dbd", NULL, NULL);
|
||||
regressTest_registerRecordDeviceDriver(pdbbase);
|
||||
@@ -134,15 +138,84 @@ void testCADisconn(void)
|
||||
testdbPutFieldFail(-1, "ai:disconn.PROC", DBF_LONG, 1);
|
||||
testdbGetFieldEqual("ai:disconn.SEVR", DBF_LONG, INVALID_ALARM);
|
||||
testdbGetFieldEqual("ai:disconn.STAT", DBF_LONG, LINK_ALARM);
|
||||
|
||||
testIocShutdownOk();
|
||||
testdbCleanup();
|
||||
}
|
||||
|
||||
/* https://github.com/epics-base/epics-base/issues/194 */
|
||||
static
|
||||
void testLongCalc(void)
|
||||
{
|
||||
const char small[] = "0.0000000000000000000000000000000000000001";
|
||||
|
||||
startRegressTestIoc("regressLongCalc.db");
|
||||
|
||||
testdbGetFieldEqual("test_calc.CALC", DBF_STRING, "RNDM*100");
|
||||
|
||||
testdbPutArrFieldOk("test_calc.CALC$", DBF_CHAR, 4, "300\0");
|
||||
testdbGetFieldEqual("test_calc.CALC", DBF_STRING, "300");
|
||||
testdbPutFieldOk("test_calc.PROC", DBF_LONG, 1);
|
||||
testdbGetFieldEqual("test_calc", DBF_DOUBLE, 300.0);
|
||||
|
||||
testdbPutArrFieldOk("test_calc.CALC$", DBF_CHAR, sizeof(small), small);
|
||||
testdbGetFieldEqual("test_calc.CALC", DBF_STRING, "0.0000000000000000000000000000000000000");
|
||||
testdbPutFieldOk("test_calc.PROC", DBF_LONG, 1);
|
||||
testdbGetFieldEqual("test_calc", DBF_DOUBLE, 1e-40);
|
||||
|
||||
testIocShutdownOk();
|
||||
testdbCleanup();
|
||||
}
|
||||
|
||||
/* https://github.com/epics-base/epics-base/issues/183 */
|
||||
static
|
||||
void testLinkSevr(void)
|
||||
{
|
||||
dbChannel *chan;
|
||||
|
||||
startRegressTestIoc("regressLinkSevr.db");
|
||||
|
||||
/* wait for CA links to connect and receive an initial update */
|
||||
testdbCaWaitForUpdateCount(dbGetDevLink(testdbRecordPtr("si2")), 1);
|
||||
testdbCaWaitForUpdateCount(dbGetDevLink(testdbRecordPtr("li2")), 1);
|
||||
|
||||
chan = dbChannelCreate("ai.SEVR");
|
||||
if(!chan)
|
||||
testAbort("Can't create channel for ai.SEVR");
|
||||
testOk1(!dbChannelOpen(chan));
|
||||
|
||||
#define testType(FN, TYPE) testOk(FN(chan)==TYPE, #FN "() -> (%d) == " #TYPE " (%d)", FN(chan), TYPE)
|
||||
testType(dbChannelExportType, DBF_ENUM);
|
||||
testType(dbChannelFieldType, DBF_MENU);
|
||||
testType(dbChannelFinalFieldType, DBF_ENUM);
|
||||
#undef testType
|
||||
|
||||
dbChannelDelete(chan);
|
||||
|
||||
testdbGetFieldEqual("ai.SEVR", DBF_LONG, INVALID_ALARM);
|
||||
testdbGetFieldEqual("ai.SEVR", DBF_STRING, "INVALID");
|
||||
|
||||
testdbPutFieldOk("si1.PROC", DBF_LONG, 1);
|
||||
|
||||
testdbGetFieldEqual("si1", DBF_STRING, "INVALID");
|
||||
testdbGetFieldEqual("li1", DBF_LONG, INVALID_ALARM);
|
||||
testTodoBegin("Not working");
|
||||
testdbGetFieldEqual("si2", DBF_STRING, "INVALID");
|
||||
testTodoEnd();
|
||||
testdbGetFieldEqual("li2", DBF_LONG, INVALID_ALARM);
|
||||
|
||||
testIocShutdownOk();
|
||||
testdbCleanup();
|
||||
}
|
||||
|
||||
MAIN(regressTest)
|
||||
{
|
||||
testPlan(34);
|
||||
testPlan(54);
|
||||
testArrayLength1();
|
||||
testHexConstantLinks();
|
||||
testLinkMS();
|
||||
testCADisconn();
|
||||
testLongCalc();
|
||||
testLinkSevr();
|
||||
return testDone();
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define EPICS_DBCA_PRIVATE_API
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "dbStaticLib.h"
|
||||
#include "dbCa.h"
|
||||
#include "dbTest.h"
|
||||
#include "dbUnitTest.h"
|
||||
#include "epicsThread.h"
|
||||
@@ -60,14 +63,17 @@ void testGroup0(void)
|
||||
|
||||
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++) {
|
||||
DBLINK* plink = dbGetDevLink(testdbRecordPtr(*rec));
|
||||
if(plink->type==CA_LINK)
|
||||
testdbCaWaitForUpdateCount(plink, 1);
|
||||
}
|
||||
|
||||
testdbPutFieldOk("source", DBR_LONG, 1);
|
||||
for (rec = records; *rec; rec++) {
|
||||
DBLINK* plink = dbGetDevLink(testdbRecordPtr(*rec));
|
||||
if(plink->type==CA_LINK)
|
||||
testdbCaWaitForUpdateCount(plink, 2);
|
||||
if (strncmp(*rec, "lsi0", 4) != 0)
|
||||
testdbGetFieldEqual(*rec, DBR_LONG, 0);
|
||||
checkDtyp(*rec);
|
||||
@@ -76,8 +82,10 @@ void testGroup0(void)
|
||||
}
|
||||
|
||||
testdbPutFieldOk("source", DBR_LONG, 0);
|
||||
epicsThreadSleep(1.0); /* FIXME: Wait here as above */
|
||||
for (rec = records; *rec; rec++) {
|
||||
DBLINK* plink = dbGetDevLink(testdbRecordPtr(*rec));
|
||||
if(plink->type==CA_LINK)
|
||||
testdbCaWaitForUpdateCount(plink, 3);
|
||||
doProcess(*rec);
|
||||
testdbGetFieldEqual(*rec, DBR_LONG, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user