example: add simple test to check correct linkage
- needs to be 3.14 compatible - fixes #27
This commit is contained in:
@@ -4,5 +4,10 @@ DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *src*))
|
||||
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *Src*))
|
||||
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *db*))
|
||||
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *Db*))
|
||||
|
||||
DIRS := $(DIRS) test
|
||||
|
||||
test_DEPEND_DIRS += src
|
||||
|
||||
include $(TOP)/configure/RULES_DIRS
|
||||
|
||||
|
||||
30
exampleApp/test/Makefile
Normal file
30
exampleApp/test/Makefile
Normal file
@@ -0,0 +1,30 @@
|
||||
#*************************************************************************
|
||||
# Copyright (c) 2020 ITER Organization.
|
||||
# EPICS BASE is distributed subject to a Software License Agreement found
|
||||
# in the file LICENSE that is included with this distribution.
|
||||
#*************************************************************************
|
||||
CURDIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
|
||||
TOP = ../..
|
||||
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
# use the new RSET definition
|
||||
USR_CPPFLAGS += -DUSE_TYPED_RSET
|
||||
|
||||
DBD = exampleTest.dbd
|
||||
exampleTest_DBD += example.dbd
|
||||
|
||||
PROD_LIBS += exampleSupport
|
||||
ifneq ($(SNCSEQ),)
|
||||
PROD_LIBS += seq pv
|
||||
endif
|
||||
PROD_LIBS += $(EPICS_BASE_IOC_LIBS)
|
||||
|
||||
TESTPROD_HOST += exampleTest
|
||||
exampleTest_SRCS += exampleTest.c
|
||||
exampleTest_SRCS += exampleTest_registerRecordDeviceDriver.cpp
|
||||
TESTS += exampleTest
|
||||
|
||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
58
exampleApp/test/exampleTest.c
Normal file
58
exampleApp/test/exampleTest.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2020 ITER Organization.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Author: Ralph Lange <ralph.lange@gmx.de>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <epicsUnitTest.h>
|
||||
#include <testMain.h>
|
||||
|
||||
#include <dbAccess.h>
|
||||
#include <dbStaticLib.h>
|
||||
#include <errlog.h>
|
||||
|
||||
void exampleTest_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
static dbCommon *prec;
|
||||
|
||||
/* from Base 3.15 dbUnitTest.c */
|
||||
static
|
||||
dbCommon* testdbRecordPtr(const char* pv)
|
||||
{
|
||||
DBADDR addr;
|
||||
|
||||
if (dbNameToAddr(pv, &addr))
|
||||
testAbort("Missing record \"%s\"", pv);
|
||||
|
||||
return addr.precord;
|
||||
}
|
||||
|
||||
static void testOnce(void)
|
||||
{
|
||||
testDiag("check that tests work");
|
||||
|
||||
dbReadDatabase(&pdbbase, "example.dbd", "../../../dbd", NULL);
|
||||
exampleTest_registerRecordDeviceDriver(pdbbase);
|
||||
dbReadDatabase(&pdbbase, "dbExample1.db", "../../../db", "user=test");
|
||||
|
||||
testDiag("Searching for records from example application");
|
||||
|
||||
prec = testdbRecordPtr("test:xxxExample");
|
||||
testOk((prec != NULL), "record test:xxxExample");
|
||||
|
||||
prec = testdbRecordPtr("test:aiExample");
|
||||
testOk((prec != NULL), "record test:aiExample");
|
||||
}
|
||||
|
||||
MAIN(exampleTest)
|
||||
{
|
||||
testPlan(2);
|
||||
testOnce();
|
||||
return testDone();
|
||||
}
|
||||
Reference in New Issue
Block a user