1
0
mirror of https://github.com/golang/go synced 2024-11-13 17:30:24 -07:00
go/test/run
Rob Pike 3963fe3b32 fix a couple of tests that had shell errors
clean up the golden file a bit to have less meaningless content and be more robust to spurious diffs.
now there is output only for tests that produce output or failure.

R=gri
OCL=14005
CL=14005
2008-08-08 10:57:23 -07:00

65 lines
1.2 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
failed=0
# don't use $$ in file names to avoid spurious diffs
RUNFILE=/tmp/gorun-$USER
TMP1FILE=/tmp/gotest1-$USER
TMP2FILE=/tmp/gotest2-$USER
for dir in . ken chan 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
then
echo
echo "===========" $i
cat $TMP1FILE
cat $TMP2FILE
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/' > 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