From da36f796b4c1a3a4497d000e2d04be147c340991 Mon Sep 17 00:00:00 2001 From: Robert Findley Date: Tue, 28 Sep 2021 16:15:47 -0400 Subject: [PATCH] go/internal/gcimporter: skip typeparam import tests on unified builders CL 351855 introduced a typeparam test that imported the constraints package. As reported in golang/go#48595, this package is currently breaking with the unified export data format. Updates golang/go#48595 Change-Id: I1b77955c767a2e890d8d8829cca6455a4e79c5ee Reviewed-on: https://go-review.googlesource.com/c/tools/+/352853 Trust: Robert Findley Run-TryBot: Robert Findley Reviewed-by: Rebecca Stambler gopls-CI: kokoro TryBot-Result: Go Bot --- go/internal/gcimporter/iexport_go118_test.go | 4 ++++ go/internal/gcimporter/iexport_test.go | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/go/internal/gcimporter/iexport_go118_test.go b/go/internal/gcimporter/iexport_go118_test.go index 17107530a1..3c9610ea75 100644 --- a/go/internal/gcimporter/iexport_go118_test.go +++ b/go/internal/gcimporter/iexport_go118_test.go @@ -76,6 +76,10 @@ func TestImportTypeparamTests(t *testing.T) { t.Fatal(err) } + if isUnifiedBuilder() { + t.Skip("unified export data format is currently unsupported") + } + for _, entry := range list { if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".go") { // For now, only consider standalone go files. diff --git a/go/internal/gcimporter/iexport_test.go b/go/internal/gcimporter/iexport_test.go index e1e9d7fc61..084679bbd4 100644 --- a/go/internal/gcimporter/iexport_test.go +++ b/go/internal/gcimporter/iexport_test.go @@ -63,6 +63,12 @@ func iexport(fset *token.FileSet, pkg *types.Package) ([]byte, error) { return buf.Bytes(), nil } +// isUnifiedBuilder reports whether we are executing on a go builder that uses +// unified export data. +func isUnifiedBuilder() bool { + return os.Getenv("GO_BUILDER_NAME") == "linux-amd64-unified" +} + func TestIExportData_stdlib(t *testing.T) { if runtime.Compiler == "gccgo" { t.Skip("gccgo standard library is inaccessible") @@ -88,7 +94,7 @@ func TestIExportData_stdlib(t *testing.T) { // TryBots. // // TODO(#48595): fix this test with GOEXPERIMENT=unified. - isUnified := os.Getenv("GO_BUILDER_NAME") == "linux-amd64-unified" + isUnified := isUnifiedBuilder() for _, path := range buildutil.AllPackages(conf.Build) { if !(isUnified && testenv.UsesGenerics(path)) { conf.Import(path)