aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/cgo_path.txt
blob: 548a65ffa8ec3d95be852946f27e0983be480c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[!cgo] skip

# Set CC explicitly to something that requires a PATH lookup.
# Normally, the default is gcc or clang, but if CC was set during make.bash,
# that becomes the default.
[exec:clang] env CC=clang
[exec:gcc] env CC=gcc
[!exec:clang] [!exec:gcc] skip 'Unknown C compiler'

env GOCACHE=$WORK/gocache  # Looking for compile flags, so need a clean cache.
[!windows] env PATH=.:$PATH
[!windows] chmod 0755 p/gcc p/clang
[!windows] exists p/gcc p/clang
[windows] exists p/gcc.bat p/clang.bat
! exists p/bug.txt
! go build -x
stderr '^cgo: exec (clang|gcc): (clang|gcc) resolves to executable in current directory \(.[/\\](clang|gcc)(.bat)?\)$'
! exists p/bug.txt

-- go.mod --
module m

-- m.go --
package m

import _ "m/p"

-- p/p.go --
package p

// #define X 1
import "C"

-- p/gcc --
#!/bin/sh
echo ran gcc >bug.txt
-- p/clang --
#!/bin/sh
echo ran clang >bug.txt
-- p/gcc.bat --
echo ran gcc >bug.txt
-- p/clang.bat --
echo ran clang >bug.txt