[dev.typeparams] cmd/dist: add -G=3 test coverage

Change-Id: Icb85b93f0d98df722fffd70cf9a2554ac2098c60
Reviewed-on: https://go-review.googlesource.com/c/go/+/285052
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Matthew Dempsky 2021-01-20 14:08:53 -08:00
parent 89ec17be9a
commit 0f054c5be0

28
src/cmd/dist/test.go vendored
View file

@ -309,14 +309,24 @@ var (
benchMatches []string
)
func (t *tester) registerStdTest(pkg string) {
testName := "go_test:" + pkg
func (t *tester) registerStdTest(pkg string, useG3 bool) {
heading := "Testing packages."
testPrefix := "go_test:"
gcflags := gogcflags
if useG3 {
heading = "Testing packages with -G=3."
testPrefix = "go_test_g3:"
gcflags += " -G=3"
}
testName := testPrefix + pkg
if t.runRx == nil || t.runRx.MatchString(testName) == t.runRxWant {
stdMatches = append(stdMatches, pkg)
}
t.tests = append(t.tests, distTest{
name: testName,
heading: "Testing packages.",
heading: heading,
fn: func(dt *distTest) error {
if ranGoTest {
return nil
@ -343,7 +353,7 @@ func (t *tester) registerStdTest(pkg string) {
"-short=" + short(),
t.tags(),
t.timeout(timeoutSec),
"-gcflags=all=" + gogcflags,
"-gcflags=all=" + gcflags,
}
if t.race {
args = append(args, "-race")
@ -408,7 +418,10 @@ func (t *tester) registerTests() {
if len(t.runNames) > 0 {
for _, name := range t.runNames {
if strings.HasPrefix(name, "go_test:") {
t.registerStdTest(strings.TrimPrefix(name, "go_test:"))
t.registerStdTest(strings.TrimPrefix(name, "go_test:"), false)
}
if strings.HasPrefix(name, "go_test_g3:") {
t.registerStdTest(strings.TrimPrefix(name, "go_test_g3:"), true)
}
if strings.HasPrefix(name, "go_test_bench:") {
t.registerRaceBenchTest(strings.TrimPrefix(name, "go_test_bench:"))
@ -432,7 +445,10 @@ func (t *tester) registerTests() {
}
pkgs := strings.Fields(string(all))
for _, pkg := range pkgs {
t.registerStdTest(pkg)
t.registerStdTest(pkg, true)
}
for _, pkg := range pkgs {
t.registerStdTest(pkg, false)
}
if t.race {
for _, pkg := range pkgs {