2009-11-14 23:29:09 +00:00
|
|
|
#!/usr/bin/env bash
|
2008-06-06 19:57:00 +00: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.
|
|
|
|
|
2010-08-30 19:40:56 +00:00
|
|
|
eval $(gomake --no-print-directory -f ../src/Make.inc go-env)
|
2010-08-18 14:08:49 +00:00
|
|
|
|
2011-03-25 18:33:07 +00:00
|
|
|
export E=
|
|
|
|
|
2008-06-06 19:57:00 +00:00
|
|
|
case X"$GOARCH" in
|
|
|
|
Xamd64)
|
|
|
|
export A=6
|
|
|
|
;;
|
2009-05-31 19:35:11 +00:00
|
|
|
X386)
|
|
|
|
export A=8
|
|
|
|
;;
|
|
|
|
Xarm)
|
|
|
|
export A=5
|
2010-09-22 02:41:32 +00:00
|
|
|
export E="$GORUN"
|
2009-05-31 19:35:11 +00:00
|
|
|
;;
|
2008-06-06 19:57:00 +00:00
|
|
|
*)
|
2009-05-31 19:35:11 +00:00
|
|
|
echo 1>&2 run: unsupported '$GOARCH'
|
2008-06-06 19:57:00 +00:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
export G=${A}g
|
|
|
|
export L=${A}l
|
2008-09-22 20:47:53 +00:00
|
|
|
export GOTRACEBACK=0
|
2009-11-02 21:17:12 +00:00
|
|
|
export LANG=C
|
2009-11-12 22:55:26 +00:00
|
|
|
unset GREP_OPTIONS # in case user has a non-standard set
|
2008-06-06 19:57:00 +00:00
|
|
|
|
|
|
|
failed=0
|
|
|
|
|
2010-08-30 19:40:56 +00:00
|
|
|
PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$GOROOT/bin}:`pwd`
|
2008-09-19 21:39:49 +00:00
|
|
|
|
2009-06-17 20:21:01 +00:00
|
|
|
RUNFILE=/tmp/gorun-$$-$USER
|
|
|
|
TMP1FILE=/tmp/gotest1-$$-$USER
|
|
|
|
TMP2FILE=/tmp/gotest2-$$-$USER
|
2008-08-08 17:57:23 +00:00
|
|
|
|
2008-09-08 22:22:45 +00: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.
|
2011-02-09 19:38:33 +00:00
|
|
|
ulimit -v 4000000
|
2008-09-08 22:22:45 +00:00
|
|
|
|
2009-11-10 07:11:36 +00:00
|
|
|
# no core files please
|
|
|
|
ulimit -c 0
|
|
|
|
|
2009-10-09 18:18:32 +00:00
|
|
|
true >pass.out >times.out
|
2009-09-22 23:56:28 +00:00
|
|
|
|
2010-09-22 05:30:42 +00:00
|
|
|
exclude=false # exclude nothing
|
|
|
|
golden=golden.out
|
|
|
|
|
|
|
|
filterout() {
|
|
|
|
grep '^'"$2"'$' $1 >/dev/null
|
|
|
|
}
|
|
|
|
|
2010-01-27 07:13:22 +00:00
|
|
|
for dir in . ken chan interface nilptr syntax fixedbugs bugs
|
2008-06-06 19:57:00 +00:00
|
|
|
do
|
2009-07-29 22:11:19 +00:00
|
|
|
echo
|
|
|
|
echo '==' $dir'/'
|
2009-10-20 15:27:14 +00:00
|
|
|
for i in $(ls $dir/*.go 2>/dev/null)
|
2010-09-22 05:30:42 +00:00
|
|
|
do (
|
|
|
|
if $exclude $i; then
|
|
|
|
exit 0 # continues for loop
|
|
|
|
fi
|
2008-06-06 21:27:34 +00:00
|
|
|
export F=$(basename $i .go)
|
|
|
|
export D=$dir
|
2010-09-20 03:28:32 +00:00
|
|
|
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >$RUNFILE
|
2009-11-30 23:07:57 +00:00
|
|
|
if ! { time -p bash -c "bash $RUNFILE >$TMP1FILE 2>&1" ; } 2>$TMP2FILE
|
2008-06-06 21:27:34 +00:00
|
|
|
then
|
2008-08-08 17:57:23 +00:00
|
|
|
echo
|
|
|
|
echo "===========" $i
|
|
|
|
cat $TMP1FILE
|
2008-06-06 21:27:34 +00:00
|
|
|
echo >&2 fail: $i
|
2010-07-20 12:53:16 +00:00
|
|
|
echo "# $i # fail" >>pass.out
|
2009-10-14 05:48:03 +00:00
|
|
|
elif test -s $TMP1FILE
|
2008-08-08 17:57:23 +00:00
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo "===========" $i
|
|
|
|
cat $TMP1FILE
|
2010-07-20 12:53:16 +00:00
|
|
|
if grep -q '^BUG' $TMP1FILE
|
|
|
|
then
|
2010-08-03 20:09:16 +00:00
|
|
|
if [ $dir != bugs ]
|
|
|
|
then
|
|
|
|
echo >&2 bug: $i
|
|
|
|
fi
|
2010-07-20 12:53:16 +00:00
|
|
|
echo "# $i # fail, BUG" >>pass.out
|
|
|
|
else
|
|
|
|
echo $i >>pass.out
|
|
|
|
fi
|
2008-11-17 20:44:22 +00:00
|
|
|
elif [ $dir = "bugs" ]
|
|
|
|
then
|
|
|
|
echo $i succeeded with no output.
|
2009-09-22 23:56:28 +00:00
|
|
|
else
|
|
|
|
echo $i >>pass.out
|
2008-06-06 21:27:34 +00:00
|
|
|
fi
|
2009-10-14 05:48:03 +00:00
|
|
|
echo $(awk 'NR==1{print $2}' $TMP2FILE) $D/$F >>times.out
|
2011-04-13 20:24:57 +00:00
|
|
|
rm -f $F.$A $A.out
|
2010-09-22 05:30:42 +00:00
|
|
|
) done
|
2008-07-07 17:03:10 +00:00
|
|
|
done | # clean up some stack noise
|
2008-08-08 17:57:23 +00:00
|
|
|
egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
|
2008-09-02 21:26:59 +00:00
|
|
|
sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
|
|
|
|
s!'$RUNFILE'!$RUNFILE!g
|
2009-10-20 15:27:14 +00:00
|
|
|
s/^PC=0x[0-9a-f]*/pc: xxx/
|
2008-09-22 20:47:53 +00:00
|
|
|
s/^pc: 0x[0-9a-f]*/pc: xxx/
|
2009-10-20 15:27:14 +00:00
|
|
|
s/PC=0x[0-9a-f]*/PC=xxx/
|
2008-09-22 20:47:53 +00:00
|
|
|
/^Trace\/breakpoint trap/d
|
2009-06-05 17:59:37 +00:00
|
|
|
/^Trace\/BPT trap/d
|
2008-11-11 18:01:51 +00:00
|
|
|
/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
|
2009-09-19 02:09:12 +00:00
|
|
|
/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
|
2010-04-05 19:51:09 +00:00
|
|
|
/Segmentation fault/d
|
2009-09-19 02:09:12 +00:00
|
|
|
/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
|
2008-06-06 20:28:03 +00:00
|
|
|
|
2010-09-22 05:30:42 +00:00
|
|
|
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A *.a $A.out
|
2009-07-29 22:30:54 +00:00
|
|
|
diffmsg=""
|
2010-09-22 05:30:42 +00:00
|
|
|
if ! diff $golden run.out
|
2008-06-06 19:57:00 +00:00
|
|
|
then
|
2009-07-29 22:30:54 +00:00
|
|
|
diffmsg="; test output differs"
|
2008-06-06 19:57:00 +00:00
|
|
|
failed=1
|
|
|
|
fi
|
2008-06-06 20:38:16 +00:00
|
|
|
|
2009-07-29 22:11:19 +00:00
|
|
|
notinbugs=$(sed '/^== bugs/q' run.out | grep -c '^BUG')
|
|
|
|
inbugs=$(sed '1,/^== bugs/d' run.out | grep -c '^BUG')
|
|
|
|
|
2009-07-29 22:30:54 +00:00
|
|
|
echo 2>&1 $inbugs known bugs';' $notinbugs unexpected bugs$diffmsg
|
2008-06-06 20:38:16 +00:00
|
|
|
|
2010-02-10 23:01:02 +00:00
|
|
|
if [ "$failed" != "0" ]; then
|
|
|
|
echo FAILED
|
|
|
|
fi
|
|
|
|
|
2008-06-06 19:57:00 +00:00
|
|
|
exit $failed
|