From: brarcher Date: Mon, 23 Sep 2013 13:06:58 +0000 (+0000) Subject: modify test_check_nofork.sh to compare output based on HAVE_FORK X-Git-Tag: 0.10.0~433 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=601700e18ab16e7591595f341bf30c2f9002c788;p=check modify test_check_nofork.sh to compare output based on HAVE_FORK 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. One other change is not using stderr for the test. Wine has an issue with the tmpfile() call, and will output: fixme:msvcrt:MSVCRT__sopen_s : pmode 0x0033 ignored to stderr when tmpfile() is called. Besides, if the test actually does segfault in the future (which is the reason for grabbing the stderr), the result will not be to print out the test results. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@781 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- diff --git a/NEWS b/NEWS index 3613986..f26561d 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ In development: against wine 1.4: - check_check_export - test_output.sh + - test_check_nofork.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_check_nofork.sh b/tests/test_check_nofork.sh index d07260e..671bd7b 100755 --- a/tests/test_check_nofork.sh +++ b/tests/test_check_nofork.sh @@ -1,16 +1,37 @@ #!/bin/sh +# 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. + . ./test_vars +if [ $HAVE_FORK -eq 1 ]; then expected="Running suite(s): NoFork 0%: Checks: 1, Failures: 1, Errors: 0" +else +expected=`printf "Running suite(s): NoFork\r +0%%: Checks: 1, Failures: 1, Errors: 0\r +"` +fi -actual=`./check_nofork${EXEEXT} 2>&1` +actual=`./check_nofork${EXEEXT}` if [ x"${expected}" = x"${actual}" ]; then exit 0 else echo "Problem with check_nofork${EXEEXT}" - echo "Expected: Failure" - echo "Got: Segmentation fault" + echo "Expected: " + echo "${expected}" + echo "Got: " + echo "${actual}" + + echo xxd expected + echo -n "${expected}" | xxd + echo xxd actual + echo -n "${actual}" | xxd exit 1 fi