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 <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Robert Findley 2021-09-28 16:15:47 -04:00
parent 64bbad1f52
commit da36f796b4
2 changed files with 11 additions and 1 deletions

View File

@ -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.

View File

@ -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)