From 7ef6780a1d45f7ba4fb61c81ef847c2a3d2e5ac3 Mon Sep 17 00:00:00 2001 From: R?my Oudompheng Date: Mon, 28 Jan 2013 21:29:45 +0100 Subject: 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 --- test/testlib | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/testlib') 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 } -- cgit v1.2.1