iocInit: prepareLinks after autosave pass0

Allow autosave to restore link fields again...
This commit is contained in:
Michael Davidsaver
2015-03-17 19:13:33 -04:00
parent 8bf765365f
commit 3a647fb38b
2 changed files with 32 additions and 8 deletions

View File

@@ -140,7 +140,6 @@ static void prepareLinks(dbRecordType *rtyp, dbCommon *prec, void *junk)
static int iocBuild_2(void)
{
iterateRecords(prepareLinks, NULL);
initHookAnnounce(initHookAfterCaLinkInit);
initDrvSup();
@@ -150,12 +149,14 @@ static int iocBuild_2(void)
initHookAnnounce(initHookAfterInitRecSup);
initDevSup();
initHookAnnounce(initHookAfterInitDevSup);
initHookAnnounce(initHookAfterInitDevSup); /* used by autosave pass 0 */
iterateRecords(prepareLinks, NULL);
dbLockInitRecords(pdbbase);
initDatabase();
dbBkptInit();
initHookAnnounce(initHookAfterInitDatabase);
initHookAnnounce(initHookAfterInitDatabase); /* used by autosave pass 1 */
finishDevSup();
initHookAnnounce(initHookAfterFinishDevSup);

View File

@@ -65,12 +65,12 @@ static void hookPass0(initHookState state)
/* rec0.OUT is initially "rec0.DISV", set it to "rec0.SEVR" */
if(dbFindRecord(&entry, "rec0.OUT")==0) {
aoRecord *prec = entry.precnode->precord;
if(prec->out.type==PV_LINK)
testOk(strcmp(prec->out.value.pv_link.pvname,"rec0.DISV")==0,
if(prec->out.type==CONSTANT)
testOk(strcmp(prec->out.text,"rec0.DISV")==0,
"%s==rec0.DISV (initial value from .db)",
prec->out.value.pv_link.pvname);
prec->out.text);
else
testFail("Wrong link type");
testFail("Wrong link type: %d", (int)prec->out.type);
testOk1(dbPutString(&entry, "rec0.SEVR")==0);
} else{
@@ -78,6 +78,20 @@ static void hookPass0(initHookState state)
testSkip(1, "missing record");
}
/* rec0.SDIS is initially NULL, set it to "rec0.STAT" */
if(dbFindRecord(&entry, "rec0.SDIS")==0) {
aoRecord *prec = entry.precnode->precord;
if(prec->sdis.type==CONSTANT)
testOk1(prec->sdis.value.constantStr==NULL);
else
testFail("Wrong link type: %d", (int)prec->sdis.type);
testOk1(dbPutString(&entry, "rec0.STAT")==0);
} else{
testFail("Missing rec0");
testSkip(1, "missing record");
}
/* can't restore array field in pass0 */
dbFinishEntry(&entry);
@@ -98,6 +112,15 @@ static long initRec0(aoRecord *prec)
else
testFail("Wrong link type");
plink = &prec->sdis;
testOk1(plink->type==DB_LINK);
if(plink->type==DB_LINK)
testOk(strcmp(plink->value.pv_link.pvname,"rec0.STAT")==0,
"%s==rec0.STAT (pass0 value)", plink->value.pv_link.pvname);
else
testFail("Wrong link type");
iran |= 1;
return 2; /* we set .VAL, so don't use RVAL */
}
@@ -197,7 +220,7 @@ static void testRestore(void)
MAIN(asTest)
{
testPlan(25);
testPlan(29);
testRestore();
return testDone();
}