...

Text file src/cmd/go/testdata/script/cgo_path.txt

Documentation: cmd/go/testdata/script

     1[short] skip 'runs build'
     2
     3[!cgo] skip
     4
     5# Require that CC is something that requires a PATH lookup.
     6# Normally, the default is gcc or clang, but if CC was set during make.bash,
     7# that becomes the default.
     8[!cc:clang] [!cc:gcc] skip 'C compiler is not gcc or clang'
     9
    10env GOCACHE=$WORK/gocache  # Looking for compile flags, so need a clean cache.
    11[!GOOS:windows] env PATH=.:$PATH
    12[!GOOS:windows] chmod 0755 p/gcc p/clang
    13[!GOOS:windows] exists -exec p/gcc p/clang
    14[GOOS:windows] exists -exec p/gcc.bat p/clang.bat
    15! exists p/bug.txt
    16! go build -x
    17stderr '^cgo: C compiler "(clang|gcc)" not found: exec: "(clang|gcc)": cannot run executable found relative to current directory'
    18! exists p/bug.txt
    19
    20-- go.mod --
    21module m
    22
    23-- m.go --
    24package m
    25
    26import _ "m/p"
    27
    28-- p/p.go --
    29package p
    30
    31// #define X 1
    32import "C"
    33
    34-- p/gcc --
    35#!/bin/sh
    36echo ran gcc >bug.txt
    37-- p/clang --
    38#!/bin/sh
    39echo ran clang >bug.txt
    40-- p/gcc.bat --
    41echo ran gcc >bug.txt
    42-- p/clang.bat --
    43echo ran clang >bug.txt

View as plain text