Skip to content

Commit 646d48d

Browse files
committed
dashboard: include at most 3 ports per misc-compile TryBot
Between Go 1.15, 1.16 and tip, the following 29 ports don't have a real TryBot and instead rely on misc-compile TryBots for their pre-submit coverage: • aix/ppc64 • darwin/amd64 • darwin/arm64 • dragonfly/amd64 • freebsd/386 • freebsd/arm • freebsd/arm64 • illumos/amd64 • linux/mips • linux/mips64 • linux/mipsle • linux/mips64le • linux/ppc64 • linux/ppc64le • linux/riscv64 • linux/s390x • netbsd/386 • netbsd/amd64 • netbsd/arm • netbsd/arm64 • openbsd/386 • openbsd/arm • openbsd/arm64 • openbsd/mips64 • plan9/386 • plan9/amd64 • plan9/arm • solaris/amd64 • windows/arm The previous approach for misc-compile target selection was to break them up primarily by GOOS value. However, as new architectures were added over time, some misc-compile TryBots got to a point where they were testing upwards of 5 ports (for example, misc-compile-openbsd was testing 386, amd64, arm, arm64, and mips64 architectures). Since each port is tested sequentially, allocating too many to one misc-compile TryBot can cause it to become the bottleneck of an entire TryBot run, exceeding the 10 minute completion time goal. Arrange it so misc-compile TryBot target selection is done explicitly in x/build, and pick 3 as max number of targets per TryBot for now. Based on recent timing observations, that should strike a decent balance between resource use (spinning up a builder) vs chance of a misc-compile TryBot becoming a bottleneck. It will also give us an opportunity to compare timing of 1, 2 and 3 targets per misc-compile in the future. (When we start tracking timing for TryBot completion time holistically, we'll be in a better position to refine this strategy further.) Making misc-compile target selection explicit in x/build also enables removing unnecessary duplicate misc-compile coverage from ports that already have a real TryBot (for example, openbsd/amd64 was previously tested via both the openbsd-amd64-68 TryBot and misc-compile-openbsd). This shouldn't be needed, so it's no longer done. For golang/go#17104. Fixes golang/go#32632. Change-Id: Iac918377b91af3e48780b38ffdf3153e213eeba2 Reviewed-on: https://go-review.googlesource.com/c/build/+/313210 Trust: Dmitri Shuralyov <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
1 parent 2e5c6aa commit 646d48d

File tree

2 files changed

+111
-53
lines changed

2 files changed

+111
-53
lines changed

dashboard/builders.go

+39-23
Original file line numberDiff line numberDiff line change
@@ -1601,13 +1601,17 @@ func init() {
16011601
})
16021602
}
16031603

