diff options
author | Giovanni Bajo <rasky@develer.com> | 2018-04-15 22:53:58 +0200 |
---|---|---|
committer | Giovanni Bajo <rasky@develer.com> | 2018-04-15 21:17:43 +0000 |
commit | 2954ef20bb02cef7874b3e200d56667f0f95e49e (patch) | |
tree | b7ca86d17085c2e0cd78681fc564a985aadf7996 /test/run.go | |
parent | 26085fcea3a6afd1afb9c881c502c86fb86188a9 (diff) | |
download | go-2954ef20bb02cef7874b3e200d56667f0f95e49e.tar.gz go-2954ef20bb02cef7874b3e200d56667f0f95e49e.zip |
test: small cleanup of code and comments in run.go
While writing CL 107315, I went back and forth for the syntax used for
constraints of build environments in which the architecture did not
support varitants ("plan9/amd64" vs "plan9/amd64/"). I eventually
settled for the latter because the code required less heuristics
(think parsing "plan9/386" vs "386/sse2") but there were a few
leftovers in code and comments.
Change-Id: I9d9a008f3814f9a1642609650eb571e7f1a675cf
Reviewed-on: https://go-review.googlesource.com/107338
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'test/run.go')
-rw-r--r-- | test/run.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/run.go b/test/run.go index e80b037ca1..e6291c6590 100644 --- a/test/run.go +++ b/test/run.go @@ -1292,7 +1292,7 @@ var ( rxAsmCheck = regexp.MustCompile(reMatchCheck) // List of all architecture variants. Key is the GOARCH architecture, - // value[1] is the variant-changing environment variable, and values[1:] + // value[0] is the variant-changing environment variable, and values[1:] // are the supported variants. archVariants = map[string][]string{ "386": {"GO386", "387", "sse2"}, @@ -1317,18 +1317,18 @@ type wantedAsmOpcode struct { } // A build environment triplet separated by slashes (eg: linux/386/sse2). -// The third field can be empty if the arch does not support variants (eg: "plan9/amd64") +// The third field can be empty if the arch does not support variants (eg: "plan9/amd64/") type buildEnv string // Environ returns the environment it represents in cmd.Environ() "key=val" format // For instance, "linux/386/sse2".Environ() returns {"GOOS=linux", "GOARCH=386", "GO386=sse2"} func (b buildEnv) Environ() []string { fields := strings.Split(string(b), "/") - if len(fields) != 3 && len(fields) != 2 { + if len(fields) != 3 { panic("invalid buildEnv string: " + string(b)) } env := []string{"GOOS=" + fields[0], "GOARCH=" + fields[1]} - if len(fields) == 3 { + if fields[2] != "" { env = append(env, archVariants[fields[1]][0]+"="+fields[2]) } return env @@ -1395,7 +1395,7 @@ func (t *test) wantedAsmOpcodes(fn string) asmChecks { } else { subarchs := archVariants[arch] if len(subarchs) == 0 { - envs = append(envs, buildEnv(os+"/"+arch)) + envs = append(envs, buildEnv(os+"/"+arch+"/")) } else { for _, sa := range archVariants[arch][1:] { envs = append(envs, buildEnv(os+"/"+arch+"/"+sa)) |