2009-08-17 15:16:25 -06:00
|
|
|
#!/bin/sh
|
2008-06-06 13:57:00 -06:00
|
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
2009-09-18 20:09:12 -06:00
|
|
|
export E=""
|
2008-06-06 13:57:00 -06:00
|
|
|
case X"$GOARCH" in
|
|
|
|
Xamd64)
|
|
|
|
export A=6
|
|
|
|
;;
|
2009-05-31 13:35:11 -06:00
|
|
|
X386)
|
|
|
|
export A=8
|
|
|
|
;;
|
|
|
|
Xarm)
|
|
|
|
export A=5
|
2009-11-05 23:53:08 -07:00
|
|
|
export E=${EMU_arm:-qemu-arm -cpu cortex-a8}
|
2009-05-31 13:35:11 -06:00
|
|
|
;;
|
2008-06-06 13:57:00 -06:00
|
|
|
*)
|
2009-05-31 13:35:11 -06:00
|
|
|
echo 1>&2 run: unsupported '$GOARCH'
|
2008-06-06 13:57:00 -06:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
2009-09-22 17:56:28 -06:00
|
|
|
case X"$GOOS" in
|
|
|
|
Xnacl)
|
|
|
|
export E="nacl"
|
|
|
|
esac
|
|
|
|
|
2008-06-06 13:57:00 -06:00
|
|
|
export G=${A}g
|
|
|
|
export L=${A}l
|
2008-09-22 14:47:53 -06:00
|
|
|
export GOTRACEBACK=0
|
2009-11-02 14:17:12 -07:00
|
|
|
export LANG=C
|
2009-11-12 15:55:26 -07:00
|
|
|
unset GREP_OPTIONS # in case user has a non-standard set
|
2008-06-06 13:57:00 -06:00
|
|
|
|
|
|
|
failed=0
|
|
|
|
|
2009-09-18 20:09:12 -06:00
|
|
|
PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$HOME/bin}:`pwd`
|
2008-09-19 15:39:49 -06:00
|
|
|
|
2009-06-17 14:21:01 -06:00
|
|
|
RUNFILE=/tmp/gorun-$$-$USER
|
|
|
|
TMP1FILE=/tmp/gotest1-$$-$USER
|
|
|
|
TMP2FILE=/tmp/gotest2-$$-$USER
|
2008-08-08 11:57:23 -06:00
|
|
|
|
2008-09-08 16:22:45 -06:00
|
|
|
# don't run the machine out of memory: limit individual processes to 4GB.
|
|
|
|
# on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
|
|
|
|
ulimit -v 4000000
|
|
|
|
|
2009-11-10 00:11:36 -07:00
|
|
|
# no core files please
|
|
|
|
ulimit -c 0
|
|
|
|
|
2009-10-09 12:18:32 -06:00
|
|
|
true >pass.out >times.out
|
2009-09-22 17:56:28 -06:00
|
|
|
|
2009-10-20 09:03:43 -06:00
|
|
|
for dir in . ken chan interface nilptr fixedbugs bugs
|
2008-06-06 13:57:00 -06:00
|
|
|
do
|
2009-07-29 16:11:19 -06:00
|
|
|
echo
|
|
|
|
echo '==' $dir'/'
|
2009-10-20 09:27:14 -06:00
|
|
|
for i in $(ls $dir/*.go 2>/dev/null)
|
2008-06-06 15:27:34 -06:00
|
|
|
do
|
|
|
|
export F=$(basename $i .go)
|
|
|
|
export D=$dir
|
2009-09-22 17:56:28 -06:00
|
|
|
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE
|
2009-10-13 23:48:03 -06:00
|
|
|
if ! /usr/bin/time -p sh -c "sh $RUNFILE >$TMP1FILE 2>&1" 2>$TMP2FILE
|
2008-06-06 15:27:34 -06:00
|
|
|
then
|
2008-08-08 11:57:23 -06:00
|
|
|
echo
|
|
|
|
echo "===========" $i
|
|
|
|
cat $TMP1FILE
|
2008-06-06 15:27:34 -06:00
|
|
|
echo >&2 fail: $i
|
2009-10-13 23:48:03 -06:00
|
|
|
elif test -s $TMP1FILE
|
2008-08-08 11:57:23 -06:00
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo "===========" $i
|
|
|
|
cat $TMP1FILE
|
2008-11-17 13:44:22 -07:00
|
|
|
elif [ $dir = "bugs" ]
|
|
|
|
then
|
|
|
|
echo $i succeeded with no output.
|
2009-09-22 17:56:28 -06:00
|
|
|
else
|
|
|
|
echo $i >>pass.out
|
2008-06-06 15:27:34 -06:00
|
|
|
fi
|
2009-10-13 23:48:03 -06:00
|
|
|
echo $(awk 'NR==1{print $2}' $TMP2FILE) $D/$F >>times.out
|
2008-06-06 15:27:34 -06:00
|
|
|
done
|
2008-07-07 11:03:10 -06:00
|
|
|
done | # clean up some stack noise
|
2008-08-08 11:57:23 -06:00
|
|
|
egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
|
2008-09-02 15:26:59 -06:00
|
|
|
sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
|
|
|
|
s!'$RUNFILE'!$RUNFILE!g
|
2009-10-20 09:27:14 -06:00
|
|
|
s/^PC=0x[0-9a-f]*/pc: xxx/
|
2008-09-22 14:47:53 -06:00
|
|
|
s/^pc: 0x[0-9a-f]*/pc: xxx/
|
2009-10-20 09:27:14 -06:00
|
|
|
s/PC=0x[0-9a-f]*/PC=xxx/
|
2008-09-22 14:47:53 -06:00
|
|
|
/^Trace\/breakpoint trap/d
|
2009-06-05 11:59:37 -06:00
|
|
|
/^Trace\/BPT trap/d
|
2008-11-11 11:01:51 -07:00
|
|
|
/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
|
2009-09-18 20:09:12 -06:00
|
|
|
/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
|
|
|
|
/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
|
2008-06-06 14:28:03 -06:00
|
|
|
|
2008-06-06 13:57:00 -06:00
|
|
|
case $failed in
|
|
|
|
1)
|
|
|
|
echo FAIL
|
|
|
|
esac
|
2009-10-13 23:48:03 -06:00
|
|
|
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out
|
2009-07-29 16:30:54 -06:00
|
|
|
diffmsg=""
|
2008-06-06 13:57:00 -06:00
|
|
|
if ! diff run.out golden.out
|
|
|
|
then
|
2009-07-29 16:30:54 -06:00
|
|
|
diffmsg="; test output differs"
|
2008-06-06 13:57:00 -06:00
|
|
|
failed=1
|
|
|
|
fi
|
2008-06-06 14:38:16 -06:00
|
|
|
|
2009-07-29 16:11:19 -06:00
|
|
|
notinbugs=$(sed '/^== bugs/q' run.out | grep -c '^BUG')
|
|
|
|
inbugs=$(sed '1,/^== bugs/d' run.out | grep -c '^BUG')
|
|
|
|
|
2009-07-29 16:30:54 -06:00
|
|
|
echo 2>&1 $inbugs known bugs';' $notinbugs unexpected bugs$diffmsg
|
2008-06-06 14:38:16 -06:00
|
|
|
|
2008-06-06 13:57:00 -06:00
|
|
|
exit $failed
|