aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/cgo/internal/testplugin/plugin_test.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2023-04-26 12:16:26 -0400
committerAustin Clements <austin@google.com>2023-05-19 01:37:31 +0000
commita674ab1961ca75d902ebbdf0a3d363501fd017ae (patch)
tree7c4a0648a9a95c3bb79060c6000e96c817c77ffa /src/cmd/cgo/internal/testplugin/plugin_test.go
parent071770b846452ef9b00277ef5e1d8693bb891ac2 (diff)
downloadgo-a674ab1961ca75d902ebbdf0a3d363501fd017ae.tar.xz
cmd/dist: refine test conditions and enable more cgo tests on Android, iOS
This CL moves many cgo test conditions out of dist and into the tests themselves, now that they can use the testenv.Must* helpers. This refines a lot of the conditions, which happens to have the effect of enabling many tests on Android and iOS that are disabled by too-coarse GOOS checks in dist today. Fixes #15919. Change-Id: I2947526b08928d2f7f89f107b5b2403b32092ed8 Reviewed-on: https://go-review.googlesource.com/c/go/+/495918 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/cgo/internal/testplugin/plugin_test.go')
-rw-r--r--src/cmd/cgo/internal/testplugin/plugin_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cmd/cgo/internal/testplugin/plugin_test.go b/src/cmd/cgo/internal/testplugin/plugin_test.go
index 84ea839a2f..e211a96304 100644
--- a/src/cmd/cgo/internal/testplugin/plugin_test.go
+++ b/src/cmd/cgo/internal/testplugin/plugin_test.go
@@ -9,10 +9,13 @@ import (
"context"
"flag"
"fmt"
+ "internal/platform"
+ "internal/testenv"
"log"
"os"
"os/exec"
"path/filepath"
+ "runtime"
"strings"
"testing"
"time"
@@ -44,6 +47,17 @@ func prettyPrintf(format string, args ...interface{}) {
}
func testMain(m *testing.M) int {
+ // TODO: Move all of this initialization stuff into a sync.Once that each
+ // test can use, where we can properly t.Skip.
+ if !platform.BuildModeSupported(runtime.Compiler, "plugin", runtime.GOOS, runtime.GOARCH) {
+ fmt.Printf("SKIP - plugin build mode not supported\n")
+ os.Exit(0)
+ }
+ if !testenv.HasCGO() {
+ fmt.Printf("SKIP - cgo not supported\n")
+ os.Exit(0)
+ }
+
cwd, err := os.Getwd()
if err != nil {
log.Fatal(err)