simd: set GOEXPERIMENT in testdata tests The TestIFace, TestSizeof, TestCompileOk and TestCompileError tests run "go test" as a subprocess to build the testdata packages that import simd, which only builds with GOEXPERIMENT=simd. The subprocess is expected to inherit the experiment from the environment. However, on Plan 9, it is not inherited, so the simd package has no buildable files and the subprocess fails with "build constraints exclude all Go files in src/simd". This change sets GOEXPERIMENT explicitly in the subprocess environment, instead of relying on inheritance, as cmd/internal/testdir already does. Change-Id: I40ddc85296bb10320804804a53cef891b7901102 Reviewed-on: https://go-review.googlesource.com/c/go/+/792280 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: David Chase <drchase@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/src/simd/testdata_test.go b/src/simd/testdata_test.go index b8623cf..7a81b50 100644 --- a/src/simd/testdata_test.go +++ b/src/simd/testdata_test.go
@@ -24,6 +24,15 @@ args = append(args, what) cmd := testenv.Command(t, testenv.GoToolPath(t), args...) + goexp := os.Getenv("GOEXPERIMENT") + if !strings.Contains(","+goexp+",", ",simd,") { + if goexp != "" { + goexp += "," + } + goexp += "simd" + } + cmd.Env = append(cmd.Environ(), "GOEXPERIMENT="+goexp) + if failWith == "" { cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr