Fix decimate filter for testing on VxWorks

Also adds checks to all filter tests to abort if they
can't continue because their filter wasn't registered.
This commit is contained in:
Andrew Johnson
2022-07-08 15:55:14 -05:00
parent 83a685867c
commit 5f02bad3fc
5 changed files with 23 additions and 9 deletions
+9 -5
View File
@@ -19,6 +19,7 @@
#include "freeList.h"
#include "db_field_log.h"
#include "chfPlugin.h"
#include "epicsExit.h"
#include "epicsExport.h"
typedef struct myStruct {
@@ -102,17 +103,20 @@ static chfPluginIf pif = {
NULL /* channel_close */
};
static void decShutdown(void *ignore)
{
if (myStructFreeList)
freeListCleanup(myStructFreeList);
myStructFreeList = NULL;
}
static void decInitialize(void)
{
static int firstTime = 1;
if (!firstTime) return;
firstTime = 0;
if (!myStructFreeList)
freeListInitPvt(&myStructFreeList, sizeof(myStruct), 64);
chfPluginRegister("dec", &pif, opts);
epicsAtExit(decShutdown, NULL);
}
epicsExportRegistrar(decInitialize);
@@ -321,7 +321,10 @@ MAIN(arrTest)
evtctx = db_init_events();
testOk(!!(plug = dbFindFilter(arr, strlen(arr))), "plugin arr registered correctly");
plug = dbFindFilter(arr, strlen(arr));
if (!plug)
testAbort("plugin '%s' not registered", arr);
testPass("plugin '%s' registered correctly", arr);
check(DBR_LONG);
check(DBR_DOUBLE);
+4 -2
View File
@@ -145,8 +145,10 @@ MAIN(decTest)
evtctx = db_init_events();
testOk(!!(plug = dbFindFilter(myname, strlen(myname))),
"plugin '%s' registered correctly", myname);
plug = dbFindFilter(myname, strlen(myname));
if (!plug)
testAbort("Plugin '%s' not registered", myname);
testPass("plugin '%s' registered correctly", myname);
/* N < 1 */
testOk(!(pch = dbChannelCreate("x.VAL{dec:{n:-1}}")),
@@ -223,6 +223,8 @@ MAIN(syncTest)
testOk(!!(plug = dbFindFilter(myname, strlen(myname))), "plugin %s registered correctly", myname);
testOk(!!(red = dbStateCreate("red")), "state 'red' created successfully");
if (!plug || !red)
testAbort("Can't continue given above failure(s)");
/* nonexisting state */
testOk(!(pch = dbChannelCreate("x.VAL{sync:{m:'while',s:'blue'}}")),
+4 -1
View File
@@ -72,7 +72,10 @@ MAIN(tsTest)
evtctx = db_init_events();
testOk(!!(plug = dbFindFilter(ts, strlen(ts))), "plugin ts registered correctly");
plug = dbFindFilter(ts, strlen(ts));
if (!plug)
testAbort("plugin '%s' not registered", ts);
testPass("plugin '%s' registered correctly", ts);
testOk(!!(pch = dbChannelCreate("x.VAL{ts:{}}")), "dbChannel with plugin ts created");
testOk((ellCount(&pch->filters) == 1), "channel has one plugin");