dbShutdownTest

This commit is contained in:
Michael Davidsaver
2014-06-23 16:28:24 -04:00
committed by Michael Davidsaver
parent 5caaf2d13c
commit 1ae2ab1de6
4 changed files with 109 additions and 1 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ DIRS += ioc
ioc_DEPEND_DIRS = libCom ca/client
DIRS += ioc/db/test
ioc/db/test_DEPEND_DIRS = ioc libCom/RTEMS
ioc/db/test_DEPEND_DIRS = ioc std libCom/RTEMS
DIRS += ioc/dbtemplate/test
ioc/dbtemplate/test_DEPEND_DIRS = ioc
+9
View File
@@ -16,6 +16,15 @@ xRec_SRCS = xRecord.c
PROD_LIBS = xRec 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
TESTS += dbShutdownTest
TESTPROD_HOST += callbackTest
callbackTest_SRCS += callbackTest.c
testHarness_SRCS += callbackTest.c
+98
View File
@@ -0,0 +1,98 @@
/*************************************************************************\
* Copyright (c) 2013 Brookhaven National Laboratory.
* Copyright (c) 2013 ITER Organization.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Author: Michael Davidsaver <mdavidsaver@bnl.gov>
* Ralph Lange <Ralph.Lange@gmx.de>
*/
#include <string.h>
#include "epicsUnitTest.h"
#include "epicsThread.h"
#include "iocInit.h"
#include "dbBase.h"
#include "dbAccess.h"
#include "registry.h"
#include "dbStaticLib.h"
#include "osiFileName.h"
#include "dbmf.h"
#include "testMain.h"
void dbShutdownTest_registerRecordDeviceDriver(struct dbBase *);
static struct threadItem {
char *name;
char found;
} commonThreads[] = {
{ "errlog", 0 },
{ "taskwd", 0 },
{ "timerQueue", 0 },
{ "cbLow", 0 },
{ "scanOnce", 0 },
{ NULL, 0 }
};
static
void findCommonThread (epicsThreadId id) {
struct threadItem *thr;
char name[32];
epicsThreadGetName(id, name, 32);
for (thr = commonThreads; thr->name; thr++) {
if (strcasecmp(thr->name, name) == 0) {
thr->found = 1;
}
}
}
static
void checkCommonThreads (void) {
struct threadItem *thr;
for (thr = commonThreads; thr->name; thr++) {
testOk(thr->found, "Thread %s is running", thr->name);
thr->found = 0;
}
}
static
void cycle(void) {
if (dbReadDatabase(&pdbbase, "dbShutdownTest.dbd",
"." OSI_PATH_LIST_SEPARATOR ".." OSI_PATH_LIST_SEPARATOR
"../O.Common" OSI_PATH_LIST_SEPARATOR "O.Common", NULL))
testAbort("Database description 'dbShutdownTest.dbd' not found");
dbShutdownTest_registerRecordDeviceDriver(pdbbase);
if (dbReadDatabase(&pdbbase, "sRecord.db",
"." OSI_PATH_LIST_SEPARATOR "..", NULL))
testAbort("Test database 'sRecord.db' not found");
testOk1(!(iocBuildNoCA() || iocRun()));
epicsThreadMap(findCommonThread);
checkCommonThreads();
testOk1(iocShutdown()==0);
dbFreeBase(pdbbase);
registryFree();
pdbbase = NULL;
dbmfFreeChunks();
}
MAIN(dbShutdownTest)
{
testPlan(14);
cycle();
cycle();
return testDone();
}
+1
View File
@@ -0,0 +1 @@
record(ai, "somename") {}