summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2009-08-21 17:41:18 -0700
committerIan Lance Taylor <iant@golang.org>2009-08-21 17:41:18 -0700
commit176347c3b1c60c17d29be3620df3f339f8bb7255 (patch)
treebc7498d2b7c8fb61febea53281e6cd9b1780371c /test
parent0e99a227d75d9494184696bde0c414a901936cb5 (diff)
downloadgo-176347c3b1c60c17d29be3620df3f339f8bb7255.tar.gz
If the compiler dumps core, bash will print a useless error
message with the full path of the errchk script. Catch that by wrapping the if statement which invokes the compiler in a subshell. Use the $TMPOUT file as a flag to let the main shell know whether the subshell ran. Since the compiler stdout and stderr are redirected, if the if statement produces any output, then the compiler crashed, and we report that. R=r,rsc DELTA=14 (11 added, 1 deleted, 2 changed) OCL=33690 CL=33692
Diffstat (limited to 'test')
-rwxr-xr-xtest/errchk16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/errchk b/test/errchk
index 00694c256..c1183868f 100755
--- a/test/errchk
+++ b/test/errchk
@@ -34,11 +34,21 @@ rm -f $TMPOUT $TMPERR $TMPALL $TMPTMP $TMPBUG
trap "rm -f $TMPOUT $TMPERR $TMPALL $TMPTMP $TMPBUG" 0 1 2 3 14 15
-if $* >$TMPOUT 2>$TMPERR; then
- echo 1>&2 "BUG: errchk: command succeeded unexpectedly"
+(if $* >$TMPOUT 2>$TMPERR; then
+ echo 1>&4 "BUG: errchk: command succeeded unexpectedly"
+ cat 1>&3 $TMPOUT
+ cat 1>&4 $TMPERR
+ rm -f $TMPOUT $TMPERR
+ fi) 3>&1 4>&2 >$TMPTMP 2>&1
+
+if ! test -f $TMPOUT; then
+ exit 0
+fi
+
+if test -s $TMPTMP; then
+ echo 1>&2 BUG: errchk: compiler crashed
cat $TMPOUT
cat 1>&2 $TMPERR
- rm -f $TMPOUT $TMPERR
exit 0
fi