From: brarcher Date: Sun, 22 Sep 2013 23:29:05 +0000 (+0000) Subject: modify test_output.sh to compare output based on HAVE_FORK X-Git-Tag: 0.10.0~434 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ecb14ca6c36319737e8d80e2693e4309bb166e69;p=check modify test_output.sh to compare output based on HAVE_FORK The output of ex_output changes based on HAVE_FORK, as a test is skipped when fork is unavailable. However, simply adding another string mentioning one less test is not enough to get this working for Windows... When run in Windows, the output differs slightly from when it is run under *NIX due to line endings. *NIX uses \n, whereas Windows uses \r\n. To account for this, printf is used to generate the Windows expected string. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@780 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- diff --git a/NEWS b/NEWS index eba8694..3613986 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,10 @@ In development: * Check compiles for the Windows using MinGW-w64. -* check_check_export test suite passes for MinGW-w64 builds, tested with wine 1.4. The remaining 5 test suites still fail. +* The following unit tests now pass for MinGW-w64 builds when run + against wine 1.4: + - check_check_export + - test_output.sh * On systems without timer_settimer, use setitimer (if available) to get subsecond unit test timeouts. If setitimer is unavailable, fallback diff --git a/tests/test_output.sh b/tests/test_output.sh index 763db03..03a6991 100755 --- a/tests/test_output.sh +++ b/tests/test_output.sh @@ -1,35 +1,72 @@ #!/bin/sh -. ./test_vars +# For this test script, it is assumed that HAVE_FORK=0 implies +# running in a Windows environment. That means not only are +# fork-related tests not run, but also line endings are important. +# In *NIX environments line endings are \n, but in Windows they +# are expected to be \r\n. For this reason, HAVE_FORK=0 uses +# printf to generate the comparison strings, so the line endings +# can be controlled. -if [ "${srcdir}" = "." ]; then - lsrc="" -else - lsrc="${srcdir}/" -fi +. ./test_vars t0="x" + +if [ $HAVE_FORK -eq 1 ]; then t1="xRunning suite(s): Master 33%: Checks: 3, Failures: 1, Errors: 1" +else +t1=`printf "xRunning suite(s): Master\r +50%%: Checks: 2, Failures: 1, Errors: 0\r +"` +fi + +if [ $HAVE_FORK -eq 1 ]; then t2="xRunning suite(s): Master 33%: Checks: 3, Failures: 1, Errors: 1 -${lsrc}ex_output.c:17:F:Core:test_fail:0: Failure -${lsrc}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1" +ex_output.c:17:F:Core:test_fail:0: Failure +ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1" +else +t2=`printf "xRunning suite(s): Master\r +50%%: Checks: 2, Failures: 1, Errors: 0\r +ex_output.c:17:F:Core:test_fail:0: Failure\r +"` +fi + +if [ $HAVE_FORK -eq 1 ]; then t3="xRunning suite(s): Master 33%: Checks: 3, Failures: 1, Errors: 1 -${lsrc}ex_output.c:11:P:Core:test_pass:0: Passed -${lsrc}ex_output.c:17:F:Core:test_fail:0: Failure -${lsrc}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1" +ex_output.c:11:P:Core:test_pass:0: Passed +ex_output.c:17:F:Core:test_fail:0: Failure +ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1" +else +t3=`printf "xRunning suite(s): Master\r +50%%: Checks: 2, Failures: 1, Errors: 0\r +ex_output.c:11:P:Core:test_pass:0: Passed\r +ex_output.c:17:F:Core:test_fail:0: Failure\r +"` +fi + +if [ $HAVE_FORK -eq 1 ]; then t4="xtest: Core:test_pass success: Core:test_pass test: Core:test_fail failure: Core:test_fail [ -${lsrc}ex_output.c:17: Failure +ex_output.c:17: Failure ] test: Core:test_exit error: Core:test_exit [ -${lsrc}ex_output.c:26: (after this point) Early exit with return value 1 +ex_output.c:26: (after this point) Early exit with return value 1 ]" +else +t4=`printf "xtest: Core:test_pass\r +success: Core:test_pass\r +test: Core:test_fail\r +failure: Core:test_fail [\r +ex_output.c:17: Failure\r +]\r +"` +fi op0=`./ex_output${EXEEXT} CK_SILENT` op1=`./ex_output${EXEEXT} CK_MINIMAL`