EPICS Base
7.0.6.1
|
Helpers for unittests of process database. More...
#include <stdarg.h>
#include "epicsUnitTest.h"
#include "dbAddr.h"
#include "dbCommon.h"
#include "dbCoreAPI.h"
Go to the source code of this file.
Typedefs | |
typedef struct testMonitor | testMonitor |
Functions | |
DBCORE_API void | testdbPrepare (void) |
DBCORE_API void | testdbReadDatabase (const char *file, const char *path, const char *substitutions) |
DBCORE_API void | testIocInitOk (void) |
DBCORE_API void | testIocShutdownOk (void) |
DBCORE_API void | testdbCleanup (void) |
DBCORE_API void | testdbPutFieldOk (const char *pv, int dbrType,...) |
DBCORE_API void | testdbPutFieldFail (long status, const char *pv, int dbrType,...) |
DBCORE_API long | testdbVPutField (const char *pv, short dbrType, va_list ap) |
DBCORE_API void | testdbGetFieldEqual (const char *pv, int dbrType,...) |
DBCORE_API void | testdbVGetFieldEqual (const char *pv, short dbrType, va_list ap) |
DBCORE_API void | testdbPutArrFieldOk (const char *pv, short dbrType, unsigned long count, const void *pbuf) |
DBCORE_API void | testdbGetArrFieldEqual (const char *pv, short dbfType, long nRequest, unsigned long pbufcnt, const void *pbuf) |
DBCORE_API dbCommon * | testdbRecordPtr (const char *pv) |
DBCORE_API testMonitor * | testMonitorCreate (const char *pvname, unsigned dbe_mask, unsigned opt) |
DBCORE_API void | testMonitorDestroy (testMonitor *) |
DBCORE_API void | testMonitorWait (testMonitor *) |
DBCORE_API unsigned | testMonitorCount (testMonitor *, unsigned reset) |
DBCORE_API void | testSyncCallback (void) |
DBCORE_API void | testGlobalLock (void) |
DBCORE_API void | testGlobalUnlock (void) |
Definition in file dbUnitTest.h.
DBCORE_API void testdbPrepare | ( | void | ) |
First step in test database setup
DBCORE_API void testdbReadDatabase | ( | const char * | file, |
const char * | path, | ||
const char * | substitutions | ||
) |
Read .dbd or .db file
DBCORE_API void testIocInitOk | ( | void | ) |
Assert success of iocInit()
DBCORE_API void testIocShutdownOk | ( | void | ) |
DBCORE_API void testdbCleanup | ( | void | ) |
Final step in test database cleanup
DBCORE_API void testdbPutFieldOk | ( | const char * | pv, |
int | dbrType, | ||
... | |||
) |
Assert that a dbPutField() scalar operation will complete successfully.
DBCORE_API void testdbPutFieldFail | ( | long | status, |
const char * | pv, | ||
int | dbrType, | ||
... | |||
) |
Assert that a dbPutField() operation will fail with a certain S_* code
DBCORE_API long testdbVPutField | ( | const char * | pv, |
short | dbrType, | ||
va_list | ap | ||
) |
Assert that a dbPutField() scalar operation will complete successfully.
DBCORE_API void testdbGetFieldEqual | ( | const char * | pv, |
int | dbrType, | ||
... | |||
) |
Assert that a dbGetField() scalar operation will complete successfully, with the provided value.
DBCORE_API void testdbVGetFieldEqual | ( | const char * | pv, |
short | dbrType, | ||
va_list | ap | ||
) |
Assert that a dbGetField() scalar operation will complete successfully, with the provided value.
DBCORE_API void testdbPutArrFieldOk | ( | const char * | pv, |
short | dbrType, | ||
unsigned long | count, | ||
const void * | pbuf | ||
) |
Assert that a dbPutField() array operation will complete successfully.
pv | a PV name, possibly including filter expression |
dbrType | a DBF_* type code (cf. dbfType in dbFldTypes.h) |
count | Number of elements in pbuf array |
pbuf | Array of values to write |
DBCORE_API void testdbGetArrFieldEqual | ( | const char * | pv, |
short | dbfType, | ||
long | nRequest, | ||
unsigned long | pbufcnt, | ||
const void * | pbuf | ||
) |
pv | PV name string |
dbfType | One of the DBF_* macros from dbAccess.h |
nRequest | Number of elements to request from pv |
pbufcnt | Number of elements pointed to be pbuf |
pbuf | Expected value buffer |
Execute dbGet() of nRequest elements and compare the result with pbuf (pbufcnt is an element count). Element size is derived from dbfType.
nRequest > pbufcnt will detect truncation. nRequest < pbufcnt always fails. nRequest ==pbufcnt checks prefix (actual may be longer than expected)
DBCORE_API dbCommon* testdbRecordPtr | ( | const char * | pv | ) |
Obtain pointer to record.
Calls testAbort() on failure. Will never return NULL.
DBCORE_API testMonitor* testMonitorCreate | ( | const char * | pvname, |
unsigned | dbe_mask, | ||
unsigned | opt | ||
) |
Setup monitoring the named PV for changes
DBCORE_API void testMonitorDestroy | ( | testMonitor * | ) |
Stop monitoring
DBCORE_API void testMonitorWait | ( | testMonitor * | ) |
Return immediately if it has been updated since create, last wait, or reset (count w/ reset=1). Otherwise, block until the value of the target PV is updated.
DBCORE_API unsigned testMonitorCount | ( | testMonitor * | , |
unsigned | reset | ||
) |
Return the number of monitor events which have occured since create, or a previous reset (called reset=1). Calling w/ reset=0 only returns the count. Calling w/ reset=1 resets the count to zero and ensures that the next wait will block unless subsequent events occur. Returns the previous count.
DBCORE_API void testSyncCallback | ( | void | ) |
Synchronize the shared callback queues.
Block until all callback queue jobs which were queued, or running, have completed.
DBCORE_API void testGlobalLock | ( | void | ) |
Lock Global convenience mutex for use by test code.
DBCORE_API void testGlobalUnlock | ( | void | ) |
Unlock Global convenience mutex for use by test code.