forked from libcheck/check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_output_strings
336 lines (323 loc) · 11.9 KB
/
test_output_strings
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#!/usr/bin/env sh
. ./test_vars
# Set the 'internal field separator' character to
# something besides whitespace so that the string
# comparisons will work
IFS="~"
# octal quotes are specified by POSIX, should be thus portable
# (e.g. to Lubuntu builtin printf, Solaris 10 /usr/bin/printf)
tab_nl_X_bs="\11 \12X\10"
##################
# stdout output
##################
suite_output=`printf "Running suite(s): S1
S2
XML escape \" ' < > & $tab_nl_X_bs tests"`
exp_silent=""
if [ $HAVE_FORK -eq 1 ]; then
exp_minimal_result="37%: Checks: 8, Failures: 4, Errors: 1"
else
exp_minimal_result="42%: Checks: 7, Failures: 4, Errors: 0"
fi
exp_minimal="$suite_output
$exp_minimal_result"
if [ $HAVE_FORK -eq 1 ]; then
exp_normal_result=`printf "37%%: Checks: 8, Failures: 4, Errors: 1
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure
${SRCDIR}ex_output.c:46:E:Core:test_exit:0: (after this point) Early exit with return value 1
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message"`
else
exp_normal_result=`printf "42%%: Checks: 7, Failures: 4, Errors: 0
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message"`
fi
exp_normal="$suite_output
$exp_normal_result"
if [ $HAVE_FORK -eq 1 ]; then
exp_verbose_result=`printf "37%%: Checks: 8, Failures: 4, Errors: 1
${SRCDIR}ex_output.c:31:P:Core:test_pass:0: Passed
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure
${SRCDIR}ex_output.c:46:E:Core:test_exit:0: (after this point) Early exit with return value 1
${SRCDIR}ex_output.c:66:P:Core:test_pass2:0: Passed
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed
${SRCDIR}ex_output.c:72:P:Core:test_loop:1: Passed
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message"`
else
exp_verbose_result=`printf "42%%: Checks: 7, Failures: 4, Errors: 0
${SRCDIR}ex_output.c:31:P:Core:test_pass:0: Passed
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure
${SRCDIR}ex_output.c:66:P:Core:test_pass2:0: Passed
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed
${SRCDIR}ex_output.c:72:P:Core:test_loop:1: Passed
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message"`
fi
exp_verbose="$suite_output
$exp_verbose_result"
if [ $HAVE_FORK -eq 1 ]; then
exp_subunit=`printf "test: Core:test_pass
success: Core:test_pass
test: Core:test_fail
failure: Core:test_fail [
${SRCDIR}ex_output.c:37: Failure
]
test: Core:test_exit
error: Core:test_exit [
${SRCDIR}ex_output.c:46: (after this point) Early exit with return value 1
]
test: Core:test_pass2
success: Core:test_pass2
test: Core:test_loop
failure: Core:test_loop [
${SRCDIR}ex_output.c:72: Iteration 0 failed
]
test: Core:test_loop
success: Core:test_loop
test: Core:test_loop
failure: Core:test_loop [
${SRCDIR}ex_output.c:72: Iteration 2 failed
]
test: description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg
failure: description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg [
${SRCDIR}ex_output.c:78: fail \" ' < > & $tab_nl_X_bs message
]"`
else
exp_subunit=`printf "test: Core:test_pass
success: Core:test_pass
test: Core:test_fail
failure: Core:test_fail [
${SRCDIR}ex_output.c:37: Failure
]
test: Core:test_pass2
success: Core:test_pass2
test: Core:test_loop
failure: Core:test_loop [
${SRCDIR}ex_output.c:72: Iteration 0 failed
]
test: Core:test_loop
success: Core:test_loop
test: Core:test_loop
failure: Core:test_loop [
${SRCDIR}ex_output.c:72: Iteration 2 failed
]
test: description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg
failure: description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg [
${SRCDIR}ex_output.c:78: fail \" ' < > & $tab_nl_X_bs message
]"`
fi
##################
# log output
##################
if [ $HAVE_FORK -eq 1 ]; then
expected_log_log=`printf "Running suite S1
${SRCDIR}ex_output.c:31:P:Core:test_pass:0: Passed
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure
${SRCDIR}ex_output.c:46:E:Core:test_exit:0: (after this point) Early exit with return value 1
Running suite S2
${SRCDIR}ex_output.c:66:P:Core:test_pass2:0: Passed
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed
${SRCDIR}ex_output.c:72:P:Core:test_loop:1: Passed
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed
Running suite XML escape \" ' < > & $tab_nl_X_bs tests
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message
Results for all suites run:
37%%: Checks: 8, Failures: 4, Errors: 1"`
else
expected_log_log=`printf "Running suite S1
${SRCDIR}ex_output.c:31:P:Core:test_pass:0: Passed
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure
Running suite S2
${SRCDIR}ex_output.c:66:P:Core:test_pass2:0: Passed
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed
${SRCDIR}ex_output.c:72:P:Core:test_loop:1: Passed
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed
Running suite XML escape \" ' < > & $tab_nl_X_bs tests
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message
Results for all suites run:
42%%: Checks: 7, Failures: 4, Errors: 0"`
fi
##################
# xml output
##################
if [ $HAVE_FORK -eq 1 ]; then
expected_xml="<?xml version=\"1.0\"?>
<?xml-stylesheet type=\"text/xsl\" href=\"http://check.sourceforge.net/xml/check_unittest.xslt\"?>
<testsuites xmlns=\"http://check.sourceforge.net/ns\">
<suite>
<title>S1</title>
<test result=\"success\">
<fn>ex_output.c:31</fn>
<id>test_pass</id>
<iteration>0</iteration>
<description>Core</description>
<message>Passed</message>
</test>
<test result=\"failure\">
<fn>ex_output.c:37</fn>
<id>test_fail</id>
<iteration>0</iteration>
<description>Core</description>
<message>Failure</message>
</test>
<test result=\"error\">
<fn>ex_output.c:46</fn>
<id>test_exit</id>
<iteration>0</iteration>
<description>Core</description>
<message>Early exit with return value 1</message>
</test>
</suite>
<suite>
<title>S2</title>
<test result=\"success\">
<fn>ex_output.c:66</fn>
<id>test_pass2</id>
<iteration>0</iteration>
<description>Core</description>
<message>Passed</message>
</test>
<test result=\"failure\">
<fn>ex_output.c:72</fn>
<id>test_loop</id>
<iteration>0</iteration>
<description>Core</description>
<message>Iteration 0 failed</message>
</test>
<test result=\"success\">
<fn>ex_output.c:72</fn>
<id>test_loop</id>
<iteration>1</iteration>
<description>Core</description>
<message>Passed</message>
</test>
<test result=\"failure\">
<fn>ex_output.c:72</fn>
<id>test_loop</id>
<iteration>2</iteration>
<description>Core</description>
<message>Iteration 2 failed</message>
</test>
</suite>
<suite>
<title>XML escape " ' < > & 	 
X tests</title>
<test result=\"failure\">
<fn>ex_output.c:78</fn>
<id>test_xml_esc_fail_msg</id>
<iteration>0</iteration>
<description>description " ' < > & 	 
X end</description>
<message>fail " ' < > & 	 
X message</message>
</test>
</suite>
</testsuites>"
expected_duration_count=9
else
expected_xml="<?xml version=\"1.0\"?>
<?xml-stylesheet type=\"text/xsl\" href=\"http://check.sourceforge.net/xml/check_unittest.xslt\"?>
<testsuites xmlns=\"http://check.sourceforge.net/ns\">
<suite>
<title>S1</title>
<test result=\"success\">
<fn>ex_output.c:31</fn>
<id>test_pass</id>
<iteration>0</iteration>
<description>Core</description>
<message>Passed</message>
</test>
<test result=\"failure\">
<fn>ex_output.c:37</fn>
<id>test_fail</id>
<iteration>0</iteration>
<description>Core</description>
<message>Failure</message>
</test>
</suite>
<suite>
<title>S2</title>
<test result=\"success\">
<fn>ex_output.c:66</fn>
<id>test_pass2</id>
<iteration>0</iteration>
<description>Core</description>
<message>Passed</message>
</test>
<test result=\"failure\">
<fn>ex_output.c:72</fn>
<id>test_loop</id>
<iteration>0</iteration>
<description>Core</description>
<message>Iteration 0 failed</message>
</test>
<test result=\"success\">
<fn>ex_output.c:72</fn>
<id>test_loop</id>
<iteration>1</iteration>
<description>Core</description>
<message>Passed</message>
</test>
<test result=\"failure\">
<fn>ex_output.c:72</fn>
<id>test_loop</id>
<iteration>2</iteration>
<description>Core</description>
<message>Iteration 2 failed</message>
</test>
</suite>
<suite>
<title>XML escape " ' < > & 	 
X tests</title>
<test result=\"failure\">
<fn>ex_output.c:78</fn>
<id>test_xml_esc_fail_msg</id>
<iteration>0</iteration>
<description>description " ' < > & 	 
X end</description>
<message>fail " ' < > & 	 
X message</message>
</test>
</suite>
</testsuites>"
expected_duration_count=8
fi
##################
# tap output
##################
if [ $HAVE_FORK -eq 1 ]; then
expected_normal_tap=`printf "ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed
not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure
not ok 3 - ${SRCDIR}ex_output.c:Core:test_exit: Early exit with return value 1
ok 4 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed
not ok 5 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed
ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Passed
not ok 7 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed
not ok 8 - ${SRCDIR}ex_output.c:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg: fail \" ' < > & $tab_nl_X_bs message
1..8"`
expected_aborted_tap=`printf "ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed
not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure
not ok 3 - ${SRCDIR}ex_output.c:Core:test_exit: Early exit with return value 1
not ok 4 - ${SRCDIR}ex_output.c:Core:test_abort: Early exit with return value 1
ok 5 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed
not ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed
ok 7 - ${SRCDIR}ex_output.c:Core:test_loop: Passed
not ok 8 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed
not ok 9 - ${SRCDIR}ex_output.c:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg: fail \" ' < > & $tab_nl_X_bs message
1..9"`
else
expected_normal_tap=`printf "ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed
not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure
ok 3 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed
not ok 4 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed
ok 5 - ${SRCDIR}ex_output.c:Core:test_loop: Passed
not ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed
not ok 7 - ${SRCDIR}ex_output.c:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg: fail \" ' < > & $tab_nl_X_bs message
1..7"`
# When fork() is unavailable, one of the tests
# will invoke exit() which will terminate the
# unit testing program. In that case, the tap
# results will be incomplete, but the required
# test plan will be missing, signaling that
# something bad happened.
expected_aborted_tap="ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed
not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure"
fi