2 # Copyright 2009 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file.
6 eval $
(go tool dist env
)
7 export GOARCH GOOS GOROOT
22 echo 1>&2 run
: unsupported
'$GOARCH'
26 export G
="${A}g ${GCFLAGS}"
30 unset GREP_OPTIONS
# in case user has a non-standard set
32 unset GOROOT_FINAL
# breaks ./ imports
36 PATH
=${GOBIN:-$GOROOT/bin}:`pwd`:/bin
:/usr
/bin
:/usr
/local
/bin
38 # TODO: We add the tool directory to the PATH to avoid thinking about a better way.
39 PATH
="$GOTOOLDIR:$PATH"
41 RUNFILE
="${TMPDIR:-/tmp}/gorun-$$-$USER"
42 TMP1FILE
="${TMPDIR:-/tmp}/gotest1-$$-$USER"
43 TMP2FILE
="${TMPDIR:-/tmp}/gotest2-$$-$USER"
45 # don't run the machine out of memory: limit individual processes to 4GB.
46 # on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
49 # no core files please
52 true
>pass.out
>times.out
54 exclude
=false
# exclude nothing
57 rm -f tmp.go
# generated by some tests, left behind if interrupted
60 grep '^'"$2"'$' $1 >/dev
/null
63 for dir
in . ken chan interface syntax dwarf safe fixedbugs bugs
67 for i
in $
(ls $dir/*.go
2>/dev
/null
)
70 exit 0 # continues for loop
72 export F
=$
(basename $i .go
)
74 echo '. ./testlib' >"$RUNFILE"
75 sed '/^\/\//!q' $i |
sed 's@//@@; $d' |
sed 's|./\$A.out|$E &|g' >>"$RUNFILE"
76 if ! { time -p bash
-c "bash '$RUNFILE' >'$TMP1FILE' 2>&1" ; } 2>"$TMP2FILE"
82 echo "# $i # fail" >>pass.out
83 elif test -s "$TMP1FILE"
88 if grep -q '^BUG' "$TMP1FILE"
94 echo "# $i # fail, BUG" >>pass.out
98 elif [ $dir = "bugs" ]
100 echo $i succeeded with no output.
104 echo $
(awk 'NR==1{print $2}' "$TMP2FILE") $D/$F >>times.out
105 rm -f $F.
$A $A.out tmp.go
107 done |
# clean up some stack noise
108 egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
109 sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
110 s!'"$RUNFILE"'!$RUNFILE!g
111 s/^PC=0x[0-9a-f]*/pc: xxx/
112 s/^pc: 0x[0-9a-f]*/pc: xxx/
113 s/PC=0x[0-9a-f]*/PC=xxx/
114 /^Trace\/breakpoint trap/d
116 /RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
117 /^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
118 /Segmentation fault/d
119 /^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
121 rm -f "$RUNFILE" "$TMP1FILE" "$TMP2FILE" *.
$A *.a
$A.out
123 if ! diff $golden run.out
125 diffmsg
="; test output differs"
129 notinbugs
=$
(sed '/^== bugs/q' run.out |
grep -c '^BUG')
130 inbugs
=$
(sed '1,/^== bugs/d' run.out |
grep -c '^BUG')
132 echo 2>&1 $inbugs known bugs
';' $notinbugs unexpected bugs
$diffmsg
134 if [ "$failed" != "0" ]; then