start asyncproctest

This commit is contained in:
Michael Davidsaver
2018-05-14 19:08:14 -07:00
parent a4fcd2296a
commit d94c8d1e37
3 changed files with 109 additions and 0 deletions

View File

@@ -105,6 +105,15 @@ regressTest_SRCS += regressTest_registerRecordDeviceDriver.cpp
TESTFILES += $(COMMON_DIR)/regressTest.dbd ../regressArray1.db ../regressHex.db ../regressLinkMS.db
TESTS += regressTest
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 # full of races...
# epicsRunRecordTests runs all the test programs in a known working order.
testHarness_SRCS += epicsRunRecordTests.c

View File

@@ -0,0 +1,67 @@
/*************************************************************************\
* 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 <epicsThread.h>
#include <iocsh.h>
void asyncproctest_registerRecordDeviceDriver(struct dbBase *);
MAIN(asyncproctest)
{
testPlan(0);
testdbPrepare();
testdbReadDatabase("asyncproctest.dbd", NULL, NULL);
asyncproctest_registerRecordDeviceDriver(pdbbase);
testdbReadDatabase("asyncproctest.db", NULL, "TPRO=1");
testIocInitOk();
testDiag("===== Chain 1 ======");
testdbPutFieldOk("chain1.B", DBF_LONG, 6);
testdbPutFieldOk("chain1.B", DBF_LONG, 7);
epicsThreadSleep(1.0);
testdbGetFieldEqual("chain1", DBF_LONG, 7);
testdbGetFieldEqual("chain1.A", DBF_LONG, 2);
testDiag("===== Chain 2 ======");
testdbPutFieldOk("chain2:1.B", DBF_LONG, 6);
testdbPutFieldOk("chain2:1.B", DBF_LONG, 7);
epicsThreadSleep(1.0);
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 3 ======");
testdbPutFieldOk("chain3.B", DBF_LONG, 6);
testdbPutFieldOk("chain3.B", DBF_LONG, 7);
epicsThreadSleep(1.0);
testdbGetFieldEqual("chain3", DBF_LONG, 7);
testdbGetFieldEqual("chain3.A", DBF_LONG, 2);
testIocShutdownOk();
testdbCleanup();
return testDone();
}

View File

@@ -0,0 +1,33 @@
# simple case
# stand alone async record
record(calcout, "chain1") {
field(CALC, "A:=A+1;B")
field(ODLY, "0.1")
field(TPRO, "$(TPRO=)")
}
# original problem case
# async record chained after syncronous record
record(calcout, "chain2:1") {
field(CALC, "A:=A+1;B")
# DOLY=0 synchronous
field(OUT , "chain2:2.B PP")
field(TPRO, "$(TPRO=)")
}
record(calcout, "chain2:2") {
field(CALC, "A:=A+1;B")
field(ODLY, "0.1")
field(TPRO, "$(TPRO=)")
}
# ANJ's error case
# async record FLNK's to itself
record(calcout, "chain3") {
field(CALC, "A:=A+1;B")
field(ODLY, "0.1")
field(FLNK, "chain3")
field(TPRO, "$(TPRO=)")
}