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.
|
|
|
|
|
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
|
2010-04-15 03:47:49 -06:00
|
|
|
export E=${GORUN:-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)
|
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
|
|
|
|
|
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
|
|
|
|
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)
|
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-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
|
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
|
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
|
|
|
|
gopack: handle long lines in export data
Also, if the header is bad, exit with a non-zero status.
Other calls to Brdline in the tree, by category:
Reading symbol name from object file:
./cmd/5l/obj.c:486: name = Brdline(f, '\0');
./cmd/6l/obj.c:535: name = Brdline(f, '\0');
./cmd/8l/obj.c:564: name = Brdline(f, '\0');
./libmach/sym.c:292: cp = Brdline(bp, '\0');
Reading archive header line (fixed, short):
./cmd/gc/lex.c:287: if((a = Brdline(b, '\n')) == nil)
./cmd/gc/lex.c:303: if((p = Brdline(b, '\n')) == nil)
Reading object file header line (fixed, short):
./cmd/ld/lib.c:421: line = Brdline(f, '\n');
Reading undefined symbol list (unused code):
./cmd/ld/lib.c:773: while((l = Brdline(b, '\n')) != nil){
Implementing Brdstr:
./libbio/brdstr.c:36: p = Brdline(bp, delim);
The symbol names ones will cause a problem loudly if they
fail: they'll error out with symbol name too long. This means
that you can't define an enormous struct without giving the
type a name and then stick it in an interface, because the
type's symbol name will be too long for the object file.
Since this will be a loud failure instead of a silent one,
I'm willing to wait until it comes up in practice.
R=r
CC=golang-dev
https://golang.org/cl/1982041
2010-08-11 23:17:20 -06:00
|
|
|
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A *.a $A.out
|
2009-07-29 16:30:54 -06:00
|
|
|
diffmsg=""
|
2010-08-03 14:01:28 -06:00
|
|
|
if ! diff golden.out 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
|