// 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,
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,
},
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.
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.