From 2954ef20bb02cef7874b3e200d56667f0f95e49e Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Sun, 15 Apr 2018 22:53:58 +0200 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- test/run.go | 10 +++++----- 1 file 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)) -- 2.50.0