From 7e31d9b9f7e8e4e72472cfcbd807b5672806635a Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Thu, 5 Oct 2017 17:43:38 +1100 Subject: [PATCH] misc/cgo/testcshared: skip all but TestExportedSymbols on windows TestUnexportedSymbols requires dup2 that my gcc installation does not have. TestSignalHandlersWithNotify fails with: undefined: syscall.SIGIO. TestSignalHandlers fails with: sched.h: No such file or directory. TestExportedSymbolsWithDynamicLoad fails with: dlfcn.h: No such file or directory. Also add t.Helper calls to better error messages. Updates #11058 Change-Id: I7eb514968464256b8337e45f57fcb7d7fe0e4693 Reviewed-on: https://go-review.googlesource.com/68410 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- misc/cgo/testcshared/cshared_test.go | 29 ++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/misc/cgo/testcshared/cshared_test.go b/misc/cgo/testcshared/cshared_test.go index db8b5082fc..0a2e06e702 100644 --- a/misc/cgo/testcshared/cshared_test.go +++ b/misc/cgo/testcshared/cshared_test.go @@ -188,6 +188,7 @@ func adbRun(t *testing.T, env []string, adbargs ...string) string { } func run(t *testing.T, env []string, args ...string) string { + t.Helper() cmd := exec.Command(args[0], args[1:]...) cmd.Env = env out, err := cmd.CombinedOutput() @@ -200,6 +201,7 @@ func run(t *testing.T, env []string, args ...string) string { } func runExe(t *testing.T, env []string, args ...string) string { + t.Helper() if GOOS == "android" { return adbRun(t, env, args...) } @@ -207,6 +209,7 @@ func runExe(t *testing.T, env []string, args ...string) string { } func runCC(t *testing.T, args ...string) string { + t.Helper() return run(t, nil, append(cc, args...)...) } @@ -295,6 +298,11 @@ func TestExportedSymbols(t *testing.T) { func TestExportedSymbolsWithDynamicLoad(t *testing.T) { t.Parallel() + if GOOS == "windows" { + t.Logf("Skipping on %s", GOOS) + return + } + cmd := "testp1" createHeadersOnce(t) @@ -314,6 +322,11 @@ func TestExportedSymbolsWithDynamicLoad(t *testing.T) { func TestUnexportedSymbols(t *testing.T) { t.Parallel() + if GOOS == "windows" { + t.Logf("Skipping on %s", GOOS) + return + } + cmd := "testp2" libname := "libgo2." + libSuffix @@ -348,7 +361,11 @@ func TestUnexportedSymbols(t *testing.T) { func TestMainExportedOnAndroid(t *testing.T) { t.Parallel() - if GOOS != "android" { + switch GOOS { + case "android": + break + default: + t.Logf("Skipping on %s", GOOS) return } @@ -394,12 +411,20 @@ func testSignalHandlers(t *testing.T, pkgname, cfile, cmd string) { // test4: test signal handlers func TestSignalHandlers(t *testing.T) { t.Parallel() + if GOOS == "windows" { + t.Logf("Skipping on %s", GOOS) + return + } testSignalHandlers(t, "libgo4", "main4.c", "testp4") } // test5: test signal handlers with os/signal.Notify func TestSignalHandlersWithNotify(t *testing.T) { t.Parallel() + if GOOS == "windows" { + t.Logf("Skipping on %s", GOOS) + return + } testSignalHandlers(t, "libgo5", "main5.c", "testp5") } @@ -410,7 +435,7 @@ func TestPIE(t *testing.T) { case "linux", "android": break default: - t.Logf("Skipping TestPIE on %s", GOOS) + t.Logf("Skipping on %s", GOOS) return } -- 2.48.1