From 3da34b1b520a543128e8441cd2ffffc383111d03 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Mon, 17 Jul 2017 14:44:42 -0700 Subject: [PATCH] cmd/gorename: disable TestGeneratedFiles for !cgo builds Fixes golang/go#21055. Change-Id: I126cef4496c15424048e39b2af111c95580b90fb Reviewed-on: https://go-review.googlesource.com/49390 Reviewed-by: Ian Lance Taylor Reviewed-by: Chris Broadfoot Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- cmd/gorename/cgo_test.go | 11 +++++++++++ cmd/gorename/gorename_test.go | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 cmd/gorename/cgo_test.go diff --git a/cmd/gorename/cgo_test.go b/cmd/gorename/cgo_test.go new file mode 100644 index 0000000000..fd07553fc6 --- /dev/null +++ b/cmd/gorename/cgo_test.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 main_test + +func init() { + haveCGO = true +} diff --git a/cmd/gorename/gorename_test.go b/cmd/gorename/gorename_test.go index e598b342e3..20dbd9e123 100644 --- a/cmd/gorename/gorename_test.go +++ b/cmd/gorename/gorename_test.go @@ -1,3 +1,7 @@ +// 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. + package main_test import ( @@ -12,6 +16,8 @@ import ( "testing" ) +var haveCGO bool + type test struct { offset, from, to string // specify the arguments fileSpecified bool // true if the offset or from args specify a specific file @@ -23,6 +29,10 @@ type test struct { // Test that renaming that would modify cgo files will produce an error and not modify the file. func TestGeneratedFiles(t *testing.T) { + if !haveCGO { + t.Skipf("skipping test: no cgo") + } + tmp, bin, cleanup := buildGorename(t) defer cleanup()