From 0a6c4c87404ecb018faf002919e5d5db04c69ee2 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Mon, 31 Oct 2022 11:14:35 -0400 Subject: [PATCH] cmd/compile/internal/types2: fix tests on js/wasm The js/wasm builder started failing as of CL 432535 due to needing 'go build' to import standard-library packages that are no longer installed to GOROOT/pkg. Since js/wasm can't exec subprocesses, it cannot run 'go build' to generate the export data needed for these tests. For #47257. Change-Id: I804235fd725faf00b27cbed79ee1f43dea8ab734 Reviewed-on: https://go-review.googlesource.com/c/go/+/446635 Run-TryBot: Bryan Mills Reviewed-by: Robert Griesemer TryBot-Result: Gopher Robot Auto-Submit: Bryan Mills --- src/cmd/compile/internal/types2/example_test.go | 2 +- src/cmd/compile/internal/types2/issues_test.go | 2 ++ src/cmd/compile/internal/types2/self_test.go | 5 +++++ src/cmd/compile/internal/types2/sizes_test.go | 3 +++ src/cmd/compile/internal/types2/typestring_test.go | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/types2/example_test.go b/src/cmd/compile/internal/types2/example_test.go index 85f5f2a61c..b89cadfb4a 100644 --- a/src/cmd/compile/internal/types2/example_test.go +++ b/src/cmd/compile/internal/types2/example_test.go @@ -5,7 +5,7 @@ // Only run where builders (build.golang.org) have // access to compiled packages for import. // -//go:build !arm && !arm64 +//go:build !android && !ios && !js package types2_test diff --git a/src/cmd/compile/internal/types2/issues_test.go b/src/cmd/compile/internal/types2/issues_test.go index 777f7af7bf..c45c536e91 100644 --- a/src/cmd/compile/internal/types2/issues_test.go +++ b/src/cmd/compile/internal/types2/issues_test.go @@ -552,6 +552,8 @@ func TestIssue44515(t *testing.T) { } func TestIssue43124(t *testing.T) { + testenv.MustHaveGoBuild(t) + // All involved packages have the same name (template). Error messages should // disambiguate between text/template and html/template by printing the full // path. diff --git a/src/cmd/compile/internal/types2/self_test.go b/src/cmd/compile/internal/types2/self_test.go index 9a01ccdf7a..e68d52db42 100644 --- a/src/cmd/compile/internal/types2/self_test.go +++ b/src/cmd/compile/internal/types2/self_test.go @@ -6,6 +6,7 @@ package types2_test import ( "cmd/compile/internal/syntax" + "internal/testenv" "path" "path/filepath" "runtime" @@ -16,6 +17,8 @@ import ( ) func TestSelf(t *testing.T) { + testenv.MustHaveGoBuild(t) // The Go command is needed for the importer to determine the locations of stdlib .a files. + files, err := pkgFiles(".") if err != nil { t.Fatal(err) @@ -29,6 +32,8 @@ func TestSelf(t *testing.T) { } func BenchmarkCheck(b *testing.B) { + testenv.MustHaveGoBuild(b) // The Go command is needed for the importer to determine the locations of stdlib .a files. + for _, p := range []string{ filepath.Join("src", "net", "http"), filepath.Join("src", "go", "parser"), diff --git a/src/cmd/compile/internal/types2/sizes_test.go b/src/cmd/compile/internal/types2/sizes_test.go index a6c8468d1f..e548c2d047 100644 --- a/src/cmd/compile/internal/types2/sizes_test.go +++ b/src/cmd/compile/internal/types2/sizes_test.go @@ -9,6 +9,7 @@ package types2_test import ( "cmd/compile/internal/syntax" "cmd/compile/internal/types2" + "internal/testenv" "testing" ) @@ -101,6 +102,8 @@ const _ = unsafe.Offsetof(struct{ x int64 }{}.x) // Issue #53884. func TestAtomicAlign(t *testing.T) { + testenv.MustHaveGoBuild(t) // The Go command is needed for the importer to determine the locations of stdlib .a files. + const src = ` package main diff --git a/src/cmd/compile/internal/types2/typestring_test.go b/src/cmd/compile/internal/types2/typestring_test.go index 735b153fb2..7dd9b35281 100644 --- a/src/cmd/compile/internal/types2/typestring_test.go +++ b/src/cmd/compile/internal/types2/typestring_test.go @@ -109,6 +109,7 @@ var dependentTestTypes = []testEntry{ } func TestTypeString(t *testing.T) { + // The Go command is needed for the importer to determine the locations of stdlib .a files. testenv.MustHaveGoBuild(t) var tests []testEntry -- 2.48.1