]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.8] cmd/link: skip TestDWARF when cgo is disabled
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 30 Mar 2017 22:07:05 +0000 (15:07 -0700)
committerAustin Clements <austin@google.com>
Wed, 5 Apr 2017 18:11:34 +0000 (18:11 +0000)
While we're here, fix a Skip/Skipf error I noticed.

Fixes #19796.

(This fixes failures on the release branch introduced by cherry-pick
CL 39605.)

Change-Id: I59b1f5b5ea727fc314acfee8445b3de0b5af1e46
Reviewed-on: https://go-review.googlesource.com/39612
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/link/dwarf_test.go
src/cmd/link/linkbig_test.go
src/internal/testenv/testenv.go
src/internal/testenv/testenv_cgo.go [new file with mode: 0644]

index f10eaedaf57c7f5f6825d9a4ddab40593f3d0c94..32fa3a32a3531afbd082f5f5392b1f1e44e9b28e 100644 (file)
@@ -24,6 +24,7 @@ func TestDWARF(t *testing.T) {
                t.Skip("DWARF is not supported on Windows")
        }
 
+       testenv.MustHaveCGO(t)
        testenv.MustHaveGoBuild(t)
 
        if runtime.GOOS == "plan9" {
index d793c2f5f24cd34da754d455e5d63d5dc1564f4e..960d89fd21f9543d55f03fa329fe2d269a071a9d 100644 (file)
@@ -21,7 +21,7 @@ import (
 
 func TestLargeText(t *testing.T) {
        if testing.Short() || (obj.GOARCH != "ppc64le" && obj.GOARCH != "ppc64" && obj.GOARCH != "arm") {
-               t.Skip("Skipping large text section test in short mode or on %s", obj.GOARCH)
+               t.Skipf("Skipping large text section test in short mode or on %s", obj.GOARCH)
        }
        testenv.MustHaveGoBuild(t)
 
index 10384b62062a6301361dc537c1109bef34d0c1a0..f7c4ad268292da1d8d96548a4ed3dfc7de714b81 100644 (file)
@@ -138,6 +138,15 @@ func MustHaveExternalNetwork(t *testing.T) {
        }
 }
 
+var haveCGO bool
+
+// MustHaveCGO calls t.Skip if cgo is not available.
+func MustHaveCGO(t *testing.T) {
+       if !haveCGO {
+               t.Skipf("skipping test: no cgo")
+       }
+}
+
 // HasSymlink reports whether the current system can use os.Symlink.
 func HasSymlink() bool {
        ok, _ := hasSymlink()
diff --git a/src/internal/testenv/testenv_cgo.go b/src/internal/testenv/testenv_cgo.go
new file mode 100644 (file)
index 0000000..e3d4d16
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build cgo
+
+package testenv
+
+func init() {
+       haveCGO = true
+}