diff --git a/test/validate/Makefile b/test/validate/Makefile index 51c70d516bd3ea93cb63c93a6dd39e12682e0793..a2aadade63b230a72ae98565df3a3a38dadebc26 100644 --- a/test/validate/Makefile +++ b/test/validate/Makefile @@ -27,6 +27,7 @@ TESTPROD_HOST += syncq REGRESSION_TESTS_WITH_DB += bittypes REGRESSION_TESTS_WITH_DB += evflag +REGRESSION_TESTS_WITH_DB += monitorEvflag REGRESSION_TESTS_WITH_DB += pvGet REGRESSION_TESTS_WITH_DB += pvGetAsync REGRESSION_TESTS_WITH_DB += pvPutAsync diff --git a/test/validate/monitorEvflag.db b/test/validate/monitorEvflag.db new file mode 100644 index 0000000000000000000000000000000000000000..6206b204ca023ab2805d7cbd81db6d7a102627ad --- /dev/null +++ b/test/validate/monitorEvflag.db @@ -0,0 +1,5 @@ +record(longout,"requested") { + field(OUT,"actual PP MS") +} +record(longin,"actual") { +} diff --git a/test/validate/monitorEvflag.st b/test/validate/monitorEvflag.st new file mode 100644 index 0000000000000000000000000000000000000000..cc0e0f059d12d6e16cb43062c7871380c8e8589c --- /dev/null +++ b/test/validate/monitorEvflag.st @@ -0,0 +1,63 @@ +program monitorEvflagTest + +option +s; + +%%#include "../testSupport.h" +%%#include <stdio.h> + +#define NTESTS 100 +#define NCYCLESPERTEST 1000 +#define NCYCLES (NTESTS*NCYCLESPERTEST) + +int requested; +assign requested to "requested"; + +int actual; +assign actual to "actual"; +monitor actual; + +evflag actualChanged; +sync actual actualChanged; + +entry { + seq_test_init(NTESTS); +} + +ss monitorEvflagTest { + int cycleCount = 1; + int error = 0; + state init { + when (delay(1.0)) { + efClear(actualChanged); + } state makeRequest + } + state makeRequest { + when (error || cycleCount > NCYCLES) { + } exit + when (cycleCount <= NCYCLES) { + requested = cycleCount; + pvPut(requested); + } state waitForActualToEqualRequested + } + state waitForActualToEqualRequested { + when (efTestAndClear(actualChanged) /* && actual == requested */) { + if (actual != requested) { + testFail("requested(%d)!=actual(%d)", requested, actual); + testSkip((NCYCLES-cycleCount)/NCYCLESPERTEST, "failure"); + error = TRUE; + } else if (cycleCount % NCYCLESPERTEST == 0) { + testPass("requested(%d)==actual(%d)", requested, actual); + } + cycleCount++; + } state makeRequest + when (delay(1.0)) { + testFail("timeout in cycle %d/%d (requested=%d, actual=%d)", + cycleCount + 1, NCYCLES, requested, actual); + testSkip((NCYCLES-cycleCount)/NCYCLESPERTEST, "failure"); + } exit + } +} + +exit { + seq_test_done(); +}