Commit d7989b78 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder Committed by Austin Clements

[release-branch.go1.8] cmd/link: skip TestDWARF when cgo is disabled

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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 056be9f7
...@@ -24,6 +24,7 @@ func TestDWARF(t *testing.T) { ...@@ -24,6 +24,7 @@ func TestDWARF(t *testing.T) {
t.Skip("DWARF is not supported on Windows") t.Skip("DWARF is not supported on Windows")
} }
testenv.MustHaveCGO(t)
testenv.MustHaveGoBuild(t) testenv.MustHaveGoBuild(t)
if runtime.GOOS == "plan9" { if runtime.GOOS == "plan9" {
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
func TestLargeText(t *testing.T) { func TestLargeText(t *testing.T) {
if testing.Short() || (obj.GOARCH != "ppc64le" && obj.GOARCH != "ppc64" && obj.GOARCH != "arm") { 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) testenv.MustHaveGoBuild(t)
......
...@@ -138,6 +138,15 @@ func MustHaveExternalNetwork(t *testing.T) { ...@@ -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. // HasSymlink reports whether the current system can use os.Symlink.
func HasSymlink() bool { func HasSymlink() bool {
ok, _ := hasSymlink() ok, _ := hasSymlink()
......
// 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
}
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