]> Cypherpunks repositories - gostls13.git/commitdiff
test: small cleanup of code and comments in run.go
authorGiovanni Bajo <rasky@develer.com>
Sun, 15 Apr 2018 20:53:58 +0000 (22:53 +0200)
committerGiovanni Bajo <rasky@develer.com>
Sun, 15 Apr 2018 21:17:43 +0000 (21:17 +0000)
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>
test/run.go

index e80b037ca1f01df802a4cd40ee71088427ac4d7b..e6291c65908af845cb53a9ec7c9ab9d0b8600307 100644 (file)
@@ -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))