usleep tests: Avoid failure due to known Cygwin 3.5.3 bug.
[gnulib.git] / tests / test-c-stack2.sh
blobb7f8b26bd94757a391511b74488ca0f1b3cdaf35
1 #!/bin/sh
3 tmpfiles=""
4 trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
6 tmpfiles="t-c-stack2.tmp"
8 # Sanitize exit status within a subshell, since some shells fail to
9 # redirect stderr on their message about death due to signal.
10 (${CHECKER} ./test-c-stack${EXEEXT} 1; exit $?) 2> t-c-stack2.tmp
12 case $? in
13 77) if grep 'stack overflow' t-c-stack2.tmp >/dev/null ; then
14 if test -z "$LIBSIGSEGV"; then
15 echo 'cannot tell stack overflow from crash; consider installing libsigsegv' >&2
16 exit 77
17 else
18 echo 'cannot tell stack overflow from crash, in spite of libsigsegv' >&2
19 exit 1
21 else
22 cat t-c-stack2.tmp >&2
23 exit 77
27 # Dereferencing NULL exits the program with status 1,
28 # so this test doesn't check the c-stack testing harness like it should.
29 # https://lists.gnu.org/r/grep-devel/2020-09/msg00034.html
30 cat t-c-stack2.tmp >&2
31 echo 'skipping test (perhaps gcc -fsanitize=undefined is in use?)'
32 exit 77;;
33 0) (exit 1); exit 1 ;;
34 esac
35 if grep 'program error' t-c-stack2.tmp >/dev/null ; then
37 else
38 (exit 1); exit 1
41 rm -fr $tmpfiles
43 exit 0