example: add simple test to check correct linkage
- needs to be 3.14 compatible - fixes #27
This commit is contained in:
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