]> Cypherpunks repositories - gostls13.git/commitdiff
test: add testlib
authorRuss Cox <rsc@golang.org>
Fri, 17 Feb 2012 04:48:24 +0000 (23:48 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 17 Feb 2012 04:48:24 +0000 (23:48 -0500)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5676077

test/run
test/testlib [new file with mode: 0644]

index 7f4c350fa328be7ebb4621c3c641c81ae38f876d..67526958d98ce52d0084ff995b0dbfcc3fec92a6 100755 (executable)
--- a/test/run
+++ b/test/run
@@ -67,7 +67,8 @@ do
                fi
                export F=$(basename $i .go)
                export D=$dir
-               sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >"$RUNFILE"
+               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
diff --git a/test/testlib b/test/testlib
new file mode 100644 (file)
index 0000000..ea8c5d7
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright 2012 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.
+
+# These function names are also known to
+# (and are the plan for transitioning to) run.go.
+
+compile() {
+       $G $D/$F.go
+}
+
+build() {
+       $G $D/$F.go && $L $F.$A
+}
+
+run() {
+       $G $D/$F.go && $L $F.$A && ./$A.out "$@"
+}
+
+errorcheck() {
+       errchk $G -e $D/$F.go
+}