]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix TestCgoExternalThreadSIGPROF again
authorShenghou Ma <minux@golang.org>
Sat, 3 Jan 2015 05:12:34 +0000 (00:12 -0500)
committerMinux Ma <minux@golang.org>
Sat, 3 Jan 2015 05:49:22 +0000 (05:49 +0000)
Shell out to `uname -r` this time, so that the test will compile
even if the platform doesn't have syscall.Sysctl.

Change-Id: I3a19ab5d820bdb94586a97f4507b3837d7040525
Reviewed-on: https://go-review.googlesource.com/2271
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/crash_cgo_test.go

index 5cfcf5ab1f5f2a1dae71bf2e0da8cc58fdd6db7c..29f90fa36d27fc521c008ad71b923b103334bd52 100644 (file)
@@ -7,9 +7,9 @@
 package runtime_test
 
 import (
+       "os/exec"
        "runtime"
        "strings"
-       "syscall"
        "testing"
 )
 
@@ -59,12 +59,12 @@ func TestCgoExternalThreadSIGPROF(t *testing.T) {
        case "darwin":
                // static constructor needs external linking, but we don't support
                // external linking on OS X 10.6.
-               osver, err := syscall.Sysctl("kern.osrelease")
+               out, err := exec.Command("uname", "-r").Output()
                if err != nil {
-                       t.Fatalf("Sysctl(kern.osrelease) failed: %v", err)
+                       t.Fatalf("uname -r failed: %v", err)
                }
                // OS X 10.6 == Darwin 10.x
-               if strings.HasPrefix(osver, "10.") {
+               if strings.HasPrefix(string(out), "10.") {
                        t.Skipf("no external linking on OS X 10.6")
                }
        }