From: Michael Matloob Date: Tue, 25 Oct 2022 21:51:12 +0000 (-0700) Subject: cmd/go: add move test for goroot X-Git-Tag: go1.20rc1~485 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5619dd08493c08f06b47cec9f9553bbda6d2cbbd;p=gostls13.git cmd/go: add move test for goroot This an end-to-end test that sets GOROOT to a symlink to the distribution, approximating copying it to a new location, and checks that packages in the standard library are not stale, as they would be if paths were embedded in artifacts. For #47257 Change-Id: I4ed04df36656ad946a2f6f5ce3194e76e06372e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/445358 TryBot-Result: Gopher Robot Reviewed-by: Michael Matloob Run-TryBot: Michael Matloob Reviewed-by: Bryan Mills --- diff --git a/src/cmd/go/testdata/script/install_move_not_stale.txt b/src/cmd/go/testdata/script/install_move_not_stale.txt new file mode 100644 index 0000000000..de191cff2b --- /dev/null +++ b/src/cmd/go/testdata/script/install_move_not_stale.txt @@ -0,0 +1,26 @@ +# Check to see that the distribution is not stale +# even when it's been moved to a different directory. +# Simulate that by creating a symlink to the tree. + +# We use net instead of std because stale std has +# the behavior of checking that all std targets +# are stale rather than any of them. + +[!symlink] skip +[short] skip + +go build net +! stale net + +symlink new -> $GOROOT +env OLDGOROOT=$GOROOT +env GOROOT=$WORK${/}gopath${/}src${/}new +go env GOROOT +stdout $WORK[\\/]gopath[\\/]src[\\/]new +cd new +! stale net + +# Add a control case to check that std is +# stale with an empty cache +env GOCACHE=$WORK${/}gopath${/}cache +stale net