]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/dist: add -G=3 test coverage
authorMatthew Dempsky <mdempsky@google.com>
Wed, 20 Jan 2021 22:08:53 +0000 (14:08 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 20 Jan 2021 23:33:19 +0000 (23:33 +0000)
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>

src/cmd/dist/test.go

index 955ce2a063c83330efb7b8e2aef01c94f62d31b9..365a77a15680054ad247c2cf516b5b09b9d78b85 100644 (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 {