EPICS Base  7.0.5.1
dbUnitTest.h
1 /*************************************************************************\
2 * Copyright (c) 2013 Brookhaven National Laboratory.
3 * Copyright (c) 2013 ITER Organization.
4 * SPDX-License-Identifier: EPICS
5 * EPICS BASE is distributed subject to a Software License Agreement found
6 * in file LICENSE that is included with this distribution.
7  \*************************************************************************/
8 
9 /*
10  * Author: Michael Davidsaver <mdavidsaver@bnl.gov>
11  * Ralph Lange <Ralph.Lange@gmx.de>
12  */
13 
14 #ifndef EPICSUNITTESTDB_H
15 #define EPICSUNITTESTDB_H
16 
17 #include <stdarg.h>
18 
19 #include "epicsUnitTest.h"
20 #include "dbAddr.h"
21 #include "dbCommon.h"
22 
23 #include "shareLib.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 epicsShareFunc void testdbPrepare(void);
30 epicsShareFunc void testdbReadDatabase(const char* file,
31  const char* path,
32  const char* substitutions);
33 epicsShareFunc void testIocInitOk(void);
34 epicsShareFunc void testIocShutdownOk(void);
35 epicsShareFunc void testdbCleanup(void);
36 
37 /* Correct argument types must be used with this var-arg function!
38  * Doing otherwise will result in corruption of argument values!
39  *
40  * int for DBR_UCHAR, DBR_CHAR, DBR_USHORT, DBR_SHORT, DBR_LONG
41  * unsigned int for DBR_ULONG
42  * long long for DBF_INT64
43  * unsigned long long for DBF_UINT64
44  * double for DBR_FLOAT and DBR_DOUBLE
45  * const char* for DBR_STRING
46  *
47  * eg.
48  * testdbPutFieldOk("pvname", DBF_ULONG, (unsigned int)5);
49  * testdbPutFieldOk("pvname", DBF_FLOAT, (double)4.1);
50  * testdbPutFieldOk("pvname", DBF_STRING, "hello world");
51  */
52 epicsShareFunc void testdbPutFieldOk(const char* pv, int dbrType, ...);
53 /* Tests for put failure */
54 epicsShareFunc void testdbPutFieldFail(long status, const char* pv, int dbrType, ...);
55 
56 epicsShareFunc long testdbVPutField(const char* pv, short dbrType, va_list ap);
57 
58 epicsShareFunc void testdbGetFieldEqual(const char* pv, int dbrType, ...);
59 epicsShareFunc void testdbVGetFieldEqual(const char* pv, short dbrType, va_list ap);
60 
61 epicsShareFunc void testdbPutArrFieldOk(const char* pv, short dbrType, unsigned long count, const void *pbuf);
62 
78 epicsShareFunc void testdbGetArrFieldEqual(const char* pv, short dbfType, long nRequest, unsigned long pbufcnt, const void *pbuf);
79 
80 epicsShareFunc dbCommon* testdbRecordPtr(const char* pv);
81 
82 typedef struct testMonitor testMonitor;
83 
84 /* Begin monitoring the named PV for changes */
85 epicsShareFunc testMonitor* testMonitorCreate(const char* pvname, unsigned dbe_mask, unsigned opt);
86 /* End monitoring */
87 epicsShareFunc void testMonitorDestroy(testMonitor*);
88 /* Return immediately if it has been updated since create, last wait,
89  * or reset (count w/ reset=1).
90  * Otherwise, block until the value of the target PV is updated.
91  */
92 epicsShareFunc void testMonitorWait(testMonitor*);
93 /* Return the number of monitor events which have occured since create,
94  * or a pervious reset (called reset=1).
95  * Calling w/ reset=0 only returns the count.
96  * Calling w/ reset=1 resets the count to zero and ensures that the next
97  * wait will block unless subsequent events occur. Returns the previous
98  * count.
99  */
100 epicsShareFunc unsigned testMonitorCount(testMonitor*, unsigned reset);
101 
107 epicsShareFunc void testSyncCallback(void);
108 
158 epicsShareFunc void testGlobalLock(void);
159 epicsShareFunc void testGlobalUnlock(void);
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif // EPICSUNITTESTDB_H
Unit test routines.
Declaration of dbCommon.
Definition: dbCommon.h:18
Mark external symbols and entry points for shared libraries.
Declarations for the dbCommon record type.