blob: 55c36b0b13818a38dcbe29ae992611cf5f13fd1f [file] [log] [blame]
Rob Pike27fb2ab2008-06-06 12:57:00 -07001#!/bin/sh
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.
5
6case X"$GOARCH" in
7Xamd64)
8 export A=6
9 ;;
10*)
Rob Pike316bc262008-06-08 17:29:57 -070011 export A=6
12 echo 1>&2 run: assuming amd64
Rob Pike27fb2ab2008-06-06 12:57:00 -070013 exit 1
14esac
15
Rob Pike27fb2ab2008-06-06 12:57:00 -070016export G=${A}g
17export L=${A}l
Russ Coxfb40f882008-09-22 13:47:53 -070018export GOTRACEBACK=0
Rob Pike27fb2ab2008-06-06 12:57:00 -070019
20failed=0
21
Ian Lance Taylor66b261a2008-09-19 14:39:49 -070022PATH=/bin:/usr/bin:$HOME/bin:`pwd`
23
Rob Pike3963fe32008-08-08 10:57:23 -070024# don't use $$ in file names to avoid spurious diffs
25RUNFILE=/tmp/gorun-$USER
26TMP1FILE=/tmp/gotest1-$USER
27TMP2FILE=/tmp/gotest2-$USER
28
Russ Cox46eb0f72008-09-08 15:22:45 -070029# don't run the machine out of memory: limit individual processes to 4GB.
30# on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
31ulimit -v 4000000
32
Rob Pike4ce30652008-07-14 15:13:59 -070033for dir in . ken chan bugs fixedbugs
Rob Pike27fb2ab2008-06-06 12:57:00 -070034do
Rob Pikeab34d152008-06-06 14:27:34 -070035 for i in $dir/*.go
36 do
Rob Pikeab34d152008-06-06 14:27:34 -070037 export F=$(basename $i .go)
38 export D=$dir
Rob Pike3963fe32008-08-08 10:57:23 -070039 sed -n '1,/[^/]/p' $i | sed 's@//@@; $d' > $RUNFILE
40 if ! sh $RUNFILE >$TMP1FILE 2>$TMP2FILE
Rob Pikeab34d152008-06-06 14:27:34 -070041 then
Rob Pike3963fe32008-08-08 10:57:23 -070042 echo
43 echo "===========" $i
44 cat $TMP1FILE
45 cat $TMP2FILE
Rob Pikeab34d152008-06-06 14:27:34 -070046 echo >&2 fail: $i
Russ Cox869c3f42008-11-17 12:44:22 -080047 elif test -s $TMP1FILE || test -s $TMP2FILE
Rob Pike3963fe32008-08-08 10:57:23 -070048 then
49 echo
50 echo "===========" $i
51 cat $TMP1FILE
52 cat $TMP2FILE
Russ Cox869c3f42008-11-17 12:44:22 -080053 elif [ $dir = "bugs" ]
54 then
55 echo $i succeeded with no output.
Rob Pikeab34d152008-06-06 14:27:34 -070056 fi
57 done
Rob Pikebf14ef62008-07-07 10:03:10 -070058done | # clean up some stack noise
Rob Pike3963fe32008-08-08 10:57:23 -070059 egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
Russ Cox32556ef2008-09-02 14:26:59 -070060 sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
61 s!'$RUNFILE'!$RUNFILE!g
Russ Coxfb40f882008-09-22 13:47:53 -070062 s/ PC=0x[0-9a-f]*/ PC=xxx/
63 s/^pc: 0x[0-9a-f]*/pc: xxx/
64 /^Trace\/breakpoint trap/d
Ian Lance Taylor07c54422008-11-11 10:01:51 -080065 /RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
66 /^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d' > run.out
Rob Pike126150d2008-06-06 13:28:03 -070067
Rob Pike27fb2ab2008-06-06 12:57:00 -070068case $failed in
691)
70 echo FAIL
71esac
Rob Pike3963fe32008-08-08 10:57:23 -070072rm -f $RUNFILE $TMP1FILE $TMP2FILE *.6 6.out
Rob Pike27fb2ab2008-06-06 12:57:00 -070073if ! diff run.out golden.out
74then
75 failed=1
76fi
Rob Pike17ee7812008-06-06 13:38:16 -070077
Rob Pike094ee442008-06-06 16:56:18 -070078echo 2>&1 $(grep -c '^BUG' run.out) tests are behaving incorrectly
Rob Pike17ee7812008-06-06 13:38:16 -070079
Rob Pike27fb2ab2008-06-06 12:57:00 -070080exit $failed