Make c-stack use libsigsegv, when available.
[gnulib.git] / tests / test-c-stack2.sh
1 #!/bin/sh
2
3 tmpfiles=""
4 trap 'rm -fr $tmpfiles' 1 2 3 15
5
6 tmpfiles="t-c-stack2.tmp"
7
8 # Sanitize exit status within a subshell, since some shells fail to
9 # redirect stderr on their message about death due to signal.
10 (./test-c-stack${EXEEXT} 1; exit $?) 2> t-c-stack2.tmp
11
12 case $? in
13   77) if grep 'stack overflow' t-c-stack2.tmp >/dev/null ; then
14         echo 'cannot tell stack overflow from crash; consider installing libsigsegv' >&2
15       else
16        cat t-c-stack2.tmp >&2
17       fi
18       (exit 77); exit 77 ;;
19   0) (exit 1); exit 1 ;;
20 esac
21 if grep 'program error' t-c-stack2.tmp >/dev/null ; then
22   :
23 else
24   (exit 1); exit 1
25 fi
26
27 rm -fr $tmpfiles
28
29 exit 0