fix db plugin tests

Avoid installing xRecord.dbd.  This would otherwise be installed
by the DBDINC.

Also must split out recordtype definition from record instance
definition and run the registrar function between the two loads.
This is due to new sanity checks in the loading process
This commit is contained in:
Michael Davidsaver
2012-05-24 14:11:09 -04:00
parent 434f6346fa
commit 20d60bef81
4 changed files with 48 additions and 20 deletions

View File

@@ -20,30 +20,23 @@ TESTS += callbackTest
# When we add more test programs here, this must become a vxTestHarness
TESTSPEC_vxWorks = callbackTest.munch; callbackTest
DBDINC += xRecord
TESTPROD_HOST += dbChannelTest
dbChannelTest_SRCS += dbChannelTest.c
dbChannelTest_SRCS += xRecord_registerRecordDeviceDriver.cpp
dbChannelTest_LIBS += dbCore
dbChannelTest_SRCS += dbChannelTest.c xRecord_registerRecordDeviceDriver.cpp
OBJS_IOC_vxWorks += dbChannelTest
TESTS += dbChannelTest
TESTPROD_HOST += chfPluginTest
chfPluginTest_SRCS += chfPluginTest.c
chfPluginTest_LIBS += dbCore
chfPluginTest_SRCS += chfPluginTest.c xRecord_registerRecordDeviceDriver.cpp
OBJS_IOC_vxWorks += chfPluginTest
TESTS += chfPluginTest
TESTPROD_HOST += arrShorthandTest
arrShorthandTest_SRCS += arrShorthandTest.c
arrShorthandTest_LIBS += dbCore
arrShorthandTest_SRCS += arrShorthandTest.c xRecord_registerRecordDeviceDriver.cpp
OBJS_IOC_vxWorks += arrShorthandTest
TESTS += arrShorthandTest
TESTPROD_HOST += dbStateTest
dbStateTest_SRCS += dbStateTest.c
dbStateTest_LIBS += dbCore
OBJS_IOC_vxWorks += dbStateTest
TESTS += dbStateTest
@@ -51,3 +44,7 @@ TESTSCRIPTS_HOST += $(TESTS:%=%.t)
include $(TOP)/configure/RULES
dbChannelTest$(OBJ): $(COMMON_DIR)/xRecord.h
chfPluginTest$(OBJ): $(COMMON_DIR)/xRecord.h
arrShorthandTest$(OBJ): $(COMMON_DIR)/xRecord.h
dbStateTest$(OBJ): $(COMMON_DIR)/xRecord.h

View File

@@ -75,16 +75,21 @@ static void testHead (char* title) {
testDiag("--------------------------------------------------------");
}
void xRecord_registerRecordDeviceDriver(struct dbBase *);
MAIN(chfPluginTest)
{
dbChannel *pch;
testPlan(28);
testPlan(29);
db_init_events();
testHead("Set up database");
testOk1(!dbReadDatabase(&pdbbase, "dbChannelTest.dbx", ".:..", NULL));
testOk1(!dbReadDatabase(&pdbbase, "xRecord.dbd", ".:..", NULL));
xRecord_registerRecordDeviceDriver(pdbbase);
testOk1(!dbReadDatabase(&pdbbase, "dbChannelTest.db", ".:..", NULL));
testOk(!!pdbbase, "pdbbase was set");
testHead("Register plugin");
@@ -123,3 +128,12 @@ MAIN(chfPluginTest)
return testDone();
}
#define GEN_SIZE_OFFSET
#include "xRecord.h"
#include <recSup.h>
#include <epicsExport.h>
static rset xRSET;
epicsExportAddress(rset,xRSET);

View File

@@ -432,12 +432,14 @@ static void testHead (char* title) {
testDiag("--------------------------------------------------------");
}
void xRecord_registerRecordDeviceDriver(struct dbBase *);
MAIN(chfPluginTest)
{
dbChannel *pch;
db_field_log *pfl;
testPlan(1754);
testPlan(1755);
db_init_events();
@@ -449,7 +451,10 @@ MAIN(chfPluginTest)
testOk(strcmp(chfPluginEnumString(colorEnum, 3, "-"), "-") == 0, "Enum to string: invalid index");
testHead("Set up database");
testOk1(!dbReadDatabase(&pdbbase, "dbChannelTest.dbx", ".:..", NULL));
testOk1(!dbReadDatabase(&pdbbase, "xRecord.dbd", ".:..", NULL));
xRecord_registerRecordDeviceDriver(pdbbase);
testOk1(!dbReadDatabase(&pdbbase, "dbChannelTest.db", ".:..", NULL));
testOk(!!pdbbase, "pdbbase was set");
testHead("Try to register buggy plugins");
@@ -730,3 +735,12 @@ MAIN(chfPluginTest)
return testDone();
}
#define GEN_SIZE_OFFSET
#include "xRecord.h"
#include <recSup.h>
#include <epicsExport.h>
static rset xRSET;
epicsExportAddress(rset,xRSET);

View File

@@ -20,9 +20,6 @@
#include "epicsUnitTest.h"
#include "testMain.h"
#define GEN_SIZE_OFFSET
#include "xRecord.h"
/* Expected call bit definitions */
#define e_start 0x00000001
#define e_abort 0x00000002
@@ -150,13 +147,16 @@ chFilterIf testIf =
p_string, p_start_map, p_map_key, p_end_map, p_start_array, p_end_array,
c_open, c_reg_pre, c_reg_post, c_report, c_close };
void xRecord_registerRecordDeviceDriver(struct dbBase *);
MAIN(dbChannelTest)
{
dbChannel *pch;
testPlan(68);
testPlan(69);
testOk1(!dbReadDatabase(&pdbbase, "xRecord.dbd", ".:..", NULL));
xRecord_registerRecordDeviceDriver(pdbbase);
testOk1(!dbReadDatabase(&pdbbase, "dbChannelTest.db", ".:..", NULL));
testOk(!!pdbbase, "pdbbase was set");
@@ -250,8 +250,11 @@ MAIN(dbChannelTest)
return testDone();
}
#define GEN_SIZE_OFFSET
#include "xRecord.h"
#include <recSup.h>
#include <epicsExport.h>
static
rset xRSET;
static rset xRSET;
epicsExportAddress(rset,xRSET);