Commit 7e31d9b9 authored by Alex Brainman's avatar Alex Brainman

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 <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 31a3b719
...@@ -188,6 +188,7 @@ func adbRun(t *testing.T, env []string, adbargs ...string) string { ...@@ -188,6 +188,7 @@ func adbRun(t *testing.T, env []string, adbargs ...string) string {
} }
func run(t *testing.T, env []string, args ...string) string { func run(t *testing.T, env []string, args ...string) string {
t.Helper()
cmd := exec.Command(args[0], args[1:]...) cmd := exec.Command(args[0], args[1:]...)
cmd.Env = env cmd.Env = env
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
...@@ -200,6 +201,7 @@ func run(t *testing.T, env []string, args ...string) string { ...@@ -200,6 +201,7 @@ func run(t *testing.T, env []string, args ...string) string {
} }
func runExe(t *testing.T, env []string, args ...string) string { func runExe(t *testing.T, env []string, args ...string) string {
t.Helper()
if GOOS == "android" { if GOOS == "android" {
return adbRun(t, env, args...) return adbRun(t, env, args...)
} }
...@@ -207,6 +209,7 @@ func runExe(t *testing.T, env []string, args ...string) string { ...@@ -207,6 +209,7 @@ func runExe(t *testing.T, env []string, args ...string) string {
} }
func runCC(t *testing.T, args ...string) string { func runCC(t *testing.T, args ...string) string {
t.Helper()
return run(t, nil, append(cc, args...)...) return run(t, nil, append(cc, args...)...)
} }
...@@ -295,6 +298,11 @@ func TestExportedSymbols(t *testing.T) { ...@@ -295,6 +298,11 @@ func TestExportedSymbols(t *testing.T) {
func TestExportedSymbolsWithDynamicLoad(t *testing.T) { func TestExportedSymbolsWithDynamicLoad(t *testing.T) {
t.Parallel() t.Parallel()
if GOOS == "windows" {
t.Logf("Skipping on %s", GOOS)
return
}
cmd := "testp1" cmd := "testp1"
createHeadersOnce(t) createHeadersOnce(t)
...@@ -314,6 +322,11 @@ func TestExportedSymbolsWithDynamicLoad(t *testing.T) { ...@@ -314,6 +322,11 @@ func TestExportedSymbolsWithDynamicLoad(t *testing.T) {
func TestUnexportedSymbols(t *testing.T) { func TestUnexportedSymbols(t *testing.T) {
t.Parallel() t.Parallel()
if GOOS == "windows" {
t.Logf("Skipping on %s", GOOS)
return
}
cmd := "testp2" cmd := "testp2"
libname := "libgo2." + libSuffix libname := "libgo2." + libSuffix
...@@ -348,7 +361,11 @@ func TestUnexportedSymbols(t *testing.T) { ...@@ -348,7 +361,11 @@ func TestUnexportedSymbols(t *testing.T) {
func TestMainExportedOnAndroid(t *testing.T) { func TestMainExportedOnAndroid(t *testing.T) {
t.Parallel() t.Parallel()
if GOOS != "android" { switch GOOS {
case "android":
break
default:
t.Logf("Skipping on %s", GOOS)
return return
} }
...@@ -394,12 +411,20 @@ func testSignalHandlers(t *testing.T, pkgname, cfile, cmd string) { ...@@ -394,12 +411,20 @@ func testSignalHandlers(t *testing.T, pkgname, cfile, cmd string) {
// test4: test signal handlers // test4: test signal handlers
func TestSignalHandlers(t *testing.T) { func TestSignalHandlers(t *testing.T) {
t.Parallel() t.Parallel()
if GOOS == "windows" {
t.Logf("Skipping on %s", GOOS)
return
}
testSignalHandlers(t, "libgo4", "main4.c", "testp4") testSignalHandlers(t, "libgo4", "main4.c", "testp4")
} }
// test5: test signal handlers with os/signal.Notify // test5: test signal handlers with os/signal.Notify
func TestSignalHandlersWithNotify(t *testing.T) { func TestSignalHandlersWithNotify(t *testing.T) {
t.Parallel() t.Parallel()
if GOOS == "windows" {
t.Logf("Skipping on %s", GOOS)
return
}
testSignalHandlers(t, "libgo5", "main5.c", "testp5") testSignalHandlers(t, "libgo5", "main5.c", "testp5")
} }
...@@ -410,7 +435,7 @@ func TestPIE(t *testing.T) { ...@@ -410,7 +435,7 @@ func TestPIE(t *testing.T) {
case "linux", "android": case "linux", "android":
break break
default: default:
t.Logf("Skipping TestPIE on %s", GOOS) t.Logf("Skipping on %s", GOOS)
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment