Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

     1  [!cgo] skip
     2  
     3  # Set CC explicitly to something that requires a PATH lookup.
     4  # Normally, the default is gcc or clang, but if CC was set during make.bash,
     5  # that becomes the default.
     6  [exec:clang] env CC=clang
     7  [exec:gcc] env CC=gcc
     8  [!exec:clang] [!exec:gcc] skip 'Unknown C compiler'
     9  
    10  env GOCACHE=$WORK/gocache  # Looking for compile flags, so need a clean cache.
    11  [!windows] env PATH=.:$PATH
    12  [!windows] chmod 0755 p/gcc p/clang
    13  [!windows] exists -exec p/gcc p/clang
    14  [windows] exists -exec p/gcc.bat p/clang.bat
    15  ! exists p/bug.txt
    16  ! go build -x
    17  stderr '^cgo: exec (clang|gcc): (clang|gcc) resolves to executable relative to current directory \(.[/\\](clang|gcc)(.bat)?\)$'
    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