summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-09-04 13:04:11 -0700
committerRuss Cox <rsc@golang.org>2009-09-04 13:04:11 -0700
commit08e1a462a3793b21ae07bbe5905c7c3b01f71cd7 (patch)
tree7771e0ef6b565200fe3e05c4c1ec3d364d319e63
parent9cea4979f4b57c127dc261577742884c00bdfc7f (diff)
downloadgo-08e1a462a3793b21ae07bbe5905c7c3b01f71cd7.tar.gz
script for running test programs in interpreter.
tweak test/literal.go to give more information. R=austin DELTA=45 (43 added, 0 deleted, 2 changed) OCL=34381 CL=34398
-rw-r--r--test/literal.go13
-rwxr-xr-xusr/austin/eval/test.bash34
2 files changed, 45 insertions, 2 deletions
diff --git a/test/literal.go b/test/literal.go
index 673a53c7d..00b7b7342 100644
--- a/test/literal.go
+++ b/test/literal.go
@@ -6,10 +6,15 @@
package main
+var nbad int
+
func assert(cond bool, msg string) {
if !cond {
- print("assertion fail: ", msg, "\n");
- panic(1);
+ if nbad == 0 {
+ print("BUG");
+ }
+ nbad++;
+ print(" ", msg);
}
}
@@ -210,4 +215,8 @@ func main() {
assert(sj0 == sj1, "sj1");
assert(sj0 == sj2, "sj2");
assert(sj0 == sj3, "sj3");
+
+ if nbad > 0 {
+ println()
+ }
}
diff --git a/usr/austin/eval/test.bash b/usr/austin/eval/test.bash
new file mode 100755
index 000000000..81f4c3dd1
--- /dev/null
+++ b/usr/austin/eval/test.bash
@@ -0,0 +1,34 @@
+#!/bin/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.
+
+# Run the interpreter against all the Go test programs
+# that begin with the magic
+# // $G $D/$F.go && $L $F.$A && ./$A.out
+# line and do not contain imports.
+
+set -e
+make
+6g main.go && 6l main.6
+(
+for i in $(egrep -l '// \$G (\$D/)?\$F\.go \&\& \$L \$F\.\$A && \./\$A\.out' $GOROOT/test/*.go $GOROOT/test/*/*.go)
+do
+ if grep '^import' $i >/dev/null 2>&1
+ then
+ true
+ else
+ if $GOROOT/usr/austin/eval/6.out -f $i >/tmp/out 2>&1 && ! test -s /tmp/out
+ then
+ echo PASS $i
+ else
+ echo FAIL $i
+ (
+ echo '>>> ' $i
+ cat /tmp/out
+ echo
+ ) 1>&3
+ fi
+ fi
+done | (tee /dev/fd/2 | awk '{print $1}' | sort | uniq -c) 2>&1
+) 3>test.log