This is Unofficial EPICS BASE Doxygen Site
testMain.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * EPICS BASE is distributed subject to a Software License Agreement found
5 * in file LICENSE that is included with this distribution.
6 \*************************************************************************/
7 
8 #ifndef INC_testMain_H
9 #define INC_testMain_H
10 
11 /* This header defines a convenience macro for use by pure test programs.
12  * A pure test program cannot take any arguments since it must be fully
13  * automatable. If your program needs to use argv/argc, it may be doing
14  * measurements not unit and/or regression testing. On Host architectures
15  * these programs needs to be named main and take dummy argc/argv args,
16  * but on vxWorks and RTEMS they must be named as the test program.
17  *
18  * Use this macro as follows:
19  *
20  * #include "testMain.h"
21  * #include "epicsUnitTest.h"
22  *
23  * MAIN(myProgTest) {
24  * testPlan(...);
25  * testOk(...)
26  * return testDone();
27  * }
28  */
29 
30 #if defined(__rtems__)
31  #ifdef __cplusplus
32  #define MAIN(prog) extern "C" int prog(void); extern "C" int main() __attribute__((weak, alias(#prog))); extern "C" int prog(void)
33  #else
34  #define MAIN(prog) int prog(); int main() __attribute__((weak, alias(#prog))); int prog()
35  #endif
36 #elif defined(vxWorks)
37  #ifdef __cplusplus
38  #define MAIN(prog) extern "C" int prog(void)
39  #else
40  #define MAIN(prog) int prog()
41  #endif
42 #else
43  #ifdef __cplusplus
44  #define MAIN(prog) int main(int /*argc*/, char * /*argv*/ [] )
45  #else
46  #define MAIN(prog) int main(int argc, char *argv[] )
47  #endif
48 #endif
49 
50 
51 #endif /* INC_testMain_H */