From 458cc17eab53af51e2aab8c2ae295a82ce64e5fd Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 24 May 2012 14:11:10 -0400 Subject: [PATCH] fix filter plugin tests as well --- src/ioc/db/filters/test/Makefile | 14 ++++++++++---- src/ioc/db/filters/test/dbndTest.c | 18 ++++++++++++++++-- src/ioc/db/filters/test/filterTest.dbx | 13 ------------- src/ioc/db/filters/test/syncTest.c | 19 +++++++++++++++++-- src/ioc/db/filters/test/tsTest.c | 18 ++++++++++++++++-- 5 files changed, 59 insertions(+), 23 deletions(-) delete mode 100644 src/ioc/db/filters/test/filterTest.dbx diff --git a/src/ioc/db/filters/test/Makefile b/src/ioc/db/filters/test/Makefile index f2cada142..c2b965af4 100644 --- a/src/ioc/db/filters/test/Makefile +++ b/src/ioc/db/filters/test/Makefile @@ -13,16 +13,15 @@ include $(TOP)/configure/CONFIG PROD_LIBS += dbCore ca Com TESTPROD_HOST += tsTest -tsTest_SRCS += tsTest.c +tsTest_SRCS += tsTest.c xRecord_registerRecordDeviceDriver.cpp OBJS_IOC_vxWorks += tsTest TESTS += tsTest TESTPROD_HOST += dbndTest -dbndTest_SRCS += dbndTest.c +dbndTest_SRCS += dbndTest.c xRecord_registerRecordDeviceDriver.cpp OBJS_IOC_vxWorks += dbndTest TESTS += dbndTest -DBDINC += arrRecord TARGETS += $(COMMON_DIR)/arrTest.dbd arrTest_DBD += arrRecord.dbd TESTPROD_HOST += arrTest @@ -31,7 +30,7 @@ OBJS_IOC_vxWorks += arrTest TESTS += arrTest TESTPROD_HOST += syncTest -syncTest_SRCS += syncTest.c +syncTest_SRCS += syncTest.c xRecord_registerRecordDeviceDriver.cpp OBJS_IOC_vxWorks += syncTest TESTS += syncTest @@ -39,3 +38,10 @@ TESTSCRIPTS_HOST += $(TESTS:%=%.t) include $(TOP)/configure/RULES +$(COMMON_DIR)/xRecord.dbd: ../../../test/xRecord.dbd + $(INSTALL) -d $< $(@D) + +tsTest$(OBJ): $(COMMON_DIR)/xRecord.h +dbndTest$(OBJ): $(COMMON_DIR)/xRecord.h +syncTest$(OBJ): $(COMMON_DIR)/xRecord.h +arrTest$(OBJ): $(COMMON_DIR)/arrRecord.h diff --git a/src/ioc/db/filters/test/dbndTest.c b/src/ioc/db/filters/test/dbndTest.c index 437528695..5cb092cdf 100644 --- a/src/ioc/db/filters/test/dbndTest.c +++ b/src/ioc/db/filters/test/dbndTest.c @@ -90,6 +90,8 @@ static void testHead (char* title) { testDiag("--------------------------------------------------------"); } +void xRecord_registerRecordDeviceDriver(struct dbBase *); + MAIN(dbndTest) { dbChannel *pch; @@ -102,15 +104,18 @@ MAIN(dbndTest) db_field_log *pfl2; db_field_log fl1; - testPlan(61); + testPlan(62); db_init_events(); - testOk1(!dbReadDatabase(&pdbbase, "filterTest.dbx", ".:..", NULL)); + testOk1(!dbReadDatabase(&pdbbase, "xRecord.dbd", ".:../../../test", NULL)); testOk(!!pdbbase, "pdbbase was set"); (*pvar_func_dbndInitialize)(); /* manually initialize plugin */ + xRecord_registerRecordDeviceDriver(pdbbase); + testOk1(!dbReadDatabase(&pdbbase, "dbChannelTest.db", ".:../../../test", NULL)); + testOk(!!(plug = dbFindFilter(dbnd, strlen(dbnd))), "plugin dbnd registered correctly"); testOk(!!(pch = dbChannelCreate("x.VAL{\"dbnd\":{}}")), "dbChannel with plugin dbnd (delta=0) created"); @@ -212,3 +217,12 @@ MAIN(dbndTest) return testDone(); } + +#define GEN_SIZE_OFFSET +#include "xRecord.h" + +#include +#include + +static rset xRSET; +epicsExportAddress(rset,xRSET); diff --git a/src/ioc/db/filters/test/filterTest.dbx b/src/ioc/db/filters/test/filterTest.dbx deleted file mode 100644 index b743359c1..000000000 --- a/src/ioc/db/filters/test/filterTest.dbx +++ /dev/null @@ -1,13 +0,0 @@ -# This is a combined minimal DBD and DB file - -recordtype(x) { - field(NAME, DBF_STRING) { - prompt("Record Name") - special(SPC_NOMOD) - size(61) - } - field(VAL, DBF_LONG) { - prompt("Value") - } -} -record(x, x) {} diff --git a/src/ioc/db/filters/test/syncTest.c b/src/ioc/db/filters/test/syncTest.c index 11ecbe04e..4d1fd3159 100644 --- a/src/ioc/db/filters/test/syncTest.c +++ b/src/ioc/db/filters/test/syncTest.c @@ -16,6 +16,7 @@ #include "dbAccessDefs.h" #include "db_field_log.h" #include "dbCommon.h" +#include "dbChannel.h" #include "chfPlugin.h" #include "epicsUnitTest.h" #include "epicsTime.h" @@ -125,8 +126,10 @@ static void checkAndOpenChannel(dbChannel *pch, const chFilterPlugin *plug) { checkCtxRead(pch, red); } +void xRecord_registerRecordDeviceDriver(struct dbBase *); + //MAIN(syncTest) -main() +int main() { dbChannel *pch; chFilter *filter; @@ -143,11 +146,14 @@ main() db_init_events(); - testOk1(!dbReadDatabase(&pdbbase, "filterTest.dbx", ".:..", NULL)); + testOk1(!dbReadDatabase(&pdbbase, "xRecord.dbd", ".:../../../test", NULL)); testOk(!!pdbbase, "pdbbase was set"); (*pvar_func_syncInitialize)(); /* manually initialize plugin */ + xRecord_registerRecordDeviceDriver(pdbbase); + testOk1(!dbReadDatabase(&pdbbase, "dbChannelTest.db", ".:../../../test", NULL)); + testOk(!!(plug = dbFindFilter(myname, strlen(myname))), "plugin %s registered correctly", myname); testOk(!!(red = dbStateCreate("red")), "state 'red' created successfully"); @@ -354,3 +360,12 @@ main() return testDone(); } + +#define GEN_SIZE_OFFSET +#include "xRecord.h" + +#include +#include + +static rset xRSET; +epicsExportAddress(rset,xRSET); diff --git a/src/ioc/db/filters/test/tsTest.c b/src/ioc/db/filters/test/tsTest.c index 806ba864d..3a039afe8 100644 --- a/src/ioc/db/filters/test/tsTest.c +++ b/src/ioc/db/filters/test/tsTest.c @@ -36,6 +36,8 @@ static int fl_equal_ex_ts(const db_field_log *pfl1, const db_field_log *pfl2) { return fl_equal(&fl1, pfl2); } +void xRecord_registerRecordDeviceDriver(struct dbBase *); + MAIN(tsTest) { dbChannel *pch; @@ -48,15 +50,18 @@ MAIN(tsTest) db_field_log fl1; db_field_log *pfl2; - testPlan(14); + testPlan(15); db_init_events(); - testOk1(!dbReadDatabase(&pdbbase, "filterTest.dbx", ".:..", NULL)); + testOk1(!dbReadDatabase(&pdbbase, "xRecord.dbd", ".:../../../test", NULL)); testOk(!!pdbbase, "pdbbase was set"); (*pvar_func_tsInitialize)(); /* manually initialize plugin */ + xRecord_registerRecordDeviceDriver(pdbbase); + testOk1(!dbReadDatabase(&pdbbase, "dbChannelTest.db", ".:../../../test", NULL)); + testOk(!!(plug = dbFindFilter(ts, strlen(ts))), "plugin ts registered correctly"); testOk(!!(pch = dbChannelCreate("x.VAL{\"ts\":{}}")), "dbChannel with plugin ts created"); @@ -95,3 +100,12 @@ MAIN(tsTest) return testDone(); } + +#define GEN_SIZE_OFFSET +#include "xRecord.h" + +#include +#include + +static rset xRSET; +epicsExportAddress(rset,xRSET);