blob: 3082095c5c4a94070338bba13c9e0bb394ad84c4 (
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
44
45
46
47
48
49
|
[short] skip
[!cgo] skip
[!exec:/usr/bin/env] skip
[!exec:bash] skip
[!exec:cat] skip
mkdir $WORK/tmp/cache
env GOCACHE=$WORK/tmp/cache
# Before building our test main.go, ensure that an up-to-date copy of
# runtime/cgo is present in the cache. If it isn't, the 'go build' step below
# will fail with "can't open import". See golang.org/issue/29004.
#
# (The fix in golang.org/issue/29004 didn't completely fix the underlying issue:
# cmd/go/internal/load adds a bunch of implicit dependencies
# based on various heuristics, and, due to a bug described in
# https://golang.org/issue/31544#issuecomment-490607180,
# those implicit dependencies are not added early enough during
# loading to properly affect the import graph.)
go build runtime/cgo
go build -x -o main main.go
cp stderr commands.txt
exec cat header.txt commands.txt
cp stdout test.sh
exec ./main
cmp stderr hello.txt
rm ./main
exec /usr/bin/env bash -x test.sh
exec ./main
cmp stderr hello.txt
grep '^WORK=(.*)\n' commands.txt
-- main.go --
package main
import "C"
func main() {
print("hello\n")
}
-- header.txt --
set -e
-- hello.txt --
hello
|