github.com/likebike/go--@v0.0.0-20190911215757-0bd925d16e96/go/src/cmd/nm/nm_cgo_test.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build cgo
     6  
     7  package main
     8  
     9  import (
    10  	"runtime"
    11  	"testing"
    12  )
    13  
    14  func canInternalLink() bool {
    15  	switch runtime.GOOS {
    16  	case "dragonfly":
    17  		return false
    18  	case "linux":
    19  		switch runtime.GOARCH {
    20  		case "arm64", "mips64", "mips64le", "mips", "mipsle", "ppc64", "ppc64le":
    21  			return false
    22  		}
    23  	}
    24  	return true
    25  }
    26  
    27  func TestInternalLinkerCgoExec(t *testing.T) {
    28  	if !canInternalLink() {
    29  		t.Skip("skipping; internal linking is not supported")
    30  	}
    31  	testGoExec(t, true, false)
    32  }
    33  
    34  func TestExternalLinkerCgoExec(t *testing.T) {
    35  	testGoExec(t, true, true)
    36  }
    37  
    38  func TestCgoLib(t *testing.T) {
    39  	testGoLib(t, true)
    40  }