mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
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 <iant@golang.org> Reviewed-by: Chris Broadfoot <cbro@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
807424b52b
commit
3da34b1b52
11
cmd/gorename/cgo_test.go
Normal file
11
cmd/gorename/cgo_test.go
Normal file
@ -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
|
||||||
|
}
|
@ -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
|
package main_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -12,6 +16,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var haveCGO bool
|
||||||
|
|
||||||
type test struct {
|
type test struct {
|
||||||
offset, from, to string // specify the arguments
|
offset, from, to string // specify the arguments
|
||||||
fileSpecified bool // true if the offset or from args specify a specific file
|
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.
|
// Test that renaming that would modify cgo files will produce an error and not modify the file.
|
||||||
func TestGeneratedFiles(t *testing.T) {
|
func TestGeneratedFiles(t *testing.T) {
|
||||||
|
if !haveCGO {
|
||||||
|
t.Skipf("skipping test: no cgo")
|
||||||
|
}
|
||||||
|
|
||||||
tmp, bin, cleanup := buildGorename(t)
|
tmp, bin, cleanup := buildGorename(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user