From 7cc4516ac8305acf3689a2b755932512a1bf6efd Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Tue, 9 May 2023 09:50:19 -0400 Subject: [PATCH] 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 Reviewed-by: Bryan Mills Auto-Submit: Dmitri Shuralyov TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov --- src/cmd/dist/test.go | 4 ++-- src/{ => cmd}/internal/testdir/testdir_test.go | 0 test/README.md | 4 ++-- test/codegen/README | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename src/{ => cmd}/internal/testdir/testdir_test.go (100%) diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 48403bd434..8cd8abc19e 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -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, }, diff --git a/src/internal/testdir/testdir_test.go b/src/cmd/internal/testdir/testdir_test.go similarity index 100% rename from src/internal/testdir/testdir_test.go rename to src/cmd/internal/testdir/testdir_test.go diff --git a/test/README.md b/test/README.md index 7e3948f947..1d37f2d5ca 100644 --- a/test/README.md +++ b/test/README.md @@ -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. diff --git a/test/codegen/README b/test/codegen/README index 1d68780394..5a4684284b 100644 --- a/test/codegen/README +++ b/test/codegen/README @@ -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.