Skip to content

Commit

Permalink
misc/cgo/testcshared: skip all but TestExportedSymbols on windows
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
alexbrainman committed Oct 5, 2017
1 parent 31a3b71 commit 7e31d9b
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions misc/cgo/testcshared/cshared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -200,13 +201,15 @@ 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...)
}
return run(t, env, args...)
}

func runCC(t *testing.T, args ...string) string {
t.Helper()
return run(t, nil, append(cc, args...)...)
}

Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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")
}

Expand All @@ -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
}

Expand Down

0 comments on commit 7e31d9b

Please sign in to comment.