From: Bryan C. Mills Date: Thu, 1 Feb 2024 15:24:25 +0000 (-0500) Subject: cmd/go: avoid copying a binary to be exec'd in TestScript/gotoolchain_path X-Git-Tag: go1.23rc1~1295 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=39ec246e739a787375b00acd92c10311863575a2;p=gostls13.git cmd/go: avoid copying a binary to be exec'd in TestScript/gotoolchain_path Runinng 'go build' writes the binary in a separate process, so avoids the race described in #22315. However, the script engine's 'cp' command currently executes in-process, so it does not avoid that bug and may retain stale file descriptors when running tests in parallel. Avoid the race in this particular test by giving the final binary location in the '-o' argument instead of copying it there after the fact. Fixes #64019. Change-Id: I96d276f33c09e39f465e9877356f1d8f2ae55062 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/560415 Auto-Submit: Bryan Mills LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob --- diff --git a/src/cmd/go/testdata/script/gotoolchain_path.txt b/src/cmd/go/testdata/script/gotoolchain_path.txt index 9628348f7a..b7a1c9bd89 100644 --- a/src/cmd/go/testdata/script/gotoolchain_path.txt +++ b/src/cmd/go/testdata/script/gotoolchain_path.txt @@ -8,8 +8,7 @@ env TESTGO_VERSION=go1.21pre3 # Compile a fake toolchain to put in the path under various names. env GOTOOLCHAIN= mkdir $WORK/bin -go build -o $WORK/bin/ ./fakego.go # adds .exe extension implicitly on Windows -cp $WORK/bin/fakego$GOEXE $WORK/bin/go1.50.0$GOEXE +go build -o $WORK/bin/go1.50.0$GOEXE ./fakego.go # adds .exe extension implicitly on Windows [!GOOS:plan9] env PATH=$WORK/bin [GOOS:plan9] env path=$WORK/bin