blob: 729fc1eaaf36598664e5ea139db6d56fad3af37f (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
#!/usr/bin/env bash
# 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.
eval $(go tool dist env)
export GOARCH GOOS GOROOT
export E=
case X"$GOARCH" in
Xamd64)
export A=6
;;
X386)
export A=8
;;
Xarm)
export A=5
export E="$GORUN"
;;
*)
echo 1>&2 run: unsupported '$GOARCH'
exit 1
esac
export G="${A}g ${GCFLAGS}"
export L=${A}l
export GOTRACEBACK=0
export LANG=C
unset GREP_OPTIONS # in case user has a non-standard set
unset GOROOT_FINAL # breaks ./ imports
failed=0
PATH=${GOBIN:-$GOROOT/bin}:`pwd`:/bin:/usr/bin:/usr/local/bin:/usr/pkg/bin
# TODO: We add the tool directory to the PATH to avoid thinking about a better way.
PATH="$GOTOOLDIR:$PATH"
RUNFILE="${TMPDIR:-/tmp}/gorun-$$-$USER"
TMP1FILE="${TMPDIR:-/tmp}/gotest1-$$-$USER"
TMP2FILE="${TMPDIR:-/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
# no core files please
ulimit -c 0
true >pass.out >times.out
exclude=false # exclude nothing
golden=golden.out
rm -f tmp.go # generated by some tests, left behind if interrupted
filterout() {
grep '^'"$2"'$' $1 >/dev/null
}
for dir in . ken chan interface syntax dwarf safe fixedbugs bugs
do
echo
echo '==' $dir'/'
for i in $(ls $dir/*.go 2>/dev/null)
do (
if $exclude $i; then
exit 0 # continues for loop
fi
export F=$(basename $i .go)
export D=$dir
echo '. ./testlib' >"$RUNFILE"
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >>"$RUNFILE"
if ! { time -p bash -c "bash '$RUNFILE' >'$TMP1FILE' 2>&1" ; } 2>"$TMP2FILE"
then
echo
echo "===========" $i
cat "$TMP1FILE"
echo >&2 fail: $i
echo "# $i # fail" >>pass.out
elif test -s "$TMP1FILE"
then
echo
echo "===========" $i
cat "$TMP1FILE"
if grep -q '^BUG' "$TMP1FILE"
then
if [ $dir != bugs ]
then
echo >&2 bug: $i
fi
echo "# $i # fail, BUG" >>pass.out
else
echo $i >>pass.out
fi
elif [ $dir = "bugs" ]
then
echo $i succeeded with no output.
else
echo $i >>pass.out
fi
echo $(awk 'NR==1{print $2}' "$TMP2FILE") $D/$F >>times.out
rm -f $F.$A $A.out tmp.go
) 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/
s/PC=0x[0-9a-f]*/PC=xxx/
/^Trace\/breakpoint trap/d
/^Trace\/BPT trap/d
/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
/Segmentation fault/d
/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
rm -f "$RUNFILE" "$TMP1FILE" "$TMP2FILE" *.$A *.a $A.out
diffmsg=""
if ! diff $golden run.out
then
diffmsg="; test output differs"
failed=1
fi
notinbugs=$(sed '/^== bugs/q' run.out | grep -c '^BUG')
inbugs=$(sed '1,/^== bugs/d' run.out | grep -c '^BUG')
echo 2>&1 $inbugs known bugs';' $notinbugs unexpected bugs$diffmsg
if [ "$failed" != "0" ]; then
echo FAILED
fi
exit $failed
|