| 1 |
#!/usr/bin/env sh |
| 2 |
|
| 3 |
. ./test_vars |
| 4 |
|
| 5 |
# Set the 'internal field separator' character to |
| 6 |
# something besides whitespace so that the string |
| 7 |
# comparisons will work |
| 8 |
IFS="~" |
| 9 |
|
| 10 |
# octal quotes are specified by POSIX, should be thus portable |
| 11 |
# (e.g. to Lubuntu builtin printf, Solaris 10 /usr/bin/printf) |
| 12 |
tab_nl_X_bs="\11 \12X\10" |
| 13 |
|
| 14 |
################## |
| 15 |
# stdout output |
| 16 |
################## |
| 17 |
suite_output=`printf "Running suite(s): S1 |
| 18 |
S2 |
| 19 |
XML escape \" ' < > & $tab_nl_X_bs tests"` |
| 20 |
|
| 21 |
exp_silent="" |
| 22 |
|
| 23 |
if [ $HAVE_FORK -eq 1 ]; then |
| 24 |
exp_minimal_result="37%: Checks: 8, Failures: 4, Errors: 1" |
| 25 |
else |
| 26 |
exp_minimal_result="42%: Checks: 7, Failures: 4, Errors: 0" |
| 27 |
fi |
| 28 |
exp_minimal="$suite_output |
| 29 |
$exp_minimal_result" |
| 30 |
|
| 31 |
if [ $HAVE_FORK -eq 1 ]; then |
| 32 |
exp_normal_result=`printf "37%%: Checks: 8, Failures: 4, Errors: 1 |
| 33 |
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure |
| 34 |
${SRCDIR}ex_output.c:46:E:Core:test_exit:0: (after this point) Early exit with return value 1 |
| 35 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed |
| 36 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed |
| 37 |
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message"` |
| 38 |
else |
| 39 |
exp_normal_result=`printf "42%%: Checks: 7, Failures: 4, Errors: 0 |
| 40 |
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure |
| 41 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed |
| 42 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed |
| 43 |
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message"` |
| 44 |
fi |
| 45 |
exp_normal="$suite_output |
| 46 |
$exp_normal_result" |
| 47 |
|
| 48 |
|
| 49 |
if [ $HAVE_FORK -eq 1 ]; then |
| 50 |
exp_verbose_result=`printf "37%%: Checks: 8, Failures: 4, Errors: 1 |
| 51 |
${SRCDIR}ex_output.c:31:P:Core:test_pass:0: Passed |
| 52 |
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure |
| 53 |
${SRCDIR}ex_output.c:46:E:Core:test_exit:0: (after this point) Early exit with return value 1 |
| 54 |
${SRCDIR}ex_output.c:66:P:Core:test_pass2:0: Passed |
| 55 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed |
| 56 |
${SRCDIR}ex_output.c:72:P:Core:test_loop:1: Passed |
| 57 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed |
| 58 |
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message"` |
| 59 |
else |
| 60 |
exp_verbose_result=`printf "42%%: Checks: 7, Failures: 4, Errors: 0 |
| 61 |
${SRCDIR}ex_output.c:31:P:Core:test_pass:0: Passed |
| 62 |
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure |
| 63 |
${SRCDIR}ex_output.c:66:P:Core:test_pass2:0: Passed |
| 64 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed |
| 65 |
${SRCDIR}ex_output.c:72:P:Core:test_loop:1: Passed |
| 66 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed |
| 67 |
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message"` |
| 68 |
fi |
| 69 |
exp_verbose="$suite_output |
| 70 |
$exp_verbose_result" |
| 71 |
|
| 72 |
if [ $HAVE_FORK -eq 1 ]; then |
| 73 |
exp_subunit=`printf "test: Core:test_pass |
| 74 |
success: Core:test_pass |
| 75 |
test: Core:test_fail |
| 76 |
failure: Core:test_fail [ |
| 77 |
${SRCDIR}ex_output.c:37: Failure |
| 78 |
] |
| 79 |
test: Core:test_exit |
| 80 |
error: Core:test_exit [ |
| 81 |
${SRCDIR}ex_output.c:46: (after this point) Early exit with return value 1 |
| 82 |
] |
| 83 |
test: Core:test_pass2 |
| 84 |
success: Core:test_pass2 |
| 85 |
test: Core:test_loop |
| 86 |
failure: Core:test_loop [ |
| 87 |
${SRCDIR}ex_output.c:72: Iteration 0 failed |
| 88 |
] |
| 89 |
test: Core:test_loop |
| 90 |
success: Core:test_loop |
| 91 |
test: Core:test_loop |
| 92 |
failure: Core:test_loop [ |
| 93 |
${SRCDIR}ex_output.c:72: Iteration 2 failed |
| 94 |
] |
| 95 |
test: description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg |
| 96 |
failure: description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg [ |
| 97 |
${SRCDIR}ex_output.c:78: fail \" ' < > & $tab_nl_X_bs message |
| 98 |
]"` |
| 99 |
else |
| 100 |
exp_subunit=`printf "test: Core:test_pass |
| 101 |
success: Core:test_pass |
| 102 |
test: Core:test_fail |
| 103 |
failure: Core:test_fail [ |
| 104 |
${SRCDIR}ex_output.c:37: Failure |
| 105 |
] |
| 106 |
test: Core:test_pass2 |
| 107 |
success: Core:test_pass2 |
| 108 |
test: Core:test_loop |
| 109 |
failure: Core:test_loop [ |
| 110 |
${SRCDIR}ex_output.c:72: Iteration 0 failed |
| 111 |
] |
| 112 |
test: Core:test_loop |
| 113 |
success: Core:test_loop |
| 114 |
test: Core:test_loop |
| 115 |
failure: Core:test_loop [ |
| 116 |
${SRCDIR}ex_output.c:72: Iteration 2 failed |
| 117 |
] |
| 118 |
test: description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg |
| 119 |
failure: description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg [ |
| 120 |
${SRCDIR}ex_output.c:78: fail \" ' < > & $tab_nl_X_bs message |
| 121 |
]"` |
| 122 |
fi |
| 123 |
|
| 124 |
################## |
| 125 |
# log output |
| 126 |
################## |
| 127 |
if [ $HAVE_FORK -eq 1 ]; then |
| 128 |
expected_log_log=`printf "Running suite S1 |
| 129 |
${SRCDIR}ex_output.c:31:P:Core:test_pass:0: Passed |
| 130 |
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure |
| 131 |
${SRCDIR}ex_output.c:46:E:Core:test_exit:0: (after this point) Early exit with return value 1 |
| 132 |
Running suite S2 |
| 133 |
${SRCDIR}ex_output.c:66:P:Core:test_pass2:0: Passed |
| 134 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed |
| 135 |
${SRCDIR}ex_output.c:72:P:Core:test_loop:1: Passed |
| 136 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed |
| 137 |
Running suite XML escape \" ' < > & $tab_nl_X_bs tests |
| 138 |
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message |
| 139 |
Results for all suites run: |
| 140 |
37%%: Checks: 8, Failures: 4, Errors: 1"` |
| 141 |
else |
| 142 |
expected_log_log=`printf "Running suite S1 |
| 143 |
${SRCDIR}ex_output.c:31:P:Core:test_pass:0: Passed |
| 144 |
${SRCDIR}ex_output.c:37:F:Core:test_fail:0: Failure |
| 145 |
Running suite S2 |
| 146 |
${SRCDIR}ex_output.c:66:P:Core:test_pass2:0: Passed |
| 147 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:0: Iteration 0 failed |
| 148 |
${SRCDIR}ex_output.c:72:P:Core:test_loop:1: Passed |
| 149 |
${SRCDIR}ex_output.c:72:F:Core:test_loop:2: Iteration 2 failed |
| 150 |
Running suite XML escape \" ' < > & $tab_nl_X_bs tests |
| 151 |
${SRCDIR}ex_output.c:78:F:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg:0: fail \" ' < > & $tab_nl_X_bs message |
| 152 |
Results for all suites run: |
| 153 |
42%%: Checks: 7, Failures: 4, Errors: 0"` |
| 154 |
fi |
| 155 |
|
| 156 |
################## |
| 157 |
# xml output |
| 158 |
################## |
| 159 |
if [ $HAVE_FORK -eq 1 ]; then |
| 160 |
expected_xml="<?xml version=\"1.0\"?> |
| 161 |
<?xml-stylesheet type=\"text/xsl\" href=\"http://check.sourceforge.net/xml/check_unittest.xslt\"?> |
| 162 |
<testsuites xmlns=\"http://check.sourceforge.net/ns\"> |
| 163 |
<suite> |
| 164 |
<title>S1</title> |
| 165 |
<test result=\"success\"> |
| 166 |
<fn>ex_output.c:31</fn> |
| 167 |
<id>test_pass</id> |
| 168 |
<iteration>0</iteration> |
| 169 |
<description>Core</description> |
| 170 |
<message>Passed</message> |
| 171 |
</test> |
| 172 |
<test result=\"failure\"> |
| 173 |
<fn>ex_output.c:37</fn> |
| 174 |
<id>test_fail</id> |
| 175 |
<iteration>0</iteration> |
| 176 |
<description>Core</description> |
| 177 |
<message>Failure</message> |
| 178 |
</test> |
| 179 |
<test result=\"error\"> |
| 180 |
<fn>ex_output.c:46</fn> |
| 181 |
<id>test_exit</id> |
| 182 |
<iteration>0</iteration> |
| 183 |
<description>Core</description> |
| 184 |
<message>Early exit with return value 1</message> |
| 185 |
</test> |
| 186 |
</suite> |
| 187 |
<suite> |
| 188 |
<title>S2</title> |
| 189 |
<test result=\"success\"> |
| 190 |
<fn>ex_output.c:66</fn> |
| 191 |
<id>test_pass2</id> |
| 192 |
<iteration>0</iteration> |
| 193 |
<description>Core</description> |
| 194 |
<message>Passed</message> |
| 195 |
</test> |
| 196 |
<test result=\"failure\"> |
| 197 |
<fn>ex_output.c:72</fn> |
| 198 |
<id>test_loop</id> |
| 199 |
<iteration>0</iteration> |
| 200 |
<description>Core</description> |
| 201 |
<message>Iteration 0 failed</message> |
| 202 |
</test> |
| 203 |
<test result=\"success\"> |
| 204 |
<fn>ex_output.c:72</fn> |
| 205 |
<id>test_loop</id> |
| 206 |
<iteration>1</iteration> |
| 207 |
<description>Core</description> |
| 208 |
<message>Passed</message> |
| 209 |
</test> |
| 210 |
<test result=\"failure\"> |
| 211 |
<fn>ex_output.c:72</fn> |
| 212 |
<id>test_loop</id> |
| 213 |
<iteration>2</iteration> |
| 214 |
<description>Core</description> |
| 215 |
<message>Iteration 2 failed</message> |
| 216 |
</test> |
| 217 |
</suite> |
| 218 |
<suite> |
| 219 |
<title>XML escape " ' < > & 	 
X tests</title> |
| 220 |
<test result=\"failure\"> |
| 221 |
<fn>ex_output.c:78</fn> |
| 222 |
<id>test_xml_esc_fail_msg</id> |
| 223 |
<iteration>0</iteration> |
| 224 |
<description>description " ' < > & 	 
X end</description> |
| 225 |
<message>fail " ' < > & 	 
X message</message> |
| 226 |
</test> |
| 227 |
</suite> |
| 228 |
</testsuites>" |
| 229 |
expected_duration_count=9 |
| 230 |
else |
| 231 |
expected_xml="<?xml version=\"1.0\"?> |
| 232 |
<?xml-stylesheet type=\"text/xsl\" href=\"http://check.sourceforge.net/xml/check_unittest.xslt\"?> |
| 233 |
<testsuites xmlns=\"http://check.sourceforge.net/ns\"> |
| 234 |
<suite> |
| 235 |
<title>S1</title> |
| 236 |
<test result=\"success\"> |
| 237 |
<fn>ex_output.c:31</fn> |
| 238 |
<id>test_pass</id> |
| 239 |
<iteration>0</iteration> |
| 240 |
<description>Core</description> |
| 241 |
<message>Passed</message> |
| 242 |
</test> |
| 243 |
<test result=\"failure\"> |
| 244 |
<fn>ex_output.c:37</fn> |
| 245 |
<id>test_fail</id> |
| 246 |
<iteration>0</iteration> |
| 247 |
<description>Core</description> |
| 248 |
<message>Failure</message> |
| 249 |
</test> |
| 250 |
</suite> |
| 251 |
<suite> |
| 252 |
<title>S2</title> |
| 253 |
<test result=\"success\"> |
| 254 |
<fn>ex_output.c:66</fn> |
| 255 |
<id>test_pass2</id> |
| 256 |
<iteration>0</iteration> |
| 257 |
<description>Core</description> |
| 258 |
<message>Passed</message> |
| 259 |
</test> |
| 260 |
<test result=\"failure\"> |
| 261 |
<fn>ex_output.c:72</fn> |
| 262 |
<id>test_loop</id> |
| 263 |
<iteration>0</iteration> |
| 264 |
<description>Core</description> |
| 265 |
<message>Iteration 0 failed</message> |
| 266 |
</test> |
| 267 |
<test result=\"success\"> |
| 268 |
<fn>ex_output.c:72</fn> |
| 269 |
<id>test_loop</id> |
| 270 |
<iteration>1</iteration> |
| 271 |
<description>Core</description> |
| 272 |
<message>Passed</message> |
| 273 |
</test> |
| 274 |
<test result=\"failure\"> |
| 275 |
<fn>ex_output.c:72</fn> |
| 276 |
<id>test_loop</id> |
| 277 |
<iteration>2</iteration> |
| 278 |
<description>Core</description> |
| 279 |
<message>Iteration 2 failed</message> |
| 280 |
</test> |
| 281 |
</suite> |
| 282 |
<suite> |
| 283 |
<title>XML escape " ' < > & 	 
X tests</title> |
| 284 |
<test result=\"failure\"> |
| 285 |
<fn>ex_output.c:78</fn> |
| 286 |
<id>test_xml_esc_fail_msg</id> |
| 287 |
<iteration>0</iteration> |
| 288 |
<description>description " ' < > & 	 
X end</description> |
| 289 |
<message>fail " ' < > & 	 
X message</message> |
| 290 |
</test> |
| 291 |
</suite> |
| 292 |
</testsuites>" |
| 293 |
expected_duration_count=8 |
| 294 |
fi |
| 295 |
|
| 296 |
################## |
| 297 |
# tap output |
| 298 |
################## |
| 299 |
if [ $HAVE_FORK -eq 1 ]; then |
| 300 |
expected_normal_tap=`printf "ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed |
| 301 |
not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure |
| 302 |
not ok 3 - ${SRCDIR}ex_output.c:Core:test_exit: Early exit with return value 1 |
| 303 |
ok 4 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed |
| 304 |
not ok 5 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed |
| 305 |
ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Passed |
| 306 |
not ok 7 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed |
| 307 |
not ok 8 - ${SRCDIR}ex_output.c:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg: fail \" ' < > & $tab_nl_X_bs message |
| 308 |
1..8"` |
| 309 |
expected_aborted_tap=`printf "ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed |
| 310 |
not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure |
| 311 |
not ok 3 - ${SRCDIR}ex_output.c:Core:test_exit: Early exit with return value 1 |
| 312 |
not ok 4 - ${SRCDIR}ex_output.c:Core:test_abort: Early exit with return value 1 |
| 313 |
ok 5 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed |
| 314 |
not ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed |
| 315 |
ok 7 - ${SRCDIR}ex_output.c:Core:test_loop: Passed |
| 316 |
not ok 8 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed |
| 317 |
not ok 9 - ${SRCDIR}ex_output.c:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg: fail \" ' < > & $tab_nl_X_bs message |
| 318 |
1..9"` |
| 319 |
else |
| 320 |
expected_normal_tap=`printf "ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed |
| 321 |
not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure |
| 322 |
ok 3 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed |
| 323 |
not ok 4 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed |
| 324 |
ok 5 - ${SRCDIR}ex_output.c:Core:test_loop: Passed |
| 325 |
not ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed |
| 326 |
not ok 7 - ${SRCDIR}ex_output.c:description \" ' < > & $tab_nl_X_bs end:test_xml_esc_fail_msg: fail \" ' < > & $tab_nl_X_bs message |
| 327 |
1..7"` |
| 328 |
# When fork() is unavailable, one of the tests |
| 329 |
# will invoke exit() which will terminate the |
| 330 |
# unit testing program. In that case, the tap |
| 331 |
# results will be incomplete, but the required |
| 332 |
# test plan will be missing, signaling that |
| 333 |
# something bad happened. |
| 334 |
expected_aborted_tap="ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed |
| 335 |
not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure" |
| 336 |
fi |