Fixed build errors, remove dependency on std.
Build errors: Include guard missing from epicsUnitTest.h;
dbShutdownTest.c was calling the non-universal strcasecmp()
instead of epicsStrCaseCmp().
ioc/db/test no longer depends on std. I modified
xRecord to make it a working record type, and simplified the
other test programs so they all use the same new expanded
dbd file rather than each making their own. I also added
dbShutdownTest() to epicsRunDbTests().
This commit is contained in:
@@ -62,7 +62,7 @@ DIRS += ioc
|
||||
ioc_DEPEND_DIRS = libCom ca/client
|
||||
|
||||
DIRS += ioc/db/test
|
||||
ioc/db/test_DEPEND_DIRS = ioc std libCom/RTEMS
|
||||
ioc/db/test_DEPEND_DIRS = ioc libCom/RTEMS
|
||||
|
||||
DIRS += ioc/dbtemplate/test
|
||||
ioc/dbtemplate/test_DEPEND_DIRS = ioc
|
||||
|
||||
@@ -10,19 +10,24 @@ TOP=../../../..
|
||||
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
TESTLIBRARY = xRec
|
||||
TESTLIBRARY = dbTestIoc
|
||||
|
||||
xRec_SRCS = xRecord.c
|
||||
dbTestIoc_SRCS = xRecord.c
|
||||
|
||||
PROD_LIBS = xRec dbCore ca Com
|
||||
TARGETS += $(COMMON_DIR)/dbTestIoc.dbd
|
||||
dbTestIoc_DBD += menuGlobal.dbd
|
||||
dbTestIoc_DBD += menuConvert.dbd
|
||||
dbTestIoc_DBD += xRecord.dbd
|
||||
TESTFILES += $(COMMON_DIR)/dbTestIoc.dbd ../xRecord.db
|
||||
|
||||
testHarness_SRCS += dbTestIoc_registerRecordDeviceDriver.cpp
|
||||
|
||||
PROD_LIBS = dbTestIoc dbCore ca Com
|
||||
|
||||
TESTPROD_HOST += dbShutdownTest
|
||||
TARGETS += $(COMMON_DIR)/dbShutdownTest.dbd
|
||||
dbShutdownTest_SRCS += dbShutdownTest.c
|
||||
dbShutdownTest_SRCS += dbShutdownTest_registerRecordDeviceDriver.cpp
|
||||
dbShutdownTest_LIBS += $(EPICS_BASE_IOC_LIBS)
|
||||
dbShutdownTest_DBD += base.dbd
|
||||
TESTFILES += $(COMMON_DIR)/dbShutdownTest.dbd ../sRecord.db
|
||||
dbShutdownTest_SRCS += dbTestIoc_registerRecordDeviceDriver.cpp
|
||||
testHarness_SRCS += dbShutdownTest.c
|
||||
TESTS += dbShutdownTest
|
||||
|
||||
TESTPROD_HOST += callbackTest
|
||||
@@ -35,34 +40,22 @@ dbStateTest_SRCS += dbStateTest.c
|
||||
testHarness_SRCS += dbStateTest.c
|
||||
TESTS += dbStateTest
|
||||
|
||||
TARGETS += $(COMMON_DIR)/dbChannelTest.dbd
|
||||
dbChannelTest_DBD += xRecord.dbd
|
||||
TESTPROD_HOST += dbChannelTest
|
||||
dbChannelTest_SRCS += dbChannelTest.c
|
||||
dbChannelTest_SRCS += dbChannelTest_registerRecordDeviceDriver.cpp
|
||||
dbChannelTest_SRCS += dbTestIoc_registerRecordDeviceDriver.cpp
|
||||
testHarness_SRCS += dbChannelTest.c
|
||||
testHarness_SRCS += dbChannelTest_registerRecordDeviceDriver.cpp
|
||||
TESTFILES += $(COMMON_DIR)/dbChannelTest.dbd ../xRecord.db
|
||||
TESTS += dbChannelTest
|
||||
|
||||
TARGETS += $(COMMON_DIR)/chfPluginTest.dbd
|
||||
chfPluginTest_DBD += xRecord.dbd
|
||||
TESTPROD_HOST += chfPluginTest
|
||||
chfPluginTest_SRCS += chfPluginTest.c
|
||||
chfPluginTest_SRCS += chfPluginTest_registerRecordDeviceDriver.cpp
|
||||
chfPluginTest_SRCS += dbTestIoc_registerRecordDeviceDriver.cpp
|
||||
testHarness_SRCS += chfPluginTest.c
|
||||
testHarness_SRCS += chfPluginTest_registerRecordDeviceDriver.cpp
|
||||
TESTFILES += $(COMMON_DIR)/chfPluginTest.dbd
|
||||
TESTS += chfPluginTest
|
||||
|
||||
TARGETS += $(COMMON_DIR)/arrShorthandTest.dbd
|
||||
arrShorthandTest_DBD += xRecord.dbd
|
||||
TESTPROD_HOST += arrShorthandTest
|
||||
arrShorthandTest_SRCS += arrShorthandTest.c
|
||||
arrShorthandTest_SRCS += arrShorthandTest_registerRecordDeviceDriver.cpp
|
||||
arrShorthandTest_SRCS += dbTestIoc_registerRecordDeviceDriver.cpp
|
||||
testHarness_SRCS += arrShorthandTest.c
|
||||
testHarness_SRCS += arrShorthandTest_registerRecordDeviceDriver.cpp
|
||||
TESTFILES += $(COMMON_DIR)/arrShorthandTest.dbd
|
||||
TESTS += arrShorthandTest
|
||||
|
||||
# The testHarness runs all the test programs in a known working order.
|
||||
|
||||
@@ -77,7 +77,7 @@ static void testHead (char* title) {
|
||||
testDiag("--------------------------------------------------------");
|
||||
}
|
||||
|
||||
void arrShorthandTest_registerRecordDeviceDriver(struct dbBase *);
|
||||
void dbTestIoc_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
MAIN(arrShorthandTest)
|
||||
{
|
||||
@@ -88,12 +88,12 @@ MAIN(arrShorthandTest)
|
||||
db_init_events();
|
||||
dbChannelInit();
|
||||
|
||||
if (dbReadDatabase(&pdbbase, "arrShorthandTest.dbd",
|
||||
if (dbReadDatabase(&pdbbase, "dbTestIoc.dbd",
|
||||
"." OSI_PATH_LIST_SEPARATOR ".." OSI_PATH_LIST_SEPARATOR
|
||||
"../O.Common" OSI_PATH_LIST_SEPARATOR "O.Common", NULL))
|
||||
testAbort("Database description 'arrShorthandTest.dbd' not found");
|
||||
testAbort("Database description 'dbTestIoc.dbd' not found");
|
||||
|
||||
arrShorthandTest_registerRecordDeviceDriver(pdbbase);
|
||||
dbTestIoc_registerRecordDeviceDriver(pdbbase);
|
||||
if (dbReadDatabase(&pdbbase, "xRecord.db",
|
||||
"." OSI_PATH_LIST_SEPARATOR "..", NULL))
|
||||
testAbort("Test database 'xRecord.db' not found");
|
||||
|
||||
@@ -481,7 +481,7 @@ static void testHead (char* title) {
|
||||
testDiag("--------------------------------------------------------");
|
||||
}
|
||||
|
||||
void chfPluginTest_registerRecordDeviceDriver(struct dbBase *);
|
||||
void dbTestIoc_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
MAIN(chfPluginTest)
|
||||
{
|
||||
@@ -508,12 +508,12 @@ MAIN(chfPluginTest)
|
||||
testOk(strcmp(chfPluginEnumString(colorEnum, 3, "-"), "-") == 0,
|
||||
"Enum to string: invalid index");
|
||||
|
||||
if (dbReadDatabase(&pdbbase, "chfPluginTest.dbd",
|
||||
if (dbReadDatabase(&pdbbase, "dbTestIoc.dbd",
|
||||
"." OSI_PATH_LIST_SEPARATOR ".." OSI_PATH_LIST_SEPARATOR
|
||||
"../O.Common" OSI_PATH_LIST_SEPARATOR "O.Common", NULL))
|
||||
testAbort("Database description 'chfPluginTest.dbd' not found");
|
||||
testAbort("Database description 'dbTestIoc.dbd' not found");
|
||||
|
||||
chfPluginTest_registerRecordDeviceDriver(pdbbase);
|
||||
dbTestIoc_registerRecordDeviceDriver(pdbbase);
|
||||
if (dbReadDatabase(&pdbbase, "xRecord.db",
|
||||
"." OSI_PATH_LIST_SEPARATOR "..", NULL))
|
||||
testAbort("Test database 'xRecord.db' not found");
|
||||
|
||||
@@ -149,7 +149,7 @@ 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 dbChannelTest_registerRecordDeviceDriver(struct dbBase *);
|
||||
void dbTestIoc_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
MAIN(testDbChannel) /* dbChannelTest is an API routine... */
|
||||
{
|
||||
@@ -157,12 +157,12 @@ MAIN(testDbChannel) /* dbChannelTest is an API routine... */
|
||||
|
||||
testPlan(66);
|
||||
|
||||
if (dbReadDatabase(&pdbbase, "dbChannelTest.dbd",
|
||||
if (dbReadDatabase(&pdbbase, "dbTestIoc.dbd",
|
||||
"." OSI_PATH_LIST_SEPARATOR ".." OSI_PATH_LIST_SEPARATOR
|
||||
"../O.Common" OSI_PATH_LIST_SEPARATOR "O.Common", NULL))
|
||||
testAbort("Database description 'dbChannelTest.dbd' not found");
|
||||
testAbort("Database description 'dbTestIoc.dbd' not found");
|
||||
|
||||
dbChannelTest_registerRecordDeviceDriver(pdbbase);
|
||||
dbTestIoc_registerRecordDeviceDriver(pdbbase);
|
||||
if (dbReadDatabase(&pdbbase, "xRecord.db",
|
||||
"." OSI_PATH_LIST_SEPARATOR "..", NULL))
|
||||
testAbort("Test database 'xRecord.db' not found");
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
* Ralph Lange <Ralph.Lange@gmx.de>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "epicsString.h"
|
||||
#include "dbUnitTest.h"
|
||||
#include "epicsThread.h"
|
||||
#include "iocInit.h"
|
||||
@@ -24,7 +23,7 @@
|
||||
|
||||
#include "testMain.h"
|
||||
|
||||
void dbShutdownTest_registerRecordDeviceDriver(struct dbBase *);
|
||||
void dbTestIoc_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
static struct threadItem {
|
||||
char *name;
|
||||
@@ -46,7 +45,7 @@ void findCommonThread (epicsThreadId id) {
|
||||
epicsThreadGetName(id, name, 32);
|
||||
|
||||
for (thr = commonThreads; thr->name; thr++) {
|
||||
if (strcasecmp(thr->name, name) == 0) {
|
||||
if (epicsStrCaseCmp(thr->name, name) == 0) {
|
||||
thr->found = 1;
|
||||
}
|
||||
}
|
||||
@@ -67,11 +66,11 @@ void cycle(void) {
|
||||
|
||||
testdbPrepare();
|
||||
|
||||
testdbReadDatabase("dbShutdownTest.dbd", NULL, NULL);
|
||||
testdbReadDatabase("dbTestIoc.dbd", NULL, NULL);
|
||||
|
||||
dbShutdownTest_registerRecordDeviceDriver(pdbbase);
|
||||
dbTestIoc_registerRecordDeviceDriver(pdbbase);
|
||||
|
||||
testdbReadDatabase("sRecord.db", NULL, NULL);
|
||||
testdbReadDatabase("xRecord.db", NULL, NULL);
|
||||
|
||||
testOk1(!testiocInit());
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
int callbackTest(void);
|
||||
int dbStateTest(void);
|
||||
int dbShutdownTest(void);
|
||||
int testDbChannel(void);
|
||||
int chfPluginTest(void);
|
||||
int arrShorthandTest(void);
|
||||
@@ -28,9 +29,10 @@ void epicsRunDbTests(void)
|
||||
|
||||
runTest(callbackTest);
|
||||
runTest(dbStateTest);
|
||||
runTest(dbShutdownTest);
|
||||
runTest(testDbChannel);
|
||||
runTest(chfPluginTest);
|
||||
runTest(arrShorthandTest);
|
||||
runTest(chfPluginTest);
|
||||
|
||||
dbmfFreeChunks();
|
||||
|
||||
|
||||
@@ -14,12 +14,24 @@
|
||||
*/
|
||||
|
||||
#include "dbAccessDefs.h"
|
||||
#include <recSup.h>
|
||||
#include "recSup.h"
|
||||
#include "recGbl.h"
|
||||
|
||||
#define GEN_SIZE_OFFSET
|
||||
#include "xRecord.h"
|
||||
|
||||
#include <epicsExport.h>
|
||||
|
||||
static rset xRSET;
|
||||
static long process(xRecord *prec)
|
||||
{
|
||||
prec->pact = TRUE;
|
||||
recGblGetTimeStamp(prec);
|
||||
recGblFwdLink(prec);
|
||||
prec->pact = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static rset xRSET = {
|
||||
RSETNUMBER, NULL, NULL, NULL, process
|
||||
};
|
||||
epicsExportAddress(rset,xRSET);
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
# This is a combined minimal DBD and DB file
|
||||
# This is a minimal record definition
|
||||
|
||||
recordtype(x) {
|
||||
field(NAME, DBF_STRING) {
|
||||
prompt("Record Name")
|
||||
special(SPC_NOMOD)
|
||||
size(61)
|
||||
}
|
||||
include "dbCommon.dbd"
|
||||
field(VAL, DBF_LONG) {
|
||||
prompt("Value")
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
* Author: Andrew Johnson
|
||||
*/
|
||||
|
||||
#ifndef INC_epicsUnitTest_H
|
||||
#define INC_epicsUnitTest_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "compilerDependencies.h"
|
||||
@@ -47,3 +50,5 @@ epicsShareFunc void runTestFunc(const char *name, TESTFUNC func);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* INC_epicsUnitTest_H */
|
||||
|
||||
Reference in New Issue
Block a user