Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
test: add testlib
Browse files Browse the repository at this point in the history
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5676077
  • Loading branch information
rsc committed Feb 17, 2012
1 parent b27bd42 commit a0c13b9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions test/testlib
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit a0c13b9

Please sign in to comment.