summaryrefslogtreecommitdiff
path: root/test/run
blob: fbc16fc0d1b9e0d93362a473500da5a98f224bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/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