1
0
mirror of https://github.com/golang/go synced 2024-11-12 10:00:25 -07:00
go/test/run
Russ Cox b9159722dd add test for yesterday's interface rule change (interface/convert1.go).
move interface tests to subdirectory.

R=r
DELTA=1632  (827 added, 804 deleted, 1 changed)
OCL=29181
CL=29191
2009-05-21 13:46:20 -07:00

81 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
# 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.
case X"$GOARCH" in
Xamd64)
export A=6
;;
*)
export A=6
echo 1>&2 run: assuming amd64
exit 1
esac
export G=${A}g
export L=${A}l
export GOTRACEBACK=0
failed=0
PATH=/bin:/usr/bin:$HOME/bin:`pwd`
# don't use $$ in file names to avoid spurious diffs
RUNFILE=/tmp/gorun-$USER
TMP1FILE=/tmp/gotest1-$USER
TMP2FILE=/tmp/gotest2-$USER
# 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
for dir in . ken chan interface bugs fixedbugs
do
for i in $dir/*.go
do
export F=$(basename $i .go)
export D=$dir
sed -n '1,/[^/]/p' $i | sed 's@//@@; $d' > $RUNFILE
if ! sh $RUNFILE >$TMP1FILE 2>$TMP2FILE
then
echo
echo "===========" $i
cat $TMP1FILE
cat $TMP2FILE
echo >&2 fail: $i
elif test -s $TMP1FILE || test -s $TMP2FILE
then
echo
echo "===========" $i
cat $TMP1FILE
cat $TMP2FILE
elif [ $dir = "bugs" ]
then
echo $i succeeded with no output.
fi
done
done | # clean up some stack noise
egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
s!'$RUNFILE'!$RUNFILE!g
s/ PC=0x[0-9a-f]*/ PC=xxx/
s/^pc: 0x[0-9a-f]*/pc: xxx/
/^Trace\/breakpoint trap/d
/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d' > run.out
case $failed in
1)
echo FAIL
esac
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.6 6.out
if ! diff run.out golden.out
then
failed=1
fi
echo 2>&1 $(grep -c '^BUG' run.out) tests are behaving incorrectly
exit $failed