diff options
author | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2013-01-28 21:29:45 +0100 |
---|---|---|
committer | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2013-01-28 21:29:45 +0100 |
commit | 7ef6780a1d45f7ba4fb61c81ef847c2a3d2e5ac3 (patch) | |
tree | 423ce47216f2d876555075ede1426da8b2bd84f5 /test/testlib | |
parent | 2c2848f5dce77b7a6586a336f216b8fcc2f2a509 (diff) | |
download | go-7ef6780a1d45f7ba4fb61c81ef847c2a3d2e5ac3.tar.gz |
test: add support for build tags.
This enables a few tests that were only executed
unconditionnally.
R=rsc, minux.ma, bradfitz
CC=golang-dev
https://codereview.appspot.com/7103051
Diffstat (limited to 'test/testlib')
-rw-r--r-- | test/testlib | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/testlib b/test/testlib index b58e8831c..de138b1d1 100644 --- a/test/testlib +++ b/test/testlib @@ -16,6 +16,31 @@ pkgs() { done | sort } +# +build aborts execution if the supplied tags don't match, +# i.e. none of the tags (x or !x) matches GOARCH or GOOS. ++build() { + if (( $# == 0 )); then + return + fi + for tag; do + case $tag in + $GOARCH|$GOOS) + #echo >&2 "match $tag in $1" + return # don't exclude. + ;; + '!'$GOARCH|'!'$GOOS) + ;; + '!'*) + # not x where x is neither GOOS nor GOARCH. + #echo >&2 "match $tag in $1" + return # don't exclude + ;; + esac + done + # no match. + exit 0 +} + compile() { $G $D/$F.go } |