Fix scalar link initialization from hex constants

Partially fixes LP: #1699445
Includes regression tests, with TODO for arrays which are still broken
and need a full JSON5 parser to fix.
This commit is contained in:
Andrew Johnson
2017-06-22 18:45:10 -05:00
3 changed files with 177 additions and 16 deletions
+28
View File
@@ -0,0 +1,28 @@
record(ai, "ai1") {
field(INP, 0x10)
}
record(longin, "li1") {
field(INP, 0x10)
}
record(mbbiDirect, "mi1") {
field(INP, 0x10)
field(NOBT, 8)
}
record(aSub, "as1") {
field(INPA, 0x10)
field(FTA, "CHAR")
field(INPB, 0x10)
field(FTB, "UCHAR")
field(INPC, 0x10)
field(FTC, "SHORT")
field(INPD, 0x10)
field(FTD, "USHORT")
field(INPE, 0x10)
field(FTE, "LONG")
field(INPF, 0x10)
field(FTF, "ULONG")
field(INPG, 0x10)
field(FTG, "FLOAT")
field(INPH, 0x10)
field(FTH, "DOUBLE")
}
+44 -13
View File
@@ -13,11 +13,24 @@
#include <waveformRecord.h>
/*
* Test the some identified regressions
* Tests for specific regressions
*/
void regressTest_registerRecordDeviceDriver(struct dbBase *);
static
void startRegressTestIoc(const char *dbfile)
{
testdbPrepare();
testdbReadDatabase("regressTest.dbd", NULL, NULL);
regressTest_registerRecordDeviceDriver(pdbbase);
testdbReadDatabase(dbfile, NULL, NULL);
eltc(0);
testIocInitOk();
eltc(1);
}
/*
* https://bugs.launchpad.net/epics-base/+bug/1577108
*/
@@ -28,21 +41,11 @@ void testArrayLength1(void)
calcoutRecord *precco;
double *pbuf;
testdbPrepare();
testdbReadDatabase("regressTest.dbd", NULL, NULL);
regressTest_registerRecordDeviceDriver(pdbbase);
testdbReadDatabase("regressArray1.db", NULL, NULL);
startRegressTestIoc("regressArray1.db");
precwf = (waveformRecord*)testdbRecordPtr("wf");
precco = (calcoutRecord*)testdbRecordPtr("co");
eltc(0);
testIocInitOk();
eltc(1);
dbScanLock((dbCommon*)precwf);
pbuf = (double*)precwf->bptr;
dbScanUnlock((dbCommon*)precwf);
@@ -65,9 +68,37 @@ void testArrayLength1(void)
testdbCleanup();
}
/*
* https://bugs.launchpad.net/epics-base/+bug/1699445
*/
static
void testHexConstantLinks(void)
{
startRegressTestIoc("regressHex.db");
testdbGetFieldEqual("ai1", DBR_LONG, 0x10);
testdbGetFieldEqual("li1", DBR_LONG, 0x10);
testdbGetFieldEqual("mi1", DBR_LONG, 0x10);
testTodoBegin("Needs JSON5 for hex arrays");
testdbGetFieldEqual("as1.A", DBR_LONG, 0x10);
testdbGetFieldEqual("as1.B", DBR_LONG, 0x10);
testdbGetFieldEqual("as1.C", DBR_LONG, 0x10);
testdbGetFieldEqual("as1.D", DBR_LONG, 0x10);
testdbGetFieldEqual("as1.E", DBR_LONG, 0x10);
testdbGetFieldEqual("as1.F", DBR_LONG, 0x10);
testdbGetFieldEqual("as1.G", DBR_LONG, 0x10);
testdbGetFieldEqual("as1.H", DBR_LONG, 0x10);
testTodoEnd();
testIocShutdownOk();
testdbCleanup();
}
MAIN(regressTest)
{
testPlan(5);
testPlan(16);
testArrayLength1();
testHexConstantLinks();
return testDone();
}