]> Cypherpunks repositories - gostls13.git/commitdiff
test: switch fieldtrack test to use GOEXPERIMENT
authorAustin Clements <austin@google.com>
Thu, 18 Mar 2021 15:35:45 +0000 (11:35 -0400)
committerAustin Clements <austin@google.com>
Thu, 18 Mar 2021 21:27:21 +0000 (21:27 +0000)
Now that we can set GOEXPERIMENT at build time, we no longer need
-d=fieldtrack in the compiler to enabled field tracking at build time.
Switch the one test that uses -d=fieldtrack to use GOEXPERIMENT
instead so we can eliminate this debug flag and centralize on
GOEXPERIMENT.

Updates #42681.

Change-Id: I14c352c9a97187b9c5ec8027ff672d685f22f543
Reviewed-on: https://go-review.googlesource.com/c/go/+/302969
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
test/fixedbugs/issue42686.go
test/run.go

index 962bdd35cbea29039226b4e2f3609de0165de8d7..9f9075ca7d021b20c6d06920a15a819c5622ecfd 100644 (file)
@@ -1,4 +1,4 @@
-// compile -d=fieldtrack
+// compile -goexperiment fieldtrack
 
 // Copyright 2020 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index 4c01886560e37b654c0eacac158822b90725eb65..7d5a558f2d2753b542976e97dcffc985d8cbac18 100644 (file)
@@ -513,7 +513,7 @@ func (t *test) run() {
                return
        }
 
-       var args, flags []string
+       var args, flags, runenv []string
        var tim int
        wantError := false
        wantAuto := false
@@ -572,6 +572,9 @@ func (t *test) run() {
                        if err != nil {
                                t.err = fmt.Errorf("need number of seconds for -t timeout, got %s instead", args[0])
                        }
+               case "-goexperiment": // set GOEXPERIMENT environment
+                       args = args[1:]
+                       runenv = append(runenv, "GOEXPERIMENT="+args[0])
 
                default:
                        flags = append(flags, args[0])
@@ -628,6 +631,7 @@ func (t *test) run() {
                if tempDirIsGOPATH {
                        cmd.Env = append(cmd.Env, "GOPATH="+t.tempDir)
                }
+               cmd.Env = append(cmd.Env, runenv...)
 
                var err error