diff options
author | Heschi Kreinick <heschi@google.com> | 2023-03-29 13:13:19 -0400 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-06-21 20:26:26 +0000 |
commit | c7b145655b0e7feeff65bee202eda849fa3e3452 (patch) | |
tree | 73401a11953317918a4e9e980931fdc1370b5b92 | |
parent | 03063101a2b40e78a44bdc1da84900d41a49a3ec (diff) | |
download | go-c7b145655b0e7feeff65bee202eda849fa3e3452.tar.gz go-c7b145655b0e7feeff65bee202eda849fa3e3452.zip |
[release-branch.go1.20] cmd/go: fix tests for new builder environment
Fix two long tests that fail in the builders we're trying out:
- TestQueryImport was failing with:
open /nonexist-gopath/pkg/sumdb/sum.golang.org/latest: no such file or directory
which eventually turns out to be because it couldn't create
/nonexist-gopath because it wasn't running as root. The test already
uses a temporary GOPATH, but missed overriding a configuration
variable set at init time.
- test_flags fails if the working directory has /x/ in it, which it now
happens to.
Change-Id: Ideef0f318157b42987539e3a20f9fba6a3d3bdd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/480255
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 4526fa790eb45c7f581e2420ce47763575985dfc)
Reviewed-on: https://go-review.googlesource.com/c/go/+/504975
Auto-Submit: Heschi Kreinick <heschi@google.com>
-rw-r--r-- | src/cmd/go/internal/modload/query_test.go | 1 | ||||
-rw-r--r-- | src/cmd/go/testdata/script/test_flags.txt | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/modload/query_test.go b/src/cmd/go/internal/modload/query_test.go index fe9ae9f93f..93f8f0d00d 100644 --- a/src/cmd/go/internal/modload/query_test.go +++ b/src/cmd/go/internal/modload/query_test.go @@ -55,6 +55,7 @@ func testMain(m *testing.M) (err error) { os.Setenv("GOPATH", dir) cfg.BuildContext.GOPATH = dir cfg.GOMODCACHE = filepath.Join(dir, "pkg/mod") + cfg.SumdbDir = filepath.Join(dir, "pkg/sumdb") m.Run() return nil } diff --git a/src/cmd/go/testdata/script/test_flags.txt b/src/cmd/go/testdata/script/test_flags.txt index 63385e6997..3f7964b0a7 100644 --- a/src/cmd/go/testdata/script/test_flags.txt +++ b/src/cmd/go/testdata/script/test_flags.txt @@ -15,8 +15,7 @@ stdout '\Aok\s+example.com/x\s+[0-9.s]+\n\z' # Even though ./x looks like a package path, the real package should be # the implicit '.'. ! go test --answer=42 ./x -stderr '^no Go files in .+$' -! stderr '/x' +stderr '^no Go files in '$PWD'$' # However, *flags* that appear after unrecognized flags should still be # interpreted as flags, under the (possibly-erroneous) assumption that |