From 0f054c5be06d87d199e5691773af640936ecb588 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 20 Jan 2021 14:08:53 -0800 Subject: [PATCH] [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 TryBot-Result: Go Bot Reviewed-by: Dan Scales Reviewed-by: Robert Griesemer Trust: Robert Griesemer Trust: Matthew Dempsky --- src/cmd/dist/test.go | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 955ce2a063..365a77a156 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -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 { -- 2.48.1