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

     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  
    10  env 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
    17  stderr '^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 --
    21  module m
    22  
    23  -- m.go --
    24  package m
    25  
    26  import _ "m/p"
    27  
    28  -- p/p.go --
    29  package p
    30  
    31  // #define X 1
    32  import "C"
    33  
    34  -- p/gcc --
    35  #!/bin/sh
    36  echo ran gcc >bug.txt
    37  -- p/clang --
    38  #!/bin/sh
    39  echo ran clang >bug.txt
    40  -- p/gcc.bat --
    41  echo ran gcc >bug.txt
    42  -- p/clang.bat --
    43  echo ran clang >bug.txt
    44  

View as plain text