From bdcd08225250423bf7f5f70d1dad7b2f96c380f0 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 2 Dec 2022 13:52:51 -0500 Subject: [PATCH] internal/gcimporter: skip tests earlier when 'go build' is not available This fixes tests failing on the Android builders on Go 1.20 after CL 454499. Previously the tests were skipped in the 'compile' helper function, but as of that CL they fail before reaching that point due to missing export data for packages in std. Updates golang/go#56967. Updates golang/go#47257. Change-Id: Ief953b6dbc54c8e0b1f71fc18a0d6ab212caf308 Reviewed-on: https://go-review.googlesource.com/c/tools/+/454500 gopls-CI: kokoro Reviewed-by: Jamal Carvalho TryBot-Result: Gopher Robot Run-TryBot: Bryan Mills Auto-Submit: Bryan Mills --- internal/gcimporter/gcimporter_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/gcimporter/gcimporter_test.go b/internal/gcimporter/gcimporter_test.go index 1e1dd358453..ab9a4db4690 100644 --- a/internal/gcimporter/gcimporter_test.go +++ b/internal/gcimporter/gcimporter_test.go @@ -118,6 +118,7 @@ const testfile = "exports.go" func TestImportTestdata(t *testing.T) { needsCompiler(t, "gc") + testenv.NeedsGoBuild(t) // to find stdlib export data in the build cache tmpdir := mktmpdir(t) defer os.RemoveAll(tmpdir) @@ -164,6 +165,7 @@ func TestImportTypeparamTests(t *testing.T) { } testenv.NeedsGo1Point(t, 18) // requires generics + testenv.NeedsGoBuild(t) // to find stdlib export data in the build cache // This package only handles gc export data. if runtime.Compiler != "gc" { @@ -601,6 +603,7 @@ func TestCorrectMethodPackage(t *testing.T) { func TestIssue13566(t *testing.T) { // This package only handles gc export data. needsCompiler(t, "gc") + testenv.NeedsGoBuild(t) // to find stdlib export data in the build cache // On windows, we have to set the -D option for the compiler to avoid having a drive // letter and an illegal ':' in the import path - just skip it (see also issue #3483).