]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/dist/test.go
[dev.typeparams] merge master (2f0da6d) into dev.typeparams
[gostls13.git] / src / cmd / dist / test.go
index 4f081c9f888987ca37e32ac1af5d46ef28533bf3..a22397aa16b298f9a0934fb82aeb235e573025b6 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:"))
@@ -431,8 +444,15 @@ func (t *tester) registerTests() {
                        fatalf("Error running go list std cmd: %v:\n%s", err, cmd.Stderr)
                }
                pkgs := strings.Fields(string(all))
+               if false {
+                       // Disable -G=3 option for standard tests for now, since
+                       // they are flaky on the builder.
+                       for _, pkg := range pkgs {
+                               t.registerStdTest(pkg, true /* -G=3 flag */)
+                       }
+               }
                for _, pkg := range pkgs {
-                       t.registerStdTest(pkg)
+                       t.registerStdTest(pkg, false)
                }
                if t.race {
                        for _, pkg := range pkgs {