Skip to content

Commit

Permalink
go/internal/gcimporter: skip typeparam import tests on unified builders
Browse files Browse the repository at this point in the history
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 <[email protected]>
Run-TryBot: Robert Findley <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
gopls-CI: kokoro <[email protected]>
TryBot-Result: Go Bot <[email protected]>
  • Loading branch information
findleyr committed Sep 28, 2021
1 parent 64bbad1 commit da36f79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions go/internal/gcimporter/iexport_go118_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion go/internal/gcimporter/iexport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down

0 comments on commit da36f79

Please sign in to comment.