Merge 3.16 (after 3.16.2-rc1) into 7.0
This commit is contained in:
@@ -136,12 +136,23 @@ testHarness_SRCS += mbbioDirectTest.c
|
||||
TESTFILES += ../mbbioDirectTest.db
|
||||
TESTS += mbbioDirectTest
|
||||
|
||||
TARGETS += $(COMMON_DIR)/asyncproctest.dbd
|
||||
DBDDEPENDS_FILES += asyncproctest.dbd$(DEP)
|
||||
asyncproctest_DBD += base.dbd
|
||||
TESTPROD_HOST += asyncproctest
|
||||
asyncproctest_SRCS += asyncproctest.c
|
||||
asyncproctest_SRCS += asyncproctest_registerRecordDeviceDriver.cpp
|
||||
TESTFILES += $(COMMON_DIR)/asyncproctest.dbd ../asyncproctest.db
|
||||
TESTS += asyncproctest
|
||||
|
||||
# epicsRunRecordTests runs all the test programs in a known working order.
|
||||
testHarness_SRCS += epicsRunRecordTests.c
|
||||
|
||||
recordTestHarness_SRCS += $(testHarness_SRCS)
|
||||
recordTestHarness_SRCS_RTEMS += rtemsTestHarness.c
|
||||
|
||||
PROD_SRCS_RTEMS += rtemsTestData.c
|
||||
|
||||
PROD_vxWorks = recordTestHarness
|
||||
PROD_RTEMS = recordTestHarness
|
||||
|
||||
@@ -149,5 +160,12 @@ TESTSPEC_vxWorks = recordTestHarness.munch; epicsRunRecordTests
|
||||
TESTSPEC_RTEMS = recordTestHarness.boot; epicsRunRecordTests
|
||||
|
||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
||||
ifneq ($(filter $(T_A),$(CROSS_COMPILER_RUNTEST_ARCHS)),)
|
||||
TESTPROD_RTEMS = $(TESTPROD_HOST)
|
||||
TESTSCRIPTS_RTEMS += $(TESTS:%=%.t)
|
||||
endif
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
||||
rtemsTestData.c : $(TESTFILES) $(TOOLS)/epicsMakeMemFs.pl
|
||||
$(PERL) $(TOOLS)/epicsMakeMemFs.pl $@ epicsRtemsFSImage $(TESTFILES)
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2018 Michael Davidsaver
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* This test covers some situations where asynchronous records are
|
||||
* dbProcess()'d while busy (PACT==1).
|
||||
*/
|
||||
|
||||
#include <testMain.h>
|
||||
#include <dbUnitTest.h>
|
||||
#include <dbCommon.h>
|
||||
#include <dbAccess.h>
|
||||
#include <epicsEvent.h>
|
||||
#include <epicsThread.h>
|
||||
#include <iocsh.h>
|
||||
#include "registryFunction.h"
|
||||
#include <subRecord.h>
|
||||
|
||||
epicsEventId done;
|
||||
static int waitFor;
|
||||
|
||||
static
|
||||
long doneSubr(subRecord *prec)
|
||||
{
|
||||
if (--waitFor <= 0)
|
||||
epicsEventMustTrigger(done);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void asyncproctest_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
MAIN(asyncproctest)
|
||||
{
|
||||
testPlan(21);
|
||||
|
||||
done = epicsEventMustCreate(epicsEventEmpty);
|
||||
|
||||
testdbPrepare();
|
||||
|
||||
testdbReadDatabase("asyncproctest.dbd", NULL, NULL);
|
||||
asyncproctest_registerRecordDeviceDriver(pdbbase);
|
||||
registryFunctionAdd("doneSubr", (REGISTRYFUNCTION) doneSubr);
|
||||
testdbReadDatabase("asyncproctest.db", NULL, "TPRO=0");
|
||||
|
||||
dbAccessDebugPUTF = 1;
|
||||
|
||||
testIocInitOk();
|
||||
testDiag("===== Chain 1 ======");
|
||||
|
||||
waitFor = 2;
|
||||
testdbPutFieldOk("chain1.B", DBF_LONG, 6);
|
||||
testdbPutFieldOk("chain1.B", DBF_LONG, 7);
|
||||
|
||||
if (epicsEventWaitWithTimeout(done, 10.0) != epicsEventOK)
|
||||
testAbort("Processing timed out");
|
||||
|
||||
testdbGetFieldEqual("chain1", DBF_LONG, 7);
|
||||
testdbGetFieldEqual("chain1.A", DBF_LONG, 2);
|
||||
|
||||
testDiag("===== Chain 2 ======");
|
||||
|
||||
waitFor = 2;
|
||||
testdbPutFieldOk("chain2:1.B", DBF_LONG, 6);
|
||||
testdbPutFieldOk("chain2:1.B", DBF_LONG, 7);
|
||||
|
||||
if (epicsEventWaitWithTimeout(done, 10.0) != epicsEventOK)
|
||||
testAbort("Processing timed out");
|
||||
|
||||
testdbGetFieldEqual("chain2:1", DBF_LONG, 7);
|
||||
testdbGetFieldEqual("chain2:2", DBF_LONG, 7);
|
||||
testdbGetFieldEqual("chain2:1.A", DBF_LONG, 2);
|
||||
testdbGetFieldEqual("chain2:2.A", DBF_LONG, 2);
|
||||
|
||||
testDiag("===== Chain 2 again ======");
|
||||
|
||||
waitFor = 2;
|
||||
testdbPutFieldOk("chain2:1.B", DBF_LONG, 6);
|
||||
testdbPutFieldOk("chain2:1.B", DBF_LONG, 7);
|
||||
testdbPutFieldOk("chain2:1.B", DBF_LONG, 8);
|
||||
|
||||
if (epicsEventWaitWithTimeout(done, 10.0) != epicsEventOK)
|
||||
testAbort("Processing timed out");
|
||||
|
||||
testdbGetFieldEqual("chain2:1", DBF_LONG, 8);
|
||||
testdbGetFieldEqual("chain2:2", DBF_LONG, 8);
|
||||
testdbGetFieldEqual("chain2:1.A", DBF_LONG, 5);
|
||||
testdbGetFieldEqual("chain2:2.A", DBF_LONG, 4);
|
||||
|
||||
testDiag("===== Chain 3 ======");
|
||||
|
||||
waitFor = 2;
|
||||
testdbPutFieldOk("chain3.B", DBF_LONG, 6);
|
||||
testdbPutFieldOk("chain3.B", DBF_LONG, 7);
|
||||
|
||||
if (epicsEventWaitWithTimeout(done, 10.0) != epicsEventOK)
|
||||
testAbort("Processing timed out");
|
||||
|
||||
testdbGetFieldEqual("chain3", DBF_LONG, 7);
|
||||
testdbGetFieldEqual("chain3.A", DBF_LONG, 2);
|
||||
|
||||
testIocShutdownOk();
|
||||
|
||||
testdbCleanup();
|
||||
|
||||
return testDone();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
# simple case
|
||||
# stand alone async record
|
||||
record(calcout, "chain1") {
|
||||
field(CALC, "A:=A+1;B")
|
||||
field(ODLY, "0.1")
|
||||
field(TPRO, "$(TPRO=)")
|
||||
field(FLNK, "done1")
|
||||
}
|
||||
record(sub, "done1") {
|
||||
field(SNAM, "doneSubr")
|
||||
field(TPRO, "$(TPRO=)")
|
||||
}
|
||||
|
||||
|
||||
# original problem case
|
||||
# async record chained after syncronous record
|
||||
record(calcout, "chain2:1") {
|
||||
field(CALC, "A:=A+1;B")
|
||||
# ODLY=0 synchronous
|
||||
field(OUT , "chain2:2.B PP")
|
||||
field(TPRO, "$(TPRO=)")
|
||||
}
|
||||
|
||||
record(ai, "chain2:3") {
|
||||
field(INP, "chain2:1 CPP")
|
||||
field(FLNK, "chain2:2")
|
||||
field(TPRO, "$(TPRO=)")
|
||||
}
|
||||
|
||||
record(calcout, "chain2:2") {
|
||||
field(CALC, "A:=A+1;B")
|
||||
field(ODLY, "0.5")
|
||||
field(TPRO, "$(TPRO=)")
|
||||
field(FLNK, "done2")
|
||||
}
|
||||
record(sub, "done2") {
|
||||
field(SNAM, "doneSubr")
|
||||
field(TPRO, "$(TPRO=)")
|
||||
}
|
||||
|
||||
|
||||
# ANJ's error case
|
||||
# async record FLNK's to itself (via done3)
|
||||
record(calcout, "chain3") {
|
||||
field(CALC, "A:=A+1;B")
|
||||
field(ODLY, "0.1")
|
||||
field(FLNK, "done3")
|
||||
field(TPRO, "$(TPRO=)")
|
||||
}
|
||||
record(sub, "done3") {
|
||||
field(SNAM, "doneSubr")
|
||||
field(FLNK, "chain3")
|
||||
field(TPRO, "$(TPRO=)")
|
||||
}
|
||||
@@ -7,11 +7,14 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "devSup.h"
|
||||
#include "alarm.h"
|
||||
#include "dbUnitTest.h"
|
||||
#include "errlog.h"
|
||||
#include "epicsThread.h"
|
||||
|
||||
#include "longinRecord.h"
|
||||
|
||||
#include "testMain.h"
|
||||
|
||||
void recTestIoc_registerRecordDeviceDriver(struct dbBase *);
|
||||
@@ -28,12 +31,21 @@ static void startTestIoc(const char *dbfile)
|
||||
eltc(1);
|
||||
}
|
||||
|
||||
/* testing here instead of ioc/db/test as xRecord has no INP/OUT */
|
||||
static void testdbGetDevLink(void)
|
||||
{
|
||||
longinRecord *rec = (longinRecord*)testdbRecordPtr("li1");
|
||||
testOk1(dbGetDevLink((dbCommon*)rec) == &rec->inp);
|
||||
}
|
||||
|
||||
static void testLongStringInit()
|
||||
{
|
||||
testDiag("testLongStringInit");
|
||||
|
||||
startTestIoc("linkInitTest.db");
|
||||
|
||||
testdbGetDevLink();
|
||||
|
||||
{
|
||||
const char buf[] = "!----------------------------------------------!";
|
||||
testdbGetArrFieldEqual("longstr1.VAL$", DBF_CHAR, NELEMENTS(buf)+2, NELEMENTS(buf), buf);
|
||||
@@ -230,7 +242,7 @@ void testInt64Inputs(void)
|
||||
|
||||
MAIN(linkInitTest)
|
||||
{
|
||||
testPlan(77);
|
||||
testPlan(78);
|
||||
|
||||
testLongStringInit();
|
||||
testCalcInit();
|
||||
|
||||
Reference in New Issue
Block a user