From 02ab3d42c6b32e3b39927ae174cfaaead8a5ad10 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Wed, 23 Nov 2022 09:32:27 -0500 Subject: [PATCH] dashboard: default to new compilers for windows amd64/386 builders Revamp the setup for windows-amd64 and windows-386 builders so that we default to using newer C compilers for Go 1.20 and main branch, but older compilers for release branches (1.19 and prior). Instead of having a series of "newcc" canary builders for windows, we now have a series of "oldcc" builders for release branch use. Note for posterity: we can prune these changes out in a couple of Go release (once Go 1.20 becomes the oldest release we're testing). Updates golang/go#35006. Change-Id: I329b59a5d67c2c1ae65a30564a1c6a081b2523fa Reviewed-on: https://go-review.googlesource.com/c/build/+/453095 Reviewed-by: Heschi Kreinick Run-TryBot: Than McIntosh Reviewed-by: Carlos Amedee TryBot-Result: Gopher Robot --- dashboard/builders.go | 285 ++++++++++++++++++++++++++++--------- dashboard/builders_test.go | 94 ++++++++++-- 2 files changed, 303 insertions(+), 76 deletions(-) diff --git a/dashboard/builders.go b/dashboard/builders.go index 1b10632871..7b42843055 100644 --- a/dashboard/builders.go +++ b/dashboard/builders.go @@ -564,37 +564,37 @@ var Hosts = map[string]*HostConfig{ ExpectNum: 1, }, "host-windows-amd64-2008": { - VMImage: "windows-amd64-server-2008r2-v7", + VMImage: "windows-amd64-server-2008r2-v8", SSHUsername: "gopher", }, - "host-windows-amd64-2008-newcc": { - VMImage: "windows-amd64-server-2008r2-v8", + "host-windows-amd64-2008-oldcc": { + VMImage: "windows-amd64-server-2008r2-v7", SSHUsername: "gopher", }, "host-windows-amd64-2012": { - VMImage: "windows-amd64-server-2012r2-v7", + VMImage: "windows-amd64-server-2012r2-v8", SSHUsername: "gopher", }, - "host-windows-amd64-2012-newcc": { - VMImage: "windows-amd64-server-2012r2-v8", + "host-windows-amd64-2012-oldcc": { + VMImage: "windows-amd64-server-2012r2-v7", SSHUsername: "gopher", }, "host-windows-amd64-2016": { - VMImage: "windows-amd64-server-2016-v7", + VMImage: "windows-amd64-server-2016-v8", SSHUsername: "gopher", }, "host-windows-amd64-2016-big": { - VMImage: "windows-amd64-server-2016-v7", + VMImage: "windows-amd64-server-2016-v8", machineType: "e2-standard-16", SSHUsername: "gopher", }, - "host-windows-amd64-2016-big-newcc": { - VMImage: "windows-amd64-server-2016-v8", + "host-windows-amd64-2016-big-oldcc": { + VMImage: "windows-amd64-server-2016-v7", machineType: "e2-standard-16", SSHUsername: "gopher", }, - "host-windows-amd64-2016-newcc": { - VMImage: "windows-amd64-server-2016-v8", + "host-windows-amd64-2016-oldcc": { + VMImage: "windows-amd64-server-2016-v7", SSHUsername: "gopher", }, "host-windows-arm64-mini": { // host name known to cmd/buildlet/stage0, cannot change @@ -1234,7 +1234,7 @@ func (c *BuildConfig) buildsRepoAtAll(repo, branch, goBranch string) bool { // Build dev.boringcrypto branches only on linux/amd64 and windows/386 (see go.dev/issue/26791). if repo == "go" && (branch == "dev.boringcrypto" || strings.HasPrefix(branch, "dev.boringcrypto.")) { - if c.Name != "linux-amd64" && c.Name != "windows-386-2008" { + if c.Name != "linux-amd64" && !strings.HasPrefix(c.Name, "windows-386") { return false } } @@ -2154,7 +2154,15 @@ func init() { Name: "windows-amd64-2008", HostType: "host-windows-amd64-2008", distTestAdjust: noTestDirAndNoReboot, - buildsRepo: onlyGo, + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has modern/recent C compilers installed, + // meaning that we only want to use it with 1.20+ versions + // of Go, hence the atLeastGo1 call below; versions of Go + // prior to 1.20 will use the *-oldcc variant instead. See + // issue 35006 for more details. + return onlyGo(repo, branch, goBranch) && + atLeastGo1(goBranch, 20) + }, env: []string{ "GOARCH=amd64", "GOHOSTARCH=amd64", @@ -2166,10 +2174,18 @@ func init() { }, }) addBuilder(BuildConfig{ - Name: "windows-amd64-2008-newcc", - HostType: "host-windows-amd64-2008-newcc", + Name: "windows-amd64-2008-oldcc", + HostType: "host-windows-amd64-2008-oldcc", distTestAdjust: noTestDirAndNoReboot, - buildsRepo: onlyGo, + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has legacy C compilers installed, suitable + // for versions of Go prior to 1.20, hence the atMostGo1 + // call below. Newer (1.20 and later) will use the + // non-oldcc variant instead. See issue 35006 for more + // details. + return onlyGo(repo, branch, goBranch) && + atMostGo1(goBranch, 19) + }, env: []string{ "GOARCH=amd64", "GOHOSTARCH=amd64", @@ -2179,45 +2195,107 @@ func init() { // up: "GO_TEST_TIMEOUT_SCALE=2", }, - KnownIssues: []int{35006}, }) addBuilder(BuildConfig{ - Name: "windows-386-2008", - HostType: "host-windows-amd64-2008", - buildsRepo: defaultPlusExpBuild, - distTestAdjust: fasterTrybots, - env: []string{"GOARCH=386", "GOHOSTARCH=386"}, - tryBot: defaultTrySet(), + Name: "windows-386-2008", + HostType: "host-windows-amd64-2008", + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has modern/recent C compilers installed, + // meaning that we only want to use it with 1.20+ versions + // of Go, hence the atLeastGo1 call below; versions of Go + // prior to 1.20 will use the *-oldcc variant instead. See + // issue 35006 for more details. + return defaultPlusExpBuild(repo, branch, goBranch) && + atLeastGo1(goBranch, 20) + }, + env: []string{"GOARCH=386", "GOHOSTARCH=386"}, + tryBot: func(repo, branch, goBranch string) bool { + // See comment above about the atLeastGo1 call below. + dft := defaultTrySet() + return dft(repo, branch, goBranch) && + atLeastGo1(goBranch, 20) + }, numTryTestHelpers: 4, }) addBuilder(BuildConfig{ - Name: "windows-386-2008-newcc", - HostType: "host-windows-amd64-2008-newcc", - buildsRepo: defaultPlusExpBuild, - env: []string{"GOARCH=386", "GOHOSTARCH=386"}, - KnownIssues: []int{35006}, + Name: "windows-386-2008-oldcc", + HostType: "host-windows-amd64-2008-oldcc", + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has legacy C compilers installed, suitable + // for versions of Go prior to 1.20, hence the atMostGo1 + // call below. Newer (1.20 and later) will use the + // non-oldcc variant instead. See issue 35006 for more + // details. + return defaultPlusExpBuild(repo, branch, goBranch) && + atMostGo1(goBranch, 19) + }, + distTestAdjust: fasterTrybots, + env: []string{"GOARCH=386", "GOHOSTARCH=386"}, + tryBot: func(repo, branch, goBranch string) bool { + // See comment above about the atMostGo1 call below. + dft := defaultTrySet() + return dft(repo, branch, goBranch) && + atMostGo1(goBranch, 19) + }, + numTryTestHelpers: 4, }) addBuilder(BuildConfig{ - Name: "windows-386-2012", - HostType: "host-windows-amd64-2012", - distTestAdjust: fasterTrybots, - buildsRepo: onlyGo, - env: []string{"GOARCH=386", "GOHOSTARCH=386"}, - tryBot: defaultTrySet(), + Name: "windows-386-2012", + HostType: "host-windows-amd64-2012", + distTestAdjust: fasterTrybots, + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has modern/recent C compilers installed, + // meaning that we only want to use it with 1.20+ versions + // of Go, hence the atLeastGo1 call below; versions of Go + // prior to 1.20 will use the *-oldcc variant instead. See + // issue 35006 for more details. + return onlyGo(repo, branch, goBranch) && + atLeastGo1(goBranch, 20) + }, + env: []string{"GOARCH=386", "GOHOSTARCH=386"}, + tryBot: func(repo, branch, goBranch string) bool { + // See comment above about the atLeastGo1 call below. + dft := defaultTrySet() + return dft(repo, branch, goBranch) && + atLeastGo1(goBranch, 20) + }, numTryTestHelpers: 4, }) addBuilder(BuildConfig{ - Name: "windows-386-2012-newcc", - HostType: "host-windows-amd64-2012-newcc", - buildsRepo: onlyGo, - env: []string{"GOARCH=386", "GOHOSTARCH=386"}, - KnownIssues: []int{35006}, + Name: "windows-386-2012-oldcc", + HostType: "host-windows-amd64-2012-oldcc", + distTestAdjust: fasterTrybots, + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has legacy C compilers installed, suitable + // for versions of Go prior to 1.20, hence the atMostGo1 + // call below. Newer (1.20 and later) will use the + // non-oldcc variant instead. See issue 35006 for more + // details. + return onlyGo(repo, branch, goBranch) && + atMostGo1(goBranch, 19) + }, + env: []string{"GOARCH=386", "GOHOSTARCH=386"}, + tryBot: func(repo, branch, goBranch string) bool { + // See comment above about the atMostGo1 call below. + dft := defaultTrySet() + return dft(repo, branch, goBranch) && + atMostGo1(goBranch, 19) + }, + numTryTestHelpers: 4, }) addBuilder(BuildConfig{ - Name: "windows-amd64-2012", - HostType: "host-windows-amd64-2012", + Name: "windows-amd64-2012-oldcc", + HostType: "host-windows-amd64-2012-oldcc", distTestAdjust: noTestDirAndNoReboot, - buildsRepo: onlyGo, + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has legacy C compilers installed, suitable + // for versions of Go prior to 1.20, hence the atMostGo1 + // call below. Newer (1.20 and later) will use the + // non-oldcc variant instead. See issue 35006 for more + // details. + return onlyGo(repo, branch, goBranch) && + atMostGo1(goBranch, 19) + }, env: []string{ "GOARCH=amd64", "GOHOSTARCH=amd64", @@ -2229,10 +2307,18 @@ func init() { }, }) addBuilder(BuildConfig{ - Name: "windows-amd64-2012-newcc", - HostType: "host-windows-amd64-2012-newcc", + Name: "windows-amd64-2012", + HostType: "host-windows-amd64-2012", distTestAdjust: noTestDirAndNoReboot, - buildsRepo: onlyGo, + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has modern/recent C compilers installed, + // meaning that we only want to use it with 1.20+ versions + // of Go, hence the atLeastGo1 call below; versions of Go + // prior to 1.20 will use the *-oldcc variant instead. See + // issue 35006 for more details. + return onlyGo(repo, branch, goBranch) && + atLeastGo1(goBranch, 20) + }, env: []string{ "GOARCH=amd64", "GOHOSTARCH=amd64", @@ -2242,12 +2328,19 @@ func init() { // up: "GO_TEST_TIMEOUT_SCALE=2", }, - KnownIssues: []int{35006}, }) addBuilder(BuildConfig{ - Name: "windows-amd64-2016", - HostType: "host-windows-amd64-2016", - buildsRepo: defaultPlusExpBuild, + Name: "windows-amd64-2016", + HostType: "host-windows-amd64-2016", + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has modern/recent C compilers installed, + // meaning that we only want to use it with 1.20+ versions + // of Go, hence the atLeastGo1 call below; versions of Go + // prior to 1.20 will use the *-oldcc variant instead. See + // issue 35006 for more details. + return defaultPlusExpBuild(repo, branch, goBranch) && + atLeastGo1(goBranch, 20) + }, distTestAdjust: fasterTrybots, env: []string{ "GOARCH=amd64", @@ -2258,13 +2351,27 @@ func init() { // up: "GO_TEST_TIMEOUT_SCALE=2", }, - tryBot: defaultTrySet(), + tryBot: func(repo, branch, goBranch string) bool { + // See comment above about the atLeastGo1 call below. + dft := defaultTrySet() + return dft(repo, branch, goBranch) && + atLeastGo1(goBranch, 20) + }, numTryTestHelpers: 5, }) addBuilder(BuildConfig{ - Name: "windows-amd64-2016-newcc", - HostType: "host-windows-amd64-2016-newcc", - buildsRepo: defaultPlusExpBuild, + Name: "windows-amd64-2016-oldcc", + HostType: "host-windows-amd64-2016-oldcc", + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has legacy C compilers installed, suitable + // for versions of Go prior to 1.20, hence the atMostGo1 + // call below. Newer (1.20 and later) will use the + // non-oldcc variant instead. See issue 35006 for more + // details. + return defaultPlusExpBuild(repo, branch, goBranch) && + atMostGo1(goBranch, 19) + }, + distTestAdjust: fasterTrybots, env: []string{ "GOARCH=amd64", "GOHOSTARCH=amd64", @@ -2274,18 +2381,32 @@ func init() { // up: "GO_TEST_TIMEOUT_SCALE=2", }, - KnownIssues: []int{35006}, + tryBot: func(repo, branch, goBranch string) bool { + // See comment above about the atMostGo1 call below. + dft := defaultTrySet() + return dft(repo, branch, goBranch) && + atMostGo1(goBranch, 19) + }, + numTryTestHelpers: 5, }) addBuilder(BuildConfig{ - Name: "windows-amd64-longtest", - HostType: "host-windows-amd64-2016-big", + Name: "windows-amd64-longtest-oldcc", + HostType: "host-windows-amd64-2016-big-oldcc", Notes: "Windows Server 2016 with go test -short=false", tryBot: func(repo, branch, goBranch string) bool { onReleaseBranch := strings.HasPrefix(branch, "release-branch.") - return repo == "go" && onReleaseBranch // See issue 37827. + // This builder has legacy C compilers installed, suitable + // for versions of Go prior to 1.20, hence the atMostGo1 + // call below. Newer (1.20 and later) will use the + // non-oldcc variant instead. See issue 35006 for more + // details. + return atMostGo1(goBranch, 19) && + repo == "go" && onReleaseBranch // See issue 37827. }, buildsRepo: func(repo, branch, goBranch string) bool { - b := defaultPlusExpBuild(repo, branch, goBranch) + // See comment above about the atMostGo1 call below. + b := defaultPlusExpBuild(repo, branch, goBranch) && + atMostGo1(goBranch, 19) if repo != "go" && !(branch == "master" && goBranch == "master") { // For golang.org/x repos, don't test non-latest versions. b = false @@ -2299,11 +2420,23 @@ func init() { numTryTestHelpers: 4, // Target time is < 15 min for go.dev/issue/42661. }) addBuilder(BuildConfig{ - Name: "windows-amd64-longtest-newcc", - HostType: "host-windows-amd64-2016-big-newcc", + Name: "windows-amd64-longtest", + HostType: "host-windows-amd64-2016-big", Notes: "Windows Server 2016 with go test -short=false", + tryBot: func(repo, branch, goBranch string) bool { + onReleaseBranch := strings.HasPrefix(branch, "release-branch.") + // This builder has modern/recent C compilers installed, + // meaning that we only want to use it with 1.20+ versions + // of Go, hence the atLeastGo1 call below; versions of Go + // prior to 1.20 will use the *-oldcc variant instead. See + // issue 35006 for more details. + return atLeastGo1(goBranch, 20) && + repo == "go" && onReleaseBranch // See issue 37827. + }, buildsRepo: func(repo, branch, goBranch string) bool { - b := defaultPlusExpBuild(repo, branch, goBranch) + // See comment above about the atMostGo1 call below. + b := atLeastGo1(goBranch, 20) && + defaultPlusExpBuild(repo, branch, goBranch) if repo != "go" && !(branch == "master" && goBranch == "master") { // For golang.org/x repos, don't test non-latest versions. b = false @@ -2314,13 +2447,21 @@ func init() { env: []string{ "GO_TEST_TIMEOUT_SCALE=5", // give them lots of time }, - KnownIssues: []int{35006}, numTryTestHelpers: 4, // Target time is < 15 min for go.dev/issue/42661. }) addBuilder(BuildConfig{ - Name: "windows-amd64-race", - HostType: "host-windows-amd64-2016", + Name: "windows-amd64-oldcc-race", + HostType: "host-windows-amd64-2016-oldcc", Notes: "Only runs -race tests (./race.bat)", + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has legacy C compilers installed, suitable + // for versions of Go prior to 1.20, hence the atMostGo1 + // call below. Newer (1.20 and later) will use the + // non-oldcc variant instead. See issue 35006 for more + // details. + return atMostGo1(goBranch, 19) && + buildRepoByDefault(repo) + }, env: []string{ "GOARCH=amd64", "GOHOSTARCH=amd64", @@ -2331,9 +2472,18 @@ func init() { "GO_TEST_TIMEOUT_SCALE=2"}, }) addBuilder(BuildConfig{ - Name: "windows-amd64-newcc-race", - HostType: "host-windows-amd64-2016-newcc", + Name: "windows-amd64-race", + HostType: "host-windows-amd64-2016", Notes: "Only runs -race tests (./race.bat)", + buildsRepo: func(repo, branch, goBranch string) bool { + // This builder has modern/recent C compilers installed, + // meaning that we only want to use it with 1.20+ versions + // of Go, hence the atLeastGo1 call below; versions of Go + // prior to 1.20 will use the *-oldcc variant instead. See + // issue 35006 for more details. + return atLeastGo1(goBranch, 20) && + buildRepoByDefault(repo) + }, env: []string{ "GOARCH=amd64", "GOHOSTARCH=amd64", @@ -2342,7 +2492,6 @@ func init() { // dist test timeout. So, bump this builder // up: "GO_TEST_TIMEOUT_SCALE=2"}, - KnownIssues: []int{35006}, }) addBuilder(BuildConfig{ Name: "windows-arm-zx2c4", diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go index 2aa870ed48..a43226b42d 100644 --- a/dashboard/builders_test.go +++ b/dashboard/builders_test.go @@ -137,9 +137,9 @@ func TestTrybots(t *testing.T) { "linux-arm-aws", "linux-arm64", "openbsd-amd64-70", - "windows-386-2008", - "windows-386-2012", - "windows-amd64-2016", + "windows-386-2008-oldcc", + "windows-386-2012-oldcc", + "windows-amd64-2016-oldcc", "misc-compile-darwin", "misc-compile-freebsd", @@ -160,7 +160,7 @@ func TestTrybots(t *testing.T) { "linux-386-longtest", "linux-amd64-longtest", //"linux-arm64-longtest", - "windows-amd64-longtest", + "windows-amd64-longtest-oldcc", }, }, { @@ -175,9 +175,9 @@ func TestTrybots(t *testing.T) { "linux-arm-aws", "linux-arm64", "openbsd-amd64-70", - "windows-386-2008", - "windows-386-2012", - "windows-amd64-2016", + "windows-386-2008-oldcc", + "windows-386-2012-oldcc", + "windows-amd64-2016-oldcc", "misc-compile-darwin", "misc-compile-freebsd", @@ -198,7 +198,7 @@ func TestTrybots(t *testing.T) { "linux-386-longtest", "linux-amd64-longtest", //"linux-arm64-longtest", - "windows-amd64-longtest", + "windows-amd64-longtest-oldcc", }, }, { @@ -1159,3 +1159,81 @@ func TestHostConfigCosArchitecture(t *testing.T) { }) } } + +func TestWindowsCCSetup(t *testing.T) { + // For 1.18 + 1.19 we want to see the "-oldcc" variants, + // where for 1.20 and main branch we want the non-oldcc variants, + // both for trybots and post-submit testing. + tests := []struct { + repo string // "go", "net", etc + branch string // of repo + want string + }{ + { + repo: "go", + branch: "master", + want: "newcc", + }, + { + repo: "tools", + branch: "master", + want: "newcc", + }, + { + repo: "go", + branch: "go1.20", + want: "newcc", + }, + { + repo: "go", + branch: "go1.19", + want: "oldcc", + }, + { + repo: "build", + branch: "go1.19", + want: "oldcc", + }, + } + + checkWindowsBuilders := func(got []*BuildConfig, want string, repo, branch string) { + t.Helper() + for _, b := range got { + bname := b.Name + if !strings.HasPrefix(bname, "windows-amd64") && + !strings.HasPrefix(bname, "windows-386") { + continue + } + hasOldCC := strings.Contains(bname, "oldcc") + if want == "newcc" && hasOldCC { + t.Errorf("got unexpected oldcc builder %q repo %s branch %s", + bname, repo, branch) + } else if want == "oldcc" && !hasOldCC { + t.Errorf("got unexpected newcc builder %q repo %s branch %s", + bname, repo, branch) + } + } + } + + for i, tt := range tests { + if tt.branch == "" || tt.repo == "" { + t.Errorf("incomplete test entry %d", i) + return + } + if tt.want != "newcc" && tt.want != "oldcc" { + t.Errorf("incorrect 'want' field in test entry %d", i) + return + } + t.Run(fmt.Sprintf("%s/%s", tt.repo, tt.branch), func(t *testing.T) { + goBranch := tt.branch // hard-code the common case for now + got := TryBuildersForProject(tt.repo, tt.branch, goBranch) + checkWindowsBuilders(got, tt.want, tt.repo, tt.branch) + }) + t.Run(fmt.Sprintf("%s/%s", tt.repo, tt.branch), func(t *testing.T) { + goBranch := tt.branch // hard-code the common case for now + got := buildersForProject(tt.repo, tt.branch, goBranch, (*BuildConfig).BuildsRepoPostSubmit) + checkWindowsBuilders(got, tt.want, tt.repo, tt.branch) + }) + + } +}