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 <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
This commit is contained in:
Bryan C. Mills 2022-12-02 13:52:51 -05:00 коммит произвёл Gopher Robot
Родитель 2ad6325d90
Коммит bdcd082252
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

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