diff options
author | Bryan C. Mills <bcmills@google.com> | 2023-05-12 14:15:16 -0400 |
---|---|---|
committer | Michael Pratt <mpratt@google.com> | 2023-06-13 19:59:39 +0000 |
commit | 0f7675d910cf726f91189459fe7bfa3002b94c48 (patch) | |
tree | b88908e38d5f75f64e24797ade3bddd784bbbff2 | |
parent | 1d85bcea2839f45047f58b5f442cdb728b97e00c (diff) | |
download | go-0f7675d910cf726f91189459fe7bfa3002b94c48.tar.gz go-0f7675d910cf726f91189459fe7bfa3002b94c48.zip |
[release-branch.go1.19] cmd/go: fix TestScript/build_cwd_newline with CGO_ENABLED=0
Updates #60515.
Updates #60167.
Change-Id: I3792682e80a3c48d78a3b9e647cc968a1d5c8f2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/501575
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
(cherry picked from commit e2b1c0baa600968345d18c6ab339f07b09763da1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/501820
TryBot-Bypass: Bryan Mills <bcmills@google.com>
-rw-r--r-- | src/cmd/go/testdata/script/build_cwd_newline.txt | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/cmd/go/testdata/script/build_cwd_newline.txt b/src/cmd/go/testdata/script/build_cwd_newline.txt index 61c6966b02..8f74c01c81 100644 --- a/src/cmd/go/testdata/script/build_cwd_newline.txt +++ b/src/cmd/go/testdata/script/build_cwd_newline.txt @@ -11,26 +11,37 @@ cd $DIR exec pwd cp $WORK/go.mod ./go.mod cp $WORK/main.go ./main.go +cp $WORK/main_nocgo.go ./main_nocgo.go cp $WORK/main_test.go ./main_test.go ! go build -o $devnull . stderr 'package example: invalid package directory .*uh-oh' -! go build -o $devnull main.go +[cgo] ! go build -o $devnull main.go +[!cgo] ! go build -o $devnull main_nocgo.go stderr 'package command-line-arguments: invalid package directory .*uh-oh' ! go run . stderr 'package example: invalid package directory .*uh-oh' -! go run main.go +[cgo] ! go run main.go +[!cgo] ! go run main_nocgo.go stderr 'package command-line-arguments: invalid package directory .*uh-oh' ! go test . stderr 'package example: invalid package directory .*uh-oh' -! go test -v main.go main_test.go +[cgo] ! go test -v main.go main_test.go +[!cgo] ! go test -v main_nocgo.go main_test.go stderr 'package command-line-arguments: invalid package directory .*uh-oh' + # Note: this command fails on release-branch.go1.19 but succeeds + # on release-branch.go1.20 and later. I (bcmills) suspect it may + # have been fixed by CL 437298. +! go list -compiled -e -f '{{with .CompiledGoFiles}}{{.}}{{end}}' . +stderr 'package example: invalid package directory .*uh-oh' +! stdout . +! exists obj_ # Since we do preserve $PWD (or set it appropriately) for commands, and we do # not resolve symlinks unnecessarily, referring to the contents of the unsafe @@ -42,19 +53,22 @@ stderr 'package command-line-arguments: invalid package directory .*uh-oh' symlink $WORK${/}link -> $DIR -go run $WORK${/}link${/}main.go +[cgo] go run $WORK${/}link${/}main.go +[!cgo] go run $WORK${/}link${/}main_nocgo.go ! stdout panic ! stderr panic stderr '^ok$' -go test -v $WORK${/}link${/}main.go $WORK${/}link${/}main_test.go +[cgo] go test -v $WORK${/}link${/}main.go $WORK${/}link${/}main_test.go +[!cgo] go test -v $WORK${/}link${/}main_nocgo.go $WORK${/}link${/}main_test.go ! stdout panic ! stderr panic stdout '^ok$' # 'go test' combines the test's stdout into stderr cd $WORK/link -! go run $DIR${/}main.go +[cgo] ! go run $DIR${/}main.go +[!cgo] ! go run $DIR${/}main_nocgo.go stderr 'package command-line-arguments: invalid package directory .*uh-oh' go run . @@ -62,7 +76,8 @@ go run . ! stderr panic stderr '^ok$' -go run main.go +[cgo] go run main.go +[!cgo] go run main_nocgo.go ! stdout panic ! stderr panic stderr '^ok$' @@ -90,6 +105,15 @@ func main() { /* nothing here */ println("ok") } +-- $WORK/main_nocgo.go -- +//go:build !cgo + +package main + +func main() { + /* nothing here */ + println("ok") +} -- $WORK/main_test.go -- package main |