github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/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 TestInternalLinkerCgoFile(t *testing.T) {
    15  	if !canInternalLink() {
    16  		t.Skip("skipping; internal linking is not supported")
    17  	}
    18  	testGoFile(t, true, false)
    19  }
    20  
    21  func canInternalLink() bool {
    22  	switch runtime.GOOS {
    23  	case "dragonfly":
    24  		return false
    25  	case "linux":
    26  		switch runtime.GOARCH {
    27  		case "arm64", "mips64", "mips64le", "mips", "mipsle":
    28  			return false
    29  		}
    30  	}
    31  	return true
    32  }
    33  
    34  func TestExternalLinkerCgoFile(t *testing.T) {
    35  	testGoFile(t, true, true)
    36  }