summaryrefslogtreecommitdiff
path: root/test/run.go
diff options
context:
space:
mode:
authorDavid du Colombier <0intro@gmail.com>2014-07-24 23:18:54 +0200
committerDavid du Colombier <0intro@gmail.com>2014-07-24 23:18:54 +0200
commit99a409331201451956488a273c1565da4ce51a7e (patch)
tree6cb67eced547c87d477ee1290ddd984e897d3e57 /test/run.go
parent99732faaff186c5e958a546e328d8e35778dc408 (diff)
downloadgo-99a409331201451956488a273c1565da4ce51a7e.tar.gz
test/run: always set goos and goarch
Following CL 68150047, the goos and goarch variables are not currently set when the GOOS and GOARCH environment variables are not set. This made the content of the build tag to be ignored in this case. This CL sets goos and goarch to runtime.GOOS and runtime.GOARCH when the GOOS and GOARCH environments variables are not set. LGTM=aram, bradfitz R=golang-codereviews, aram, gobot, rsc, dave, bradfitz CC=golang-codereviews, rsc https://codereview.appspot.com/112490043
Diffstat (limited to 'test/run.go')
-rw-r--r--test/run.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/run.go b/test/run.go
index a8d4baa3a..a8a6dedb2 100644
--- a/test/run.go
+++ b/test/run.go
@@ -71,8 +71,9 @@ const maxTests = 5000
func main() {
flag.Parse()
- goos = os.Getenv("GOOS")
- goarch = os.Getenv("GOARCH")
+ goos = getenv("GOOS", runtime.GOOS)
+ goarch = getenv("GOARCH", runtime.GOARCH)
+
findExecCmd()
// Disable parallelism if printing or if using a simulator.
@@ -972,3 +973,11 @@ func envForDir(dir string) []string {
env = append(env, "PWD="+dir)
return env
}
+
+func getenv(key, def string) string {
+ value := os.Getenv(key)
+ if value != "" {
+ return value
+ }
+ return def
+}