1
0
mirror of https://github.com/golang/go synced 2024-07-01 07:56:09 +00:00

internal/testdir: move to cmd/internal/testdir

The effect and motivation is for the test to be selected when doing
'go test cmd' and not when doing 'go test std' since it's primarily
about testing the Go compiler and linker. Other than that, it's run
by all.bash and 'go test std cmd' as before.

For #56844.
Fixes #60059.

Change-Id: I2d499af013f9d9b8761fdf4573f8d27d80c1fccf
Reviewed-on: https://go-review.googlesource.com/c/go/+/493876
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Dmitri Shuralyov 2023-05-09 09:50:19 -04:00 committed by Gopher Robot
parent cecf8b9328
commit 7cc4516ac8
4 changed files with 5 additions and 5 deletions

View File

@ -530,7 +530,7 @@ func (t *tester) registerTests() {
// registerStdTestSpecially tracks import paths in the standard library
// whose test registration happens in a special way.
registerStdTestSpecially := map[string]bool{
"internal/testdir": true, // Registered at the bottom with sharding.
"cmd/internal/testdir": true, // Registered at the bottom with sharding.
// cgo tests are registered specially because they involve unusual build
// conditions and flags.
"cmd/cgo/internal/teststdio": true,
@ -858,7 +858,7 @@ func (t *tester) registerTests() {
fmt.Sprintf("test:%d_%d", shard, nShards),
"../test",
&goTest{
pkg: "internal/testdir",
pkg: "cmd/internal/testdir",
testFlags: []string{fmt.Sprintf("-shard=%d", shard), fmt.Sprintf("-shards=%d", nShards)},
runOnHost: true,
},

View File

@ -4,11 +4,11 @@ They are run as part of all.bash.
To run just these tests, execute:
../bin/go test internal/testdir
../bin/go test cmd/internal/testdir
To run just tests from specified files in this directory, execute:
../bin/go test internal/testdir -run='Test/(file1.go|file2.go|...)'
../bin/go test cmd/internal/testdir -run='Test/(file1.go|file2.go|...)'
Standard library tests should be written as regular Go tests in the appropriate package.

View File

@ -21,7 +21,7 @@ GOARCH are enabled by default, and only on GOOS=linux.
To perform comprehensive tests for all the supported architectures
(even on a non-Linux system), one can run the following command:
$ ../../bin/go test internal/testdir -run='Test/codegen' -all_codegen -v
$ ../../bin/go test cmd/internal/testdir -run='Test/codegen' -all_codegen -v
This is recommended after any change that affect the compiler's code.