Skip to content

Commit 6c606fc

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
[release-branch.go1.20] cmd/go: fix TestScript/build_cwd_newline with CGO_ENABLED=0
Updates #60516. Updates #60167. Change-Id: I3792682e80a3c48d78a3b9e647cc968a1d5c8f2b Reviewed-on: https://go-review.googlesource.com/c/go/+/501575 Auto-Submit: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> (cherry picked from commit e2b1c0b) Reviewed-on: https://go-review.googlesource.com/c/go/+/501816 Auto-Submit: Dmitri Shuralyov <[email protected]>
1 parent 63ad2b5 commit 6c606fc

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

src/cmd/go/testdata/script/build_cwd_newline.txt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,28 @@ cd $DIR
1111
exec pwd
1212
cp $WORK/go.mod ./go.mod
1313
cp $WORK/main.go ./main.go
14+
cp $WORK/main_nocgo.go ./main_nocgo.go
1415
cp $WORK/main_test.go ./main_test.go
1516

1617
! go build -o $devnull .
1718
stderr 'package example: invalid package directory .*uh-oh'
1819

19-
! go build -o $devnull main.go
20+
[cgo] ! go build -o $devnull main.go
21+
[!cgo] ! go build -o $devnull main_nocgo.go
2022
stderr 'package command-line-arguments: invalid package directory .*uh-oh'
2123

2224
! go run .
2325
stderr 'package example: invalid package directory .*uh-oh'
2426

25-
! go run main.go
27+
[cgo] ! go run main.go
28+
[!cgo] ! go run main_nocgo.go
2629
stderr 'package command-line-arguments: invalid package directory .*uh-oh'
2730

2831
! go test .
2932
stderr 'package example: invalid package directory .*uh-oh'
3033

31-
! go test -v main.go main_test.go
34+
[cgo] ! go test -v main.go main_test.go
35+
[!cgo] ! go test -v main_nocgo.go main_test.go
3236
stderr 'package command-line-arguments: invalid package directory .*uh-oh'
3337

3438
go list -compiled -e -f '{{with .CompiledGoFiles}}{{.}}{{end}}' .
@@ -46,27 +50,31 @@ go list -compiled -e -f '{{with .CompiledGoFiles}}{{.}}{{end}}' .
4650

4751
symlink $WORK${/}link -> $DIR
4852

49-
go run $WORK${/}link${/}main.go
53+
[cgo] go run $WORK${/}link${/}main.go
54+
[!cgo] go run $WORK${/}link${/}main_nocgo.go
5055
! stdout panic
5156
! stderr panic
5257
stderr '^ok$'
5358

54-
go test -v $WORK${/}link${/}main.go $WORK${/}link${/}main_test.go
59+
[cgo] go test -v $WORK${/}link${/}main.go $WORK${/}link${/}main_test.go
60+
[!cgo] go test -v $WORK${/}link${/}main_nocgo.go $WORK${/}link${/}main_test.go
5561
! stdout panic
5662
! stderr panic
5763
stdout '^ok$' # 'go test' combines the test's stdout into stderr
5864

5965
cd $WORK/link
6066

61-
! go run $DIR${/}main.go
67+
[cgo] ! go run $DIR${/}main.go
68+
[!cgo] ! go run $DIR${/}main_nocgo.go
6269
stderr 'package command-line-arguments: invalid package directory .*uh-oh'
6370

6471
go run .
6572
! stdout panic
6673
! stderr panic
6774
stderr '^ok$'
6875

69-
go run main.go
76+
[cgo] go run main.go
77+
[!cgo] go run main_nocgo.go
7078
! stdout panic
7179
! stderr panic
7280
stderr '^ok$'
@@ -90,6 +98,15 @@ package main
9098

9199
import "C"
92100

101+
func main() {
102+
/* nothing here */
103+
println("ok")
104+
}
105+
-- $WORK/main_nocgo.go --
106+
//go:build !cgo
107+
108+
package main
109+
93110
func main() {
94111
/* nothing here */
95112
println("ok")

0 commit comments

Comments
 (0)