]> granicus.if.org Git - check/commitdiff
modify test_output.sh to compare output based on HAVE_FORK
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sun, 22 Sep 2013 23:29:05 +0000 (23:29 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sun, 22 Sep 2013 23:29:05 +0000 (23:29 +0000)
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

NEWS
tests/test_output.sh

diff --git a/NEWS b/NEWS
index eba8694aefd86fb303e29d07aaa7c52ad61d7cd3..361398601c49ab7a2068a79976d2da3471c70eb4 100644 (file)
--- 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
index 763db0366beab534f88137b9a9760510720d75e2..03a6991fe529fd1d8af2e6361a913e657ed8207a 100755 (executable)
@@ -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`