]> Cypherpunks repositories - gostls13.git/commit
cmd/go: test that each script test increments at least one counter
authorMichael Matloob <matloob@golang.org>
Thu, 29 Feb 2024 22:34:59 +0000 (17:34 -0500)
committerMichael Matloob <matloob@golang.org>
Thu, 7 Mar 2024 18:33:17 +0000 (18:33 +0000)
commitf93f6e501edaf8bf117109b8469af6af8586b393
tree1270c6f2167dd5c68138ba4a0376f2f0e382e4d8
parentda5871d58269c51a31d6ad687e7dbaf6d9b1c297
cmd/go: test that each script test increments at least one counter

Add code that will set a scriptGoInvoked bit for the testing.TB when
it invokes the go command. If the go command was invoked, make sure
that at least one counter was incremented.

Also add the counters cmd/go/gomodcache-entry-relative,
cmd/go/gopath-entry-relative, and cmd/go/invalid-toolchain-in-file so
we can increment counters when a test errors out before the flag
subcommand counters are processed. This enforces the invariant that at
least one counter is incremented by every test that invokes the go
command.

Add the counter cmd/go/exec-go-toolchain for when a toolchain switch
happens.

Add cmd/go/subcommand:help for invoking help without arguments and
cmd/go/help-unknown-topic for when an unknown command is provided
to help.

Change-Id: Id90f2bbe4c7e89b846da00ec1ed9595ece2b269c
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/568259
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/go/counters_test.go
src/cmd/go/internal/base/base.go
src/cmd/go/internal/help/help.go
src/cmd/go/internal/modfetch/cache.go
src/cmd/go/internal/toolchain/select.go
src/cmd/go/internal/toolchain/switch.go
src/cmd/go/main.go
src/cmd/go/script_test.go
src/cmd/go/scriptcmds_test.go
src/cmd/go/testdata/counters.txt