add test for lp:1577108

This commit is contained in:
Michael Davidsaver
2016-05-01 13:30:45 -04:00
parent a3d981ad0a
commit 26c04844cf
3 changed files with 90 additions and 0 deletions

View File

@@ -37,6 +37,14 @@ testHarness_SRCS += analogMonitorTest_registerRecordDeviceDriver.cpp
TESTFILES += $(COMMON_DIR)/analogMonitorTest.dbd ../analogMonitorTest.db
TESTS += analogMonitorTest
TARGETS += $(COMMON_DIR)/regressTest.dbd
regressTest_DBD += base.dbd
TESTPROD_HOST += regressTest
regressTest_SRCS += regressTest.c
regressTest_SRCS += regressTest_registerRecordDeviceDriver.cpp
TESTFILES += $(COMMON_DIR)/regressTest.dbd ../regressArray1.db
TESTS += regressTest
# epicsRunRecordTests runs all the test programs in a known working order.
testHarness_SRCS += epicsRunRecordTests.c

View File

@@ -0,0 +1,9 @@
record(waveform, "wf") {
field(FTVL, "DOUBLE")
field(NELM, "1")
field(FLNK, "co")
}
record(calcout, "co") {
field(CALC, "A")
field(INPA, "wf")
}

View File

@@ -0,0 +1,73 @@
/*************************************************************************\
* Copyright (c) 2016 Michael Davidsaver
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include <dbUnitTest.h>
#include <testMain.h>
#include <dbAccess.h>
#include <errlog.h>
#include <calcoutRecord.h>
#include <waveformRecord.h>
/*
* Test the some identified regressions
*/
void regressTest_registerRecordDeviceDriver(struct dbBase *);
/*
* https://bugs.launchpad.net/epics-base/+bug/1577108
*/
static
void testArrayLength1(void)
{
waveformRecord *precwf;
calcoutRecord *precco;
double *pbuf;
testdbPrepare();
testdbReadDatabase("regressTest.dbd", NULL, NULL);
regressTest_registerRecordDeviceDriver(pdbbase);
testdbReadDatabase("regressArray1.db", NULL, NULL);
precwf = (waveformRecord*)testdbRecordPtr("wf");
precco = (calcoutRecord*)testdbRecordPtr("co");
eltc(0);
testIocInitOk();
eltc(1);
dbScanLock((dbCommon*)precwf);
pbuf = (double*)precwf->bptr;
dbScanUnlock((dbCommon*)precwf);
testdbPutFieldOk("wf", DBF_DOUBLE, 2.0);
dbScanLock((dbCommon*)precwf);
testOk(precwf->nord==1, "wf.NORD = %u == 1", (unsigned)precwf->nord);
testOk(pbuf[0]==2.0, "wf.VAL[0] = %f == 2.0", pbuf[0]);
dbScanUnlock((dbCommon*)precwf);
dbScanLock((dbCommon*)precco);
testOk(precco->a==2.0, "co.A = %f == 2.0", precco->a);
dbScanUnlock((dbCommon*)precco);
testdbGetFieldEqual("co", DBF_DOUBLE, 2.0);
testIocShutdownOk();
testdbCleanup();
}
MAIN(regressTest)
{
testPlan(5);
testArrayLength1();
return testDone();
}