Black Lives Matter. Support the Equal Justice Initiative.

Source file src/cmd/nm/nm_cgo_test.go

Documentation: cmd/nm

     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  //go:build cgo
     6  // +build cgo
     7  
     8  package main
     9  
    10  import (
    11  	"runtime"
    12  	"testing"
    13  )
    14  
    15  func canInternalLink() bool {
    16  	switch runtime.GOOS {
    17  	case "aix":
    18  		return false
    19  	case "dragonfly":
    20  		return false
    21  	case "freebsd":
    22  		switch runtime.GOARCH {
    23  		case "arm64":
    24  			return false
    25  		}
    26  	case "linux":
    27  		switch runtime.GOARCH {
    28  		case "arm64", "mips64", "mips64le", "mips", "mipsle", "ppc64", "ppc64le", "riscv64":
    29  			return false
    30  		}
    31  	case "openbsd":
    32  		switch runtime.GOARCH {
    33  		case "arm64", "mips64":
    34  			return false
    35  		}
    36  	case "windows":
    37  		switch runtime.GOARCH {
    38  		case "arm64":
    39  			return false
    40  		}
    41  	}
    42  	return true
    43  }
    44  
    45  func TestInternalLinkerCgoExec(t *testing.T) {
    46  	if !canInternalLink() {
    47  		t.Skip("skipping; internal linking is not supported")
    48  	}
    49  	testGoExec(t, true, false)
    50  }
    51  
    52  func TestExternalLinkerCgoExec(t *testing.T) {
    53  	testGoExec(t, true, true)
    54  }
    55  
    56  func TestCgoLib(t *testing.T) {
    57  	testGoLib(t, true)
    58  }
    59  

View as plain text