2009-11-14 16:29:09 -07:00
|
|
|
#!/usr/bin/env bash
|
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.
|
|
|
|
|
2010-08-30 13:40:56 -06:00
|
|
|
eval $(gomake --no-print-directory -f ../src/Make.inc go-env)
|
2010-08-18 08:08:49 -06:00
|
|
|
|
2011-03-25 12:33:07 -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
|
2010-09-21 20:41:32 -06:00
|
|
|
export E="$GORUN"
|
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)
|
2010-04-22 18:52:22 -06:00
|
|
|
export E=${GORUN:-$GOROOT/misc/nacl/naclrun}
|
2009-09-22 17:56:28 -06:00
|
|
|
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
|
|
|
|
|
2010-08-30 13:40:56 -06:00
|
|
|
PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$GOROOT/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.
|
2011-02-09 12:38:33 -07:00
|
|
|
ulimit -v 4000000
|
2008-09-08 16:22:45 -06:00
|
|
|
|
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
|
|
|
|
2010-09-21 23:30:42 -06:00
|
|
|
exclude=false # exclude nothing
|
|
|
|
golden=golden.out
|
|
|
|
|
|
|
|
filterout() {
|
|
|
|
grep '^'"$2"'$' $1 >/dev/null
|
|
|
|
}
|
|
|
|
|
2010-01-27 00:13:22 -07:00
|
|
|
for dir in . ken chan interface nilptr syntax 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)
|
2010-09-21 23:30:42 -06:00
|
|
|
do (
|
|
|
|
if $exclude $i; then
|
|
|
|
exit 0 # continues for loop
|
|
|
|
fi
|
2008-06-06 15:27:34 -06:00
|
|
|
export F=$(basename $i .go)
|
|
|
|
export D=$dir
|
2010-09-19 21:28:32 -06:00
|
|
|
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >$RUNFILE
|
2009-11-30 16:07:57 -07:00
|
|
|
if ! { time -p bash -c "bash $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
|
2010-07-20 06:53:16 -06:00
|
|
|
echo "# $i # fail" >>pass.out
|
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
|
2010-07-20 06:53:16 -06:00
|
|
|
if grep -q '^BUG' $TMP1FILE
|
|
|
|
then
|
2010-08-03 14:09:16 -06:00
|
|
|
if [ $dir != bugs ]
|
|
|
|
then
|
|
|
|
echo >&2 bug: $i
|
|
|
|
fi
|
2010-07-20 06:53:16 -06:00
|
|
|
echo "# $i # fail, BUG" >>pass.out
|
|
|
|
else
|
|
|
|
echo $i >>pass.out
|
|
|
|
fi
|
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
|
2010-09-21 23:30:42 -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
|
2010-09-19 21:28:32 -06:00
|
|
|
/Fault in NaCl untrusted code/d
|
2010-04-05 13:51:09 -06:00
|
|
|
/Segmentation fault/d
|
2009-09-18 20:09:12 -06:00
|
|
|
/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
|
2008-06-06 14:28:03 -06:00
|
|
|
|
2010-09-21 23:30:42 -06:00
|
|
|
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A *.a $A.out
|
2009-07-29 16:30:54 -06:00
|
|
|
diffmsg=""
|
2010-09-21 23:30:42 -06:00
|
|
|
if ! diff $golden run.out
|
2008-06-06 13:57:00 -06:00
|
|
|
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
|
|
|
|
2010-02-10 16:01:02 -07:00
|
|
|
if [ "$failed" != "0" ]; then
|
|
|
|
echo FAILED
|
|
|
|
fi
|
|
|
|
|
2008-06-06 13:57:00 -06:00
|
|
|
exit $failed
|