fix filter plugin tests as well

This commit is contained in:
Michael Davidsaver
2012-05-24 14:11:10 -04:00
parent 34800b071f
commit 458cc17eab
5 changed files with 59 additions and 23 deletions

View File

@@ -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

View File

@@ -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 <recSup.h>
#include <epicsExport.h>
static rset xRSET;
epicsExportAddress(rset,xRSET);

View File

@@ -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) {}

View File

@@ -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 <recSup.h>
#include <epicsExport.h>
static rset xRSET;
epicsExportAddress(rset,xRSET);

View File

@@ -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 <recSup.h>
#include <epicsExport.h>
static rset xRSET;
epicsExportAddress(rset,xRSET);