-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_suite_glue.c
287 lines (259 loc) · 6.48 KB
/
test_suite_glue.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#include <stdio.h>
#include <stdlib.h>
#include <uk/config.h>
#include <uk/essentials.h>
#include <test_suite_glue.h>
int libtasn1_test_main(int verbose) {
int argc = 1;
char **argv = NULL;
if(verbose)
argc++;
int testCounter = 0;
int errorCounter = 0;
int rc;
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_TREE
testCounter++;
printf("Running Test_tree ....................\n");
rc = Test_tree_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_CODING_DECODING2
testCounter++;
printf("Running coding-decoding2 .............\n");
rc = coding_decoding2_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_CODING_LONG_OID
testCounter++;
printf("Running coding-long-oid .............\n");
rc = coding_long_oid_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_COPYNODE
testCounter++;
printf("Running copynode ....................\n");
rc = copynode_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_CVE_2018_1000654
testCounter++;
printf("Running CVE_2018_1000654 ............\n");
rc = CVE_2018_1000654_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_OBJECT_ID_DECODING
testCounter++;
printf("Running object-id-decoding ..........\n");
rc = object_id_decoding_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_OBJECT_ID_ENCODING
testCounter++;
printf("Running object-id-encoding ..........\n");
rc = object_id_encoding_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_OCSP_BASIC_RESPONSE
testCounter++;
printf("Running ocsp-basic-response .........\n");
rc = ocsp_basic_response_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_OCTET_STRING
testCounter++;
printf("Running octet-string ................\n");
rc = octet_string_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_REPRODUCERS
testCounter++;
printf("Running reproducers .................\n");
rc = reproducers_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_SETOF
testCounter++;
printf("Running setof .......................\n");
rc = setof_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_SPC_PE_IMAGE_DATA
testCounter++;
printf("Running spc_pe_image_data ...........\n");
rc = spc_pe_image_data_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_STRICT_DER
testCounter++;
printf("Running strict-der ..................\n");
rc = strict_der_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_CHOICE_OCSP
testCounter++;
printf("Running Test_choice_ocsp .............\n");
rc = Test_choice_ocsp_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_ENCDEC
testCounter++;
printf("Running Test_encdec .................\n");
rc = Test_encdec_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_ENCODING
testCounter++;
printf("Running Test_encoding ...............\n");
rc = Test_encoding_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_ERRORS
testCounter++;
printf("Running Test_errors .................\n");
rc = Test_errors_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_INDEFINITE
testCounter++;
printf("Running Test_indefinite .............\n");
rc = Test_indefinite_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_OVERFLOW
testCounter++;
printf("Running Test_overflow ...............\n");
rc = Test_overflow_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_PARSER
testCounter++;
printf("Running Test_parser .................\n");
rc = Test_parser_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_SIMPLE
testCounter++;
printf("Running Test_simple .................\n");
rc = Test_simple_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
#if CONFIG_ALL_TEST_CASES || CONFIG_TEST_STRINGS
testCounter++;
printf("Running Test_strings ................\n");
rc = Test_strings_main(argc, argv);
if(rc == 0)
printf("PASS\n");
else {
printf("FAIL\n");
errorCounter++;
}
#endif
printf ("Total tests : %d\n", testCounter);
printf ("Total errors: %d\n", errorCounter);
return errorCounter;
}