aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2017-03-30 15:07:05 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2017-03-30 22:32:33 +0000
commit94c62efe9cfb9b3d9f0934dcb6d40a0ae522cdff (patch)
tree792db17c2dff980b618cbe2cd4e7a0273caca2d0 /src/internal
parentac99ade5a09a685f20df3b0d62c98cd3de7a575e (diff)
downloadgo-94c62efe9cfb9b3d9f0934dcb6d40a0ae522cdff.tar.xz
cmd/link: skip TestDWARF when cgo is disabled
While we're here, fix a Skip/Skipf error I noticed. Fixes #19796. Change-Id: I59b1f5b5ea727fc314acfee8445b3de0b5af1e46 Reviewed-on: https://go-review.googlesource.com/38992 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/testenv/testenv.go9
-rw-r--r--src/internal/testenv/testenv_cgo.go11
2 files changed, 20 insertions, 0 deletions
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go
index 4cd8a2b541..1a13ac3f2b 100644
--- a/src/internal/testenv/testenv.go
+++ b/src/internal/testenv/testenv.go
@@ -151,6 +151,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
index 0000000000..e3d4d16b33
--- /dev/null
+++ b/src/internal/testenv/testenv_cgo.go
@@ -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
+}