1604-
// addMiscCompileGo1 adds a misc-compile TryBot that runs
1605-
// buildall.bash on a subset of platforms matching the egrep
1606-
// pattern rx. The pattern is matched against the "go tool
1607-
// dist list" name, but with hyphens instead of forward
1608-
// slashes ("linux-amd64", etc).
1604+
// addMiscCompileGo1 adds a misc-compile TryBot that
1605+
// runs buildall.bash on the specified target(s), up to 3 max.
1606+
// The targets are matched against the "go tool dist list" name,
1607+
// but with hyphens instead of forward slashes ("linux-amd64", etc).
16091608
// If min is non-zero, it specifies the minimum Go 1.x version.
1610-
addMiscCompileGo1 := func(min int, suffix, rx string) {
1609+
addMiscCompileGo1 := func(min int, suffix string, targets ...string) {
1610+
if len(targets) > 3 {
1611+
// This limit will do until we have better visibility
1612+
// into holistic TryBot completion times via metrics.
1613+
panic("at most 3 targets may be specified to avoid making TryBots slow; see issues 32632 and 17104")
1614+
}
16111615
var v types.MajorMinor
16121616
var alsoNote string
16131617
if min != 0 {
@@ -1624,30 +1628,42 @@ func init() {
16241628
tryOnly: true,
16251629
MinimumGoVersion: v,
16261630
CompileOnly: true,
1627-
Notes: "Runs buildall.bash to cross-compile & vet std+cmd packages for " + rx + ", but doesn't run any tests." + alsoNote,
1631+
Notes: "Runs buildall.bash to cross-compile & vet std+cmd packages for " + strings.Join(targets, " & ") + ", but doesn't run any tests." + alsoNote,
16281632
allScriptArgs: []string{
16291633
// Filtering pattern to buildall.bash:
1630-
rx,
1634+
"^(" + strings.Join(targets, "|") + ")$",
16311635
},
16321636
})
16331637
}
16341638
// addMiscCompile adds a misc-compile TryBot
16351639
// for all supported Go versions.
1636-
addMiscCompile := func(suffix, rx string) { addMiscCompileGo1(0, suffix, rx) }
1637-
1638-
addMiscCompile("-linuxarm", "^linux-arm-arm5$") // 1: linux/arm with GOARM=5
1639-
addMiscCompile("-darwin", "^darwin-(386|amd64)$") // 1: amd64
1640-
addMiscCompileGo1(16, "-darwinarm64", "^darwin-arm64$") // 1: arm64 (for Go 1.16 and newer)
1641-
addMiscCompile("-mips", "^linux-mips") // 4: mips, mipsle, mips64, mips64le
1642-
addMiscCompile("-ppc", "^(linux-ppc64|aix-)") // 3: linux-ppc64{,le}, aix-ppc64
1643-
addMiscCompile("-solaris", "^(solaris|illumos)") // 2: both amd64
1644-
addMiscCompile("-plan9", "^plan9-") // 3: amd64, 386, arm
1645-
addMiscCompile("-freebsd", `^freebsd-(386|arm|arm64)\b`) // 3: 386, arm, arm64 (amd64 already trybot)
1646-
addMiscCompile("-netbsd", "^netbsd-") // 4: amd64, 386, arm, arm64
1647-
addMiscCompile("-openbsd", "^openbsd-") // 4: amd64, 386, arm, arm64
1648-
1649-
// And 4 that don't fit above:
1650-
addMiscCompile("-other", "^(windows-arm|linux-s390x|linux-riscv64|dragonfly-amd64)$")
1640+
addMiscCompile := func(suffix string, targets ...string) { addMiscCompileGo1(0, suffix, targets...) }
1641+
1642+
// Arrange so that no more than 3 ports are tested sequentially in each misc-compile
1643+
// TryBot to avoid any individual misc-compile TryBot from becoming a bottleneck for
1644+
// overall TryBot completion time (currently 10 minutes; see golang.org/issue/17104).
1645+
//
1646+
// The TestTryBotsCompileAllPorts test is used to detect any gaps in TryBot coverage
1647+
// when new ports are added, and the misc-compile pairs below can be re-arranged.
1648+
//
1649+
// (In the past, we used flexible regexp patterns that matched all architectures
1650+
// for a given GOOS value. However, over time as new architectures were added,
1651+
// some misc-compile TryBot could become much slower than others.)
1652+
//
1653+
// See golang.org/issue/32632.
1654+
addMiscCompile("-mac-win", "darwin-amd64", "windows-arm")
1655+
addMiscCompileGo1(16, "-darwinarm64", "darwin-arm64") // darwin/arm64 (for Go 1.16 and newer) only.
1656+
addMiscCompile("-mips", "linux-mips", "linux-mips64")
1657+
addMiscCompile("-mipsle", "linux-mipsle", "linux-mips64le")
1658+
addMiscCompile("-ppc", "linux-ppc64", "linux-ppc64le", "aix-ppc64")
1659+
addMiscCompile("-freebsd", "freebsd-386", "freebsd-arm", "freebsd-arm64")
1660+
addMiscCompile("-netbsd", "netbsd-386", "netbsd-amd64")
1661+
addMiscCompile("-netbsd-arm", "netbsd-arm", "netbsd-arm64")
1662+
addMiscCompile("-openbsd", "openbsd-386", "openbsd-mips64")
1663+
addMiscCompile("-openbsd-arm", "openbsd-arm", "openbsd-arm64")
1664+
addMiscCompile("-plan9", "plan9-386", "plan9-amd64", "plan9-arm")
1665+
addMiscCompile("-other-1", "solaris-amd64", "illumos-amd64", "dragonfly-amd64")
1666+
addMiscCompile("-other-2", "linux-riscv64", "linux-s390x", "linux-arm-arm5") // 'linux-arm-arm5' is linux/arm with GOARM=5.
16511667

16521668
// TODO: Issue 25963, get the misc-compile trybots for Android/iOS.
16531669
// Then consider subrepos too, so "mobile" can at least be included

dashboard/builders_test.go

+72-30
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,23 @@ func TestTrybots(t *testing.T) {
9999
"linux-amd64-race",
100100
"linux-arm-aws",
101101
"linux-arm64-aws",
102-
"misc-compile-darwin",
102+
"openbsd-amd64-68",
103+
"windows-386-2008",
104+
"windows-amd64-2016",
105+
103106
"misc-compile-darwinarm64",
104107
"misc-compile-freebsd",
105-
"misc-compile-linuxarm",
108+
"misc-compile-mac-win",
106109
"misc-compile-mips",
110+
"misc-compile-mipsle",
107111
"misc-compile-netbsd",
112+
"misc-compile-netbsd-arm",
108113
"misc-compile-openbsd",
109-
"misc-compile-other",
114+
"misc-compile-openbsd-arm",
110115
"misc-compile-plan9",
111116
"misc-compile-ppc",
112-
"misc-compile-solaris",
113-
"openbsd-amd64-68",
114-
"windows-386-2008",
115-
"windows-amd64-2016",
117+
"misc-compile-other-1",
118+
"misc-compile-other-2",
116119
},
117120
},
118121
{
@@ -127,20 +130,23 @@ func TestTrybots(t *testing.T) {
127130
"linux-amd64-race",
128131
"linux-arm-aws",
129132
"linux-arm64-aws",
130-
"misc-compile-darwin",
133+
"openbsd-amd64-68",
134+
"windows-386-2008",
135+
"windows-amd64-2016",
136+
131137
"misc-compile-darwinarm64",
132138
"misc-compile-freebsd",
133-
"misc-compile-linuxarm",
139+
"misc-compile-mac-win",
134140
"misc-compile-mips",
141+
"misc-compile-mipsle",
135142
"misc-compile-netbsd",
143+
"misc-compile-netbsd-arm",
136144
"misc-compile-openbsd",
137-
"misc-compile-other",
145+
"misc-compile-openbsd-arm",
138146
"misc-compile-plan9",
139147
"misc-compile-ppc",
140-
"misc-compile-solaris",
141-
"openbsd-amd64-68",
142-
"windows-386-2008",
143-
"windows-amd64-2016",
148+
"misc-compile-other-1",
149+
"misc-compile-other-2",
144150
},
145151
},
146152
{
@@ -155,20 +161,23 @@ func TestTrybots(t *testing.T) {
155161
"linux-amd64-race",
156162
"linux-arm-aws",
157163
"linux-arm64-aws",
158-
"misc-compile-darwin",
164+
"openbsd-amd64-68",
165+
"windows-386-2008",
166+
"windows-amd64-2016",
167+
159168
"misc-compile-darwinarm64", // Starts with Go 1.16.
160169
"misc-compile-freebsd",
161-
"misc-compile-linuxarm",
170+
"misc-compile-mac-win",
162171
"misc-compile-mips",
172+
"misc-compile-mipsle",
163173
"misc-compile-netbsd",
174+
"misc-compile-netbsd-arm",
164175
"misc-compile-openbsd",
165-
"misc-compile-other",
176+
"misc-compile-openbsd-arm",
166177
"misc-compile-plan9",
167178
"misc-compile-ppc",
168-
"misc-compile-solaris",
169-
"openbsd-amd64-68",
170-
"windows-386-2008",
171-
"windows-amd64-2016",
179+
"misc-compile-other-1",
180+
"misc-compile-other-2",
172181

173182
// Include longtest builders on Go repo release branches. See issue 37827.
174183
"linux-386-longtest",
@@ -188,19 +197,22 @@ func TestTrybots(t *testing.T) {
188197
"linux-amd64-race",
189198
"linux-arm-aws",
190199
"linux-arm64-aws",
191-
"misc-compile-darwin",
200+
"openbsd-amd64-68",
201+
"windows-386-2008",
202+
"windows-amd64-2016",
203+
192204
"misc-compile-freebsd",
193-
"misc-compile-linuxarm",
205+
"misc-compile-mac-win",
194206
"misc-compile-mips",
207+
"misc-compile-mipsle",
195208
"misc-compile-netbsd",
209+
"misc-compile-netbsd-arm",
196210
"misc-compile-openbsd",
197-
"misc-compile-other",
211+
"misc-compile-openbsd-arm",
198212
"misc-compile-plan9",
199213
"misc-compile-ppc",
200-
"misc-compile-solaris",
201-
"openbsd-amd64-68",
202-
"windows-386-2008",
203-
"windows-amd64-2016",
214+
"misc-compile-other-1",
215+
"misc-compile-other-2",
204216

205217
// Include longtest builders on Go repo release branches. See issue 37827.
206218
"linux-386-longtest",
@@ -817,8 +829,10 @@ func TestCrossCompileConfigs(t *testing.T) {
817829
}
818830
}
819831

820-
// TestTryBotsCompileAllPorts verifies that each port (go tool dist list) is covered by
821-
// either a real trybot or a misc-compile trybot.
832+
// TestTryBotsCompileAllPorts verifies that each port (go tool dist list)
833+
// is covered by either a real TryBot or a misc-compile TryBot.
834+
//
835+
// The special pseudo-port 'linux-arm-arm5' is tested in TestMiscCompileLinuxGOARM5.
822836
func TestTryBotsCompileAllPorts(t *testing.T) {
823837
out, err := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "tool", "dist", "list").Output()
824838
if err != nil {
@@ -892,6 +906,34 @@ func TestTryBotsCompileAllPorts(t *testing.T) {
892906
}
893907
}
894908

909+
// The 'linux-arm-arm5' pseduo-port is supported by src/buildall.bash
910+
// and tests linux/arm with GOARM=5 set. Since it's not a normal port,
911+
// the TestTryBotsCompileAllPorts wouldn't report if the misc-compile
912+
// TryBot that covers is is accidentally removed. Check it explicitly.
913+
func TestMiscCompileLinuxGOARM5(t *testing.T) {
914+
var ok bool
915+
for _, b := range Builders {
916+
if !strings.HasPrefix(b.Name, "misc-compile-") {
917+
continue
918+
}
919+
re, err := regexp.Compile(b.allScriptArgs[0])
920+
if err != nil {
921+
t.Fatalf("invalid misc-compile filtering pattern for builder %q: %q",
922+
b.Name, b.allScriptArgs[0])
923+
}
924+
if re.MatchString("linux-arm-arm5") {
925+
ok = true
926+
break
927+
}
928+
}
929+
if !ok {
930+
// We get here if the linux-arm-arm5 port is no longer checked by
931+
// a misc-compile TryBot. Report it as a failure in case the coverage
932+
// was removed accidentally (e.g., as part of a refactor).
933+
t.Errorf("no misc-compile TryBot coverage for the special 'linux-arm-arm5' pseudo-port")
934+
}
935+
}
936+
895937
// TestExpectedMacstadiumVMCount ensures that only 20 instances of macOS virtual machines
896938
// are expected at MacStadium.
897939
// TODO: remove once the scheduler allocates VMs based on demand https://golang.org/issue/35698

0 commit comments

Comments
 (0)