diff options
Diffstat (limited to 'libgo/go/internal')
-rw-r--r-- | libgo/go/internal/testenv/testenv.go | 9 | ||||
-rw-r--r-- | libgo/go/internal/testenv/testenv_cgo.go | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/libgo/go/internal/testenv/testenv.go b/libgo/go/internal/testenv/testenv.go index fdba8b25c3a..71a692b367e 100644 --- a/libgo/go/internal/testenv/testenv.go +++ b/libgo/go/internal/testenv/testenv.go @@ -141,6 +141,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/libgo/go/internal/testenv/testenv_cgo.go b/libgo/go/internal/testenv/testenv_cgo.go new file mode 100644 index 00000000000..e3d4d16b33e --- /dev/null +++ b/libgo/go/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 +} |