netatalk  4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
testhelper.h
Go to the documentation of this file.
1/* -------------------------------- */
2#ifndef TESTHELPER_H
3#define TESTHELPER_H
4
5/* Macros */
6#define FAIL(a) \
7 if ((a)) { \
8 if (!Quiet) { \
9 if (Color) { \
10 fprintf(stdout, ANSI_BRED"[%s:%d] " #a "\n" ANSI_NORMAL, __FILE__, __LINE__);\
11 } else {\
12 fprintf(stdout, "[%s:%d] " #a "\n", __FILE__, __LINE__); \
13 } \
14 } \
15 test_failed(); \
16 }
17
18#define FAILEXIT(a, label) if ((a)) { test_failed(); goto label;}
19#define STATIC
20
21#define ENTER_TESTSET \
22 fprintf(stdout,"===================\n"); \
23 fprintf(stdout,"Executing testset: %s\n", __func__); \
24
25#define ENTER_TEST \
26 if (!Quiet) { \
27 fprintf(stdout, "############## entering %s ##############\n", __func__); \
28 } \
29 enter_test(); \
30
31/* Skipped test status codes */
32#define T_CONN2 1
33#define T_PATH 2
34#define T_AFP3 3
35#if 0
36#define T_AFP3_CONN2 4
37#define T_MAC_PATH 5
38#endif
39#define T_UNIX_PREV 6
40#define T_UTF8 7
41#define T_VOL2 8
42#define T_LOCKING 9
43#define T_VOL_SMALL 10
44#define T_ID 11
45#define T_AFP2 12
46#define T_MAC 13
47#define T_ACL 14
48#define T_EA 15
49#define T_UNIX_GROUP 16
50#define T_ADEA 17
51#define T_NOSYML 18
52#define T_ADV2 19
53#define T_AFP30 20
54#define T_NO_UNIX_PREV 21
55#define T_SINGLE 22
56#define T_VOL_BIG 23
57#if 0
58#define T_EXCLUDE 24
59#endif
60#define T_MANUAL 25
61#define T_AFP31 26
62#define T_AFP32 27
63#define T_NONDETERM 28
64#if 0
65#define T_BIGENDIAN 29
66#endif
67#define T_CRED 30
68#define T_LOCALHOST 31
69#define T_V2CONV 32
70#define T_EXTMAP 33
71#define T_UAM 34
72
73/* Define ansi colors */
74#define ANSI_RED "\033[0;31m"
75#define ANSI_GREEN "\033[0;32m"
76#define ANSI_YELLOW "\033[0;33m"
77#define ANSI_BLUE "\033[0;34m"
78#define ANSI_MAGENTA "\033[0;35m"
79#define ANSI_CYAN "\033[0;36m"
80#define ANSI_GREY "\033[0;37m"
81#define ANSI_DARKGREY "\033[01;30m"
82#define ANSI_BRED "\033[01;31m"
83#define ANSI_BGREEN "\033[01;32m"
84#define ANSI_BYELLOW "\033[01;33m"
85#define ANSI_BBLUE "\033[01;34m"
86#define ANSI_BMAGENTA "\033[01;35m"
87#define ANSI_BCYAN "\033[01;36m"
88#define ANSI_WHITE "\033[01;37m"
89#define ANSI_NORMAL "\033[0m"
90#define ANSI_BOLD "\033[1m"
91
92/* Function declarations */
93extern void test_failed_at(const char *file, int line);
94extern void test_skipped(int why);
95extern void test_nottested(void);
96extern void enter_test(void);
97extern void exit_test(char *name);
98
99/* Wrapper macro for automatic file/line tracking */
100#define test_failed() test_failed_at(__FILE__, __LINE__)
101
102/* Types — `enum ad_format` (renamed from `enum adouble` to avoid a
103 * tag collision with `struct adouble` in <atalk/adouble.h>, which is
104 * now reachable via afpclient.h's include chain). */
106 AD_EA = 1,
108};
109
110/* Global variables */
111extern uint16_t VolID;
112extern int Mac;
113extern int ExitCode;
114extern enum ad_format adouble;
115
116extern char Data[];
117extern char FailedTests[1024][256];
118extern char NotTestedTests[1024][256];
119extern char SkippedTests[1024][256];
120
121extern char *Vol;
122extern char *Vol2;
123extern char *Path;
124extern char *User;
125extern char *Test;
126extern char *Server;
127
128extern int Version;
129extern int Verbose;
130extern int Quiet;
131extern int Locking;
132extern int Loglevel;
133extern int Color;
134extern int Interactive;
135extern int Throttle;
136extern int EmptyVol;
137
138extern int PassCount;
139extern int FailCount;
140extern int SkipCount;
141extern int NotTestedCount;
142
143#endif
uint16_t VolID
Definition afparg.c:51
char * User
Definition afparg.c:61
int SkipCount
Definition afparg.c:77
int PassCount
Definition afparg.c:75
char * Test
Definition afparg.c:64
char SkippedTests[1024][256]
Definition afparg.c:81
char * Vol
Definition afparg.c:60
int Version
Definition afparg.c:62
char * Server
Definition afparg.c:57
int EmptyVol
Definition afparg.c:73
char Data[1]
Definition afparg.c:74
char NotTestedTests[1024][256]
Definition afparg.c:80
int Mac
Definition afparg.c:72
int NotTestedCount
Definition afparg.c:78
int ExitCode
Definition afparg.c:50
int FailCount
Definition afparg.c:76
char FailedTests[1024][256]
Definition afparg.c:79
int Throttle
Definition afpclient.c:13
int Quiet
Definition afpclient.c:16
int Interactive
Definition afpclient.c:15
int Color
Definition afpclient.c:18
int Verbose
Definition afpclient.c:17
int Loglevel
Definition afphelper.c:18
char * Path
Definition lantest.c:114
char * Vol2
Definition spectest.c:353
int Locking
Definition spectest.c:361
Definition adouble.h:198
void test_skipped(int why)
Definition testhelper.c:23
void test_failed_at(const char *file, int line)
Definition testhelper.c:161
void exit_test(char *name)
Definition testhelper.c:208
void enter_test(void)
Definition testhelper.c:189
void test_nottested(void)
Definition testhelper.c:175
ad_format
Definition testhelper.h:105
@ AD_EA
Definition testhelper.h:106
@ AD_V2
Definition testhelper.h:107