Brad Fitzpatrick | f3c0193 | 2015-01-15 16:29:16 -0800 | [diff] [blame] | 1 | // Copyright 2015 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package dashboard |
| 6 | |
| 7 | import ( |
Brad Fitzpatrick | aab8504 | 2019-10-16 06:02:29 +0000 | [diff] [blame] | 8 | "bytes" |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 9 | "fmt" |
Brad Fitzpatrick | aab8504 | 2019-10-16 06:02:29 +0000 | [diff] [blame] | 10 | "os/exec" |
| 11 | "path/filepath" |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 12 | "regexp" |
Brad Fitzpatrick | aab8504 | 2019-10-16 06:02:29 +0000 | [diff] [blame] | 13 | "runtime" |
| 14 | "sort" |
Brad Fitzpatrick | f3c0193 | 2015-01-15 16:29:16 -0800 | [diff] [blame] | 15 | "strings" |
| 16 | "testing" |
Brad Fitzpatrick | 34b995b | 2019-02-14 02:18:06 +0000 | [diff] [blame] | 17 | "time" |
Carlos Amedee | 1e76199 | 2020-08-20 11:53:58 -0400 | [diff] [blame] | 18 | |
| 19 | "github.com/google/go-cmp/cmp" |
Brad Fitzpatrick | f3c0193 | 2015-01-15 16:29:16 -0800 | [diff] [blame] | 20 | ) |
| 21 | |
| 22 | func TestOSARCHAccessors(t *testing.T) { |
| 23 | valid := func(s string) bool { return s != "" && !strings.Contains(s, "-") } |
| 24 | for _, conf := range Builders { |
| 25 | os := conf.GOOS() |
| 26 | arch := conf.GOARCH() |
| 27 | osArch := os + "-" + arch |
| 28 | if !valid(os) || !valid(arch) || !(conf.Name == osArch || strings.HasPrefix(conf.Name, osArch+"-")) { |
| 29 | t.Errorf("OS+ARCH(%q) = %q, %q; invalid", conf.Name, os, arch) |
| 30 | } |
| 31 | } |
| 32 | } |
Brad Fitzpatrick | c328d04 | 2017-04-12 00:35:37 +0000 | [diff] [blame] | 33 | |
Brad Fitzpatrick | 34b995b | 2019-02-14 02:18:06 +0000 | [diff] [blame] | 34 | func TestDistTestsExecTimeout(t *testing.T) { |
| 35 | tests := []struct { |
| 36 | c *BuildConfig |
| 37 | want time.Duration |
| 38 | }{ |
| 39 | { |
| 40 | &BuildConfig{ |
| 41 | env: []string{}, |
| 42 | testHostConf: &HostConfig{}, |
| 43 | }, |
| 44 | 20 * time.Minute, |
| 45 | }, |
| 46 | { |
| 47 | &BuildConfig{ |
| 48 | env: []string{"GO_TEST_TIMEOUT_SCALE=2"}, |
| 49 | testHostConf: &HostConfig{}, |
| 50 | }, |
| 51 | 40 * time.Minute, |
| 52 | }, |
| 53 | { |
| 54 | &BuildConfig{ |
| 55 | env: []string{}, |
| 56 | testHostConf: &HostConfig{ |
| 57 | env: []string{"GO_TEST_TIMEOUT_SCALE=3"}, |
| 58 | }, |
| 59 | }, |
| 60 | 60 * time.Minute, |
| 61 | }, |
| 62 | // BuildConfig's env takes precedence: |
| 63 | { |
| 64 | &BuildConfig{ |
| 65 | env: []string{"GO_TEST_TIMEOUT_SCALE=2"}, |
| 66 | testHostConf: &HostConfig{ |
| 67 | env: []string{"GO_TEST_TIMEOUT_SCALE=3"}, |
| 68 | }, |
| 69 | }, |
| 70 | 40 * time.Minute, |
| 71 | }, |
| 72 | } |
| 73 | for i, tt := range tests { |
| 74 | got := tt.c.DistTestsExecTimeout(nil) |
| 75 | if got != tt.want { |
| 76 | t.Errorf("%d. got %v; want %v", i, got, tt.want) |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 81 | // TestTrybots tests that a given repo & its branch yields the provided |
| 82 | // complete set of builders. See also: TestBuilders, which tests both trybots |
| 83 | // and post-submit builders, both at arbitrary branches. |
| 84 | func TestTrybots(t *testing.T) { |
| 85 | tests := []struct { |
| 86 | repo string // "go", "net", etc |
| 87 | branch string // of repo |
| 88 | want []string |
| 89 | }{ |
| 90 | { |
| 91 | repo: "go", |
| 92 | branch: "master", |
| 93 | want: []string{ |
Brad Fitzpatrick | 4e29d67 | 2019-04-18 19:45:32 +0000 | [diff] [blame] | 94 | "android-amd64-emu", |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 95 | "freebsd-amd64-12_2", |
Heschi Kreinick | 4c800c5 | 2022-01-05 12:21:24 -0500 | [diff] [blame] | 96 | "freebsd-amd64-12_3", |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 97 | "js-wasm", |
| 98 | "linux-386", |
| 99 | "linux-amd64", |
| 100 | "linux-amd64-race", |
Matthew Dempsky | 4f8007b | 2021-08-12 15:11:41 -0700 | [diff] [blame] | 101 | "linux-amd64-unified", |
Carlos Amedee | c1822c7 | 2021-03-19 13:54:17 -0400 | [diff] [blame] | 102 | "linux-arm-aws", |
Carlos Amedee | 34b0d64 | 2021-03-19 14:53:06 -0400 | [diff] [blame] | 103 | "linux-arm64-aws", |
Dmitri Shuralyov | 01e47d9 | 2020-12-21 14:12:25 -0500 | [diff] [blame] | 104 | "openbsd-amd64-68", |
Heschi Kreinick | 90a1d27 | 2021-11-15 15:02:19 -0500 | [diff] [blame] | 105 | "openbsd-amd64-70", |
Alexander Rakoczy | 87c1ba4 | 2021-11-19 14:22:11 -0500 | [diff] [blame] | 106 | "openbsd-amd64-70-n1", |
Jason A. Donenfeld | 3441580 | 2021-11-23 21:55:31 +0100 | [diff] [blame] | 107 | "windows-386-2008", |
Carlos Amedee | f077b9b | 2021-11-11 15:05:21 -0500 | [diff] [blame] | 108 | "windows-386-2012", |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 109 | "windows-amd64-2016", |
Dmitri Shuralyov | 646d48d | 2021-04-23 16:56:37 -0400 | [diff] [blame] | 110 | |
| 111 | "misc-compile-darwinarm64", |
| 112 | "misc-compile-freebsd", |
| 113 | "misc-compile-mac-win", |
| 114 | "misc-compile-mips", |
| 115 | "misc-compile-mipsle", |
| 116 | "misc-compile-netbsd", |
| 117 | "misc-compile-netbsd-arm", |
| 118 | "misc-compile-openbsd", |
| 119 | "misc-compile-openbsd-arm", |
| 120 | "misc-compile-plan9", |
| 121 | "misc-compile-ppc", |
| 122 | "misc-compile-other-1", |
| 123 | "misc-compile-other-2", |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 124 | }, |
| 125 | }, |
| 126 | { |
| 127 | repo: "go", |
Matthew Dempsky | df58bba | 2021-06-16 23:08:22 -0700 | [diff] [blame] | 128 | branch: "dev.typeparams", |
Brad Fitzpatrick | 90670e1 | 2019-10-11 18:47:51 +0000 | [diff] [blame] | 129 | want: []string{ |
Cherry Zhang | 50a7880 | 2020-03-13 17:09:21 -0400 | [diff] [blame] | 130 | "android-amd64-emu", |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 131 | "freebsd-amd64-12_2", |
Heschi Kreinick | 4c800c5 | 2022-01-05 12:21:24 -0500 | [diff] [blame] | 132 | "freebsd-amd64-12_3", |
Brad Fitzpatrick | 90670e1 | 2019-10-11 18:47:51 +0000 | [diff] [blame] | 133 | "js-wasm", |
| 134 | "linux-386", |
| 135 | "linux-amd64", |
| 136 | "linux-amd64-race", |
Matthew Dempsky | df58bba | 2021-06-16 23:08:22 -0700 | [diff] [blame] | 137 | "linux-amd64-unified", |
Carlos Amedee | c1822c7 | 2021-03-19 13:54:17 -0400 | [diff] [blame] | 138 | "linux-arm-aws", |
Carlos Amedee | 34b0d64 | 2021-03-19 14:53:06 -0400 | [diff] [blame] | 139 | "linux-arm64-aws", |
Dmitri Shuralyov | 01e47d9 | 2020-12-21 14:12:25 -0500 | [diff] [blame] | 140 | "openbsd-amd64-68", |
Heschi Kreinick | 90a1d27 | 2021-11-15 15:02:19 -0500 | [diff] [blame] | 141 | "openbsd-amd64-70", |
Alexander Rakoczy | 87c1ba4 | 2021-11-19 14:22:11 -0500 | [diff] [blame] | 142 | "openbsd-amd64-70-n1", |
Jason A. Donenfeld | 3441580 | 2021-11-23 21:55:31 +0100 | [diff] [blame] | 143 | "windows-386-2008", |
Carlos Amedee | f077b9b | 2021-11-11 15:05:21 -0500 | [diff] [blame] | 144 | "windows-386-2012", |
Brad Fitzpatrick | 90670e1 | 2019-10-11 18:47:51 +0000 | [diff] [blame] | 145 | "windows-amd64-2016", |
Dmitri Shuralyov | 646d48d | 2021-04-23 16:56:37 -0400 | [diff] [blame] | 146 | |
| 147 | "misc-compile-darwinarm64", |
| 148 | "misc-compile-freebsd", |
| 149 | "misc-compile-mac-win", |
| 150 | "misc-compile-mips", |
| 151 | "misc-compile-mipsle", |
| 152 | "misc-compile-netbsd", |
| 153 | "misc-compile-netbsd-arm", |
| 154 | "misc-compile-openbsd", |
| 155 | "misc-compile-openbsd-arm", |
| 156 | "misc-compile-plan9", |
| 157 | "misc-compile-ppc", |
| 158 | "misc-compile-other-1", |
| 159 | "misc-compile-other-2", |
Brad Fitzpatrick | 90670e1 | 2019-10-11 18:47:51 +0000 | [diff] [blame] | 160 | }, |
| 161 | }, |
| 162 | { |
| 163 | repo: "go", |
Carlos Amedee | 060178c | 2022-01-07 12:21:07 -0500 | [diff] [blame] | 164 | branch: "release-branch.go1.17", |
| 165 | want: []string{ |
| 166 | "android-amd64-emu", |
| 167 | "freebsd-amd64-12_2", |
| 168 | "freebsd-amd64-12_3", |
| 169 | "js-wasm", |
| 170 | "linux-386", |
| 171 | "linux-amd64", |
| 172 | "linux-amd64-race", |
| 173 | "linux-arm-aws", |
| 174 | "linux-arm64-aws", |
| 175 | "openbsd-amd64-68", |
| 176 | "openbsd-amd64-70", |
| 177 | "openbsd-amd64-70-n1", |
| 178 | "windows-386-2008", |
| 179 | "windows-386-2012", |
| 180 | "windows-amd64-2016", |
| 181 | |
| 182 | "misc-compile-darwinarm64", |
| 183 | "misc-compile-freebsd", |
| 184 | "misc-compile-mac-win", |
| 185 | "misc-compile-mips", |
| 186 | "misc-compile-mipsle", |
| 187 | "misc-compile-netbsd", |
| 188 | "misc-compile-netbsd-arm", |
| 189 | "misc-compile-openbsd", |
| 190 | "misc-compile-openbsd-arm", |
| 191 | "misc-compile-plan9", |
| 192 | "misc-compile-ppc", |
| 193 | "misc-compile-other-1", |
| 194 | "misc-compile-other-2", |
| 195 | |
| 196 | // Include longtest builders on Go repo release branches. See issue 37827. |
| 197 | "linux-386-longtest", |
| 198 | "linux-amd64-longtest", |
| 199 | "windows-amd64-longtest", |
| 200 | }, |
| 201 | }, |
| 202 | { |
| 203 | repo: "go", |
Dmitri Shuralyov | 4c544cb | 2020-11-02 22:25:51 -0500 | [diff] [blame] | 204 | branch: "release-branch.go1.16", |
| 205 | want: []string{ |
| 206 | "android-amd64-emu", |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 207 | "freebsd-amd64-12_2", |
Heschi Kreinick | 4c800c5 | 2022-01-05 12:21:24 -0500 | [diff] [blame] | 208 | "freebsd-amd64-12_3", |
Dmitri Shuralyov | 4c544cb | 2020-11-02 22:25:51 -0500 | [diff] [blame] | 209 | "js-wasm", |
| 210 | "linux-386", |
| 211 | "linux-amd64", |
| 212 | "linux-amd64-race", |
Carlos Amedee | c1822c7 | 2021-03-19 13:54:17 -0400 | [diff] [blame] | 213 | "linux-arm-aws", |
Carlos Amedee | 34b0d64 | 2021-03-19 14:53:06 -0400 | [diff] [blame] | 214 | "linux-arm64-aws", |
Dmitri Shuralyov | 01e47d9 | 2020-12-21 14:12:25 -0500 | [diff] [blame] | 215 | "openbsd-amd64-68", |
Dmitri Shuralyov | 4c544cb | 2020-11-02 22:25:51 -0500 | [diff] [blame] | 216 | "windows-386-2008", |
Jason A. Donenfeld | 3441580 | 2021-11-23 21:55:31 +0100 | [diff] [blame] | 217 | "windows-386-2012", |
Dmitri Shuralyov | 4c544cb | 2020-11-02 22:25:51 -0500 | [diff] [blame] | 218 | "windows-amd64-2016", |
| 219 | |
Dmitri Shuralyov | 646d48d | 2021-04-23 16:56:37 -0400 | [diff] [blame] | 220 | "misc-compile-darwinarm64", // Starts with Go 1.16. |
| 221 | "misc-compile-freebsd", |
| 222 | "misc-compile-mac-win", |
| 223 | "misc-compile-mips", |
| 224 | "misc-compile-mipsle", |
| 225 | "misc-compile-netbsd", |
| 226 | "misc-compile-netbsd-arm", |
| 227 | "misc-compile-openbsd", |
| 228 | "misc-compile-openbsd-arm", |
| 229 | "misc-compile-plan9", |
| 230 | "misc-compile-ppc", |
| 231 | "misc-compile-other-1", |
| 232 | "misc-compile-other-2", |
| 233 | |
Dmitri Shuralyov | 4c544cb | 2020-11-02 22:25:51 -0500 | [diff] [blame] | 234 | // Include longtest builders on Go repo release branches. See issue 37827. |
| 235 | "linux-386-longtest", |
| 236 | "linux-amd64-longtest", |
| 237 | "windows-amd64-longtest", |
| 238 | }, |
| 239 | }, |
| 240 | { |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 241 | repo: "mobile", |
| 242 | branch: "master", |
| 243 | want: []string{ |
| 244 | "android-amd64-emu", |
| 245 | "linux-amd64-androidemu", |
| 246 | }, |
| 247 | }, |
| 248 | { |
| 249 | repo: "sys", |
| 250 | branch: "master", |
| 251 | want: []string{ |
Brad Fitzpatrick | 6d867c8 | 2019-04-26 14:04:00 +0000 | [diff] [blame] | 252 | "android-amd64-emu", |
Carlos Amedee | 858ecaf | 2021-11-18 16:33:40 -0500 | [diff] [blame] | 253 | "freebsd-386-13_0", |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 254 | "freebsd-amd64-12_2", |
Heschi Kreinick | 4c800c5 | 2022-01-05 12:21:24 -0500 | [diff] [blame] | 255 | "freebsd-amd64-12_3", |
Carlos Amedee | 858ecaf | 2021-11-18 16:33:40 -0500 | [diff] [blame] | 256 | "freebsd-amd64-13_0", |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 257 | "linux-386", |
| 258 | "linux-amd64", |
Brad Fitzpatrick | 8665028 | 2019-03-11 18:49:56 +0000 | [diff] [blame] | 259 | "linux-amd64-race", |
Carlos Amedee | c1822c7 | 2021-03-19 13:54:17 -0400 | [diff] [blame] | 260 | "linux-arm-aws", |
Carlos Amedee | 34b0d64 | 2021-03-19 14:53:06 -0400 | [diff] [blame] | 261 | "linux-arm64-aws", |
Dmitri Shuralyov | 5bbd558 | 2020-04-08 12:43:09 -0400 | [diff] [blame] | 262 | "netbsd-amd64-9_0", |
Alexander Rakoczy | 87c1ba4 | 2021-11-19 14:22:11 -0500 | [diff] [blame] | 263 | "netbsd-amd64-9_0-n1", |
Dmitri Shuralyov | 01e47d9 | 2020-12-21 14:12:25 -0500 | [diff] [blame] | 264 | "openbsd-386-68", |
Heschi Kreinick | 90a1d27 | 2021-11-15 15:02:19 -0500 | [diff] [blame] | 265 | "openbsd-386-70", |
Alexander Rakoczy | 87c1ba4 | 2021-11-19 14:22:11 -0500 | [diff] [blame] | 266 | "openbsd-386-70-n1", |
Dmitri Shuralyov | 01e47d9 | 2020-12-21 14:12:25 -0500 | [diff] [blame] | 267 | "openbsd-amd64-68", |
Heschi Kreinick | 90a1d27 | 2021-11-15 15:02:19 -0500 | [diff] [blame] | 268 | "openbsd-amd64-70", |
Alexander Rakoczy | 87c1ba4 | 2021-11-19 14:22:11 -0500 | [diff] [blame] | 269 | "openbsd-amd64-70-n1", |
Jason A. Donenfeld | 3441580 | 2021-11-23 21:55:31 +0100 | [diff] [blame] | 270 | "windows-386-2008", |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 271 | "windows-amd64-2016", |
| 272 | }, |
| 273 | }, |
Brad Fitzpatrick | 83c6b6a | 2019-03-14 20:35:32 +0000 | [diff] [blame] | 274 | { |
| 275 | repo: "exp", |
| 276 | branch: "master", |
| 277 | want: []string{ |
Brad Fitzpatrick | 83c6b6a | 2019-03-14 20:35:32 +0000 | [diff] [blame] | 278 | "linux-amd64", |
| 279 | "linux-amd64-race", |
Jason A. Donenfeld | 3441580 | 2021-11-23 21:55:31 +0100 | [diff] [blame] | 280 | "windows-386-2008", |
Brad Fitzpatrick | 83c6b6a | 2019-03-14 20:35:32 +0000 | [diff] [blame] | 281 | "windows-amd64-2016", |
| 282 | }, |
| 283 | }, |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 284 | } |
| 285 | for i, tt := range tests { |
| 286 | if tt.branch == "" || tt.repo == "" { |
| 287 | t.Errorf("incomplete test entry %d", i) |
| 288 | return |
| 289 | } |
| 290 | t.Run(fmt.Sprintf("%s/%s", tt.repo, tt.branch), func(t *testing.T) { |
| 291 | var got []string |
| 292 | goBranch := tt.branch // hard-code the common case for now |
| 293 | for _, bc := range TryBuildersForProject(tt.repo, tt.branch, goBranch) { |
| 294 | got = append(got, bc.Name) |
| 295 | } |
| 296 | m := map[string]bool{} |
| 297 | for _, b := range tt.want { |
| 298 | m[b] = true |
| 299 | } |
| 300 | for _, b := range got { |
| 301 | if _, ok := m[b]; !ok { |
Jason A. Donenfeld | 3441580 | 2021-11-23 21:55:31 +0100 | [diff] [blame] | 302 | t.Errorf("got unexpected %q for %s/%s", b, tt.repo, tt.branch) |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 303 | } |
| 304 | delete(m, b) |
| 305 | } |
| 306 | for b := range m { |
Jason A. Donenfeld | 3441580 | 2021-11-23 21:55:31 +0100 | [diff] [blame] | 307 | t.Errorf("missing expected %q for %s/%s", b, tt.repo, tt.branch) |
Brad Fitzpatrick | c517aed | 2018-10-26 19:21:58 +0000 | [diff] [blame] | 308 | } |
| 309 | }) |
Brad Fitzpatrick | c328d04 | 2017-04-12 00:35:37 +0000 | [diff] [blame] | 310 | } |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 311 | } |
| 312 | |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 313 | // TestBuilderConfig tests whether a given builder and repo at different branches is |
| 314 | // completely disabled ("none"), |
| 315 | // a TryBot and a post-submit builder ("both"), or |
| 316 | // a post-submit only builder ("onlyPost"). |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 317 | func TestBuilderConfig(t *testing.T) { |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 318 | // want is a bitmask of 4 different things to assert are wanted: |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 319 | // - being a post-submit builder |
| 320 | // - NOT being a post-submit builder |
| 321 | // - being a trybot builder |
| 322 | // - NOT being a post-submit builder |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 323 | // Note: a builder cannot be configured as a TryBot without also being a post-submit builder. |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 324 | type want uint8 |
| 325 | const ( |
| 326 | isTrybot want = 1 << iota |
| 327 | notTrybot |
| 328 | isBuilder // post-submit |
| 329 | notBuilder // not post-submit |
| 330 | |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 331 | // Available combinations: |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 332 | none = notTrybot + notBuilder |
| 333 | both = isTrybot + isBuilder |
| 334 | onlyPost = notTrybot + isBuilder |
| 335 | ) |
| 336 | |
| 337 | type builderAndRepo struct { |
| 338 | testName string |
| 339 | builder string |
| 340 | repo string |
| 341 | branch string |
| 342 | goBranch string |
| 343 | } |
Dmitri Shuralyov | 76fd6b5 | 2019-10-08 13:08:27 -0400 | [diff] [blame] | 344 | // builder may end in "@go1.N" or "@1.N" (as alias for "@release-branch.go1.N") or "@branch-name". |
| 345 | // repo (other than "go") may end in "@go1.N" or "@1.N" (as alias for "@release-branch.go1.N"). |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 346 | b := func(builder, repo string) builderAndRepo { |
| 347 | br := builderAndRepo{ |
| 348 | testName: builder + "," + repo, |
| 349 | builder: builder, |
| 350 | goBranch: "master", |
| 351 | repo: repo, |
| 352 | branch: "master", |
| 353 | } |
| 354 | if strings.Contains(builder, "@") { |
| 355 | f := strings.SplitN(builder, "@", 2) |
| 356 | br.builder = f[0] |
| 357 | br.goBranch = f[1] |
| 358 | } |
| 359 | if strings.Contains(repo, "@") { |
| 360 | f := strings.SplitN(repo, "@", 2) |
| 361 | br.repo = f[0] |
| 362 | br.branch = f[1] |
Dmitri Shuralyov | 76fd6b5 | 2019-10-08 13:08:27 -0400 | [diff] [blame] | 363 | if br.repo == "go" { |
| 364 | panic(fmt.Errorf(`b(%q, %q): for "go" repo, must use the @%s suffix on the builder, not on the repo`, builder, repo, br.branch)) |
| 365 | } |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 366 | } |
| 367 | expandBranch := func(s *string) { |
| 368 | if strings.HasPrefix(*s, "go1.") { |
| 369 | *s = "release-branch." + *s |
| 370 | } else if strings.HasPrefix(*s, "1.") { |
| 371 | *s = "release-branch.go" + *s |
| 372 | } |
| 373 | } |
| 374 | expandBranch(&br.branch) |
| 375 | expandBranch(&br.goBranch) |
| 376 | if br.repo == "go" { |
| 377 | br.branch = br.goBranch |
| 378 | } |
| 379 | return br |
| 380 | } |
| 381 | tests := []struct { |
| 382 | br builderAndRepo |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 383 | want want // none, both, or onlyPost. |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 384 | }{ |
| 385 | {b("linux-amd64", "go"), both}, |
| 386 | {b("linux-amd64", "net"), both}, |
| 387 | {b("linux-amd64", "sys"), both}, |
Dmitri Shuralyov | 7aef06b | 2019-05-16 16:04:34 -0400 | [diff] [blame] | 388 | {b("linux-amd64", "website"), both}, |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 389 | |
Brad Fitzpatrick | b8db43d | 2019-03-11 04:20:46 +0000 | [diff] [blame] | 390 | // Don't test all subrepos on all the builders. |
| 391 | {b("linux-amd64-ssacheck", "net"), none}, |
Dmitri Shuralyov | df6c66f | 2020-10-05 12:20:33 -0400 | [diff] [blame] | 392 | {b("linux-amd64-ssacheck@go1.15", "net"), none}, |
Dmitri Shuralyov | 0f5b1a7 | 2020-10-07 11:24:42 -0400 | [diff] [blame] | 393 | {b("linux-386-softfloat", "crypto"), onlyPost}, |
| 394 | {b("linux-386-softfloat@go1.16", "crypto"), onlyPost}, |
| 395 | {b("linux-386-softfloat@go1.15", "crypto"), none}, |
Brad Fitzpatrick | b8db43d | 2019-03-11 04:20:46 +0000 | [diff] [blame] | 396 | |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 397 | // The mobile repo requires Go 1.13+. |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 398 | {b("android-amd64-emu", "mobile"), both}, |
| 399 | {b("android-amd64-emu", "mobile@1.10"), none}, |
| 400 | {b("android-amd64-emu", "mobile@1.11"), none}, |
| 401 | {b("android-amd64-emu@go1.10", "mobile"), none}, |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 402 | {b("android-amd64-emu@go1.12", "mobile"), none}, |
| 403 | {b("android-amd64-emu@go1.13", "mobile"), both}, |
| 404 | {b("android-amd64-emu", "mobile@1.13"), both}, |
Dmitri Shuralyov | 220eca8 | 2020-01-10 15:53:25 -0500 | [diff] [blame] | 405 | |
| 406 | {b("android-amd64-emu", "go"), both}, |
Brad Fitzpatrick | 6d867c8 | 2019-04-26 14:04:00 +0000 | [diff] [blame] | 407 | {b("android-amd64-emu", "crypto"), both}, |
| 408 | {b("android-amd64-emu", "net"), both}, |
| 409 | {b("android-amd64-emu", "sync"), both}, |
| 410 | {b("android-amd64-emu", "sys"), both}, |
| 411 | {b("android-amd64-emu", "text"), both}, |
| 412 | {b("android-amd64-emu", "time"), both}, |
| 413 | {b("android-amd64-emu", "tools"), both}, |
Dmitri Shuralyov | bb0f224 | 2019-08-29 09:22:13 -0400 | [diff] [blame] | 414 | {b("android-amd64-emu", "website"), none}, |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 415 | |
| 416 | {b("android-386-emu", "go"), onlyPost}, |
| 417 | {b("android-386-emu", "mobile"), onlyPost}, |
| 418 | {b("android-386-emu", "mobile@1.10"), none}, |
| 419 | {b("android-386-emu", "mobile@1.11"), none}, |
| 420 | {b("android-386-emu@go1.10", "mobile"), none}, |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 421 | {b("android-386-emu@go1.12", "mobile"), none}, |
| 422 | {b("android-386-emu@go1.13", "mobile"), onlyPost}, |
| 423 | {b("android-386-emu", "mobile@1.13"), onlyPost}, |
| 424 | |
| 425 | {b("linux-amd64", "net"), both}, |
| 426 | {b("linux-amd64", "net@1.12"), both}, |
| 427 | {b("linux-amd64@go1.12", "net@1.12"), both}, |
| 428 | {b("linux-amd64", "net@1.11"), both}, |
| 429 | {b("linux-amd64", "net@1.11"), both}, |
| 430 | {b("linux-amd64", "net@1.10"), none}, // too old |
| 431 | {b("linux-amd64@go1.10", "net"), none}, // too old |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 432 | {b("linux-amd64@go1.12", "net@1.12"), both}, |
| 433 | |
Meng Zhuo | 8805279 | 2019-09-10 07:21:11 +0800 | [diff] [blame] | 434 | {b("linux-mips64le-mengzhuo", "go"), onlyPost}, |
| 435 | {b("linux-mips64le-mengzhuo", "sys"), onlyPost}, |
| 436 | {b("linux-mips64le-mengzhuo", "net"), onlyPost}, |
| 437 | |
Xiaodong Liu | 5eaa6e0 | 2021-09-02 15:51:28 +0800 | [diff] [blame] | 438 | {b("linux-loong64-3a5000", "go"), onlyPost}, |
| 439 | {b("linux-loong64-3a5000", "sys"), onlyPost}, |
| 440 | {b("linux-loong64-3a5000", "net"), onlyPost}, |
| 441 | |
Dmitri Shuralyov | 5f7fe5e | 2020-11-10 12:56:57 -0500 | [diff] [blame] | 442 | // OpenBSD. |
Dmitri Shuralyov | 01e47d9 | 2020-12-21 14:12:25 -0500 | [diff] [blame] | 443 | {b("openbsd-amd64-68@go1.16", "go"), both}, |
| 444 | {b("openbsd-amd64-68@go1.15", "go"), both}, |
| 445 | {b("openbsd-amd64-68@go1.14", "go"), both}, |
Dmitri Shuralyov | 5f7fe5e | 2020-11-10 12:56:57 -0500 | [diff] [blame] | 446 | |
Carlos Amedee | 858ecaf | 2021-11-18 16:33:40 -0500 | [diff] [blame] | 447 | // FreeBSD 13.0 |
| 448 | {b("freebsd-amd64-13_0", "go"), onlyPost}, |
| 449 | {b("freebsd-amd64-13_0", "net"), onlyPost}, |
| 450 | {b("freebsd-amd64-13_0", "mobile"), none}, |
| 451 | {b("freebsd-386-13_0", "go"), onlyPost}, |
| 452 | {b("freebsd-386-13_0", "net"), onlyPost}, |
| 453 | {b("freebsd-386-13_0", "mobile"), none}, |
| 454 | |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 455 | // FreeBSD 12.2 |
| 456 | {b("freebsd-amd64-12_2", "go"), both}, |
| 457 | {b("freebsd-amd64-12_2", "net"), both}, |
| 458 | {b("freebsd-amd64-12_2", "mobile"), none}, |
| 459 | {b("freebsd-386-12_2", "go"), onlyPost}, |
| 460 | {b("freebsd-386-12_2", "net"), onlyPost}, |
| 461 | {b("freebsd-386-12_2", "mobile"), none}, |
| 462 | |
Carlos Amedee | 060178c | 2022-01-07 12:21:07 -0500 | [diff] [blame] | 463 | // FreeBSD 11.4 |
| 464 | {b("freebsd-amd64-11_4@go1.16", "go"), onlyPost}, |
| 465 | {b("freebsd-amd64-11_4@go1.16", "net"), onlyPost}, |
| 466 | {b("freebsd-amd64-11_4@go1.16", "sys"), both}, |
| 467 | {b("freebsd-amd64-11_4", "go"), none}, |
| 468 | {b("freebsd-386-11_4@go1.17", "go"), onlyPost}, |
| 469 | {b("freebsd-386-11_4@go1.17", "net"), onlyPost}, |
| 470 | {b("freebsd-386-11_4@go1.17", "sys"), both}, |
| 471 | {b("freebsd-386-11_4", "go"), none}, |
| 472 | |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 473 | // FreeBSD 11.2 |
| 474 | // See golang.org/issue/45727 |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 475 | {b("freebsd-amd64-11_2@go1.15", "go"), onlyPost}, |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 476 | {b("freebsd-amd64-11_2@go1.15", "net"), onlyPost}, |
| 477 | {b("freebsd-amd64-11_2@go1.15", "sys"), both}, |
| 478 | {b("freebsd-amd64-11_2", "go"), none}, |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 479 | {b("freebsd-386-11_2@go1.16", "go"), onlyPost}, |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 480 | {b("freebsd-386-11_2@go1.16", "net"), onlyPost}, |
| 481 | {b("freebsd-386-11_2@go1.16", "sys"), both}, |
| 482 | {b("freebsd-386-11_2", "go"), none}, |
Brad Fitzpatrick | 9e52fce | 2019-03-12 21:13:50 +0000 | [diff] [blame] | 483 | |
Brad Fitzpatrick | fcf7a58 | 2019-04-30 22:37:31 +0000 | [diff] [blame] | 484 | // NetBSD |
Dmitri Shuralyov | 5bbd558 | 2020-04-08 12:43:09 -0400 | [diff] [blame] | 485 | {b("netbsd-amd64-9_0", "go"), onlyPost}, |
| 486 | {b("netbsd-amd64-9_0", "net"), onlyPost}, |
Dmitri Shuralyov | b7c61f7 | 2020-04-09 07:59:16 -0400 | [diff] [blame] | 487 | {b("netbsd-amd64-9_0", "sys"), both}, |
Dmitri Shuralyov | 5bbd558 | 2020-04-08 12:43:09 -0400 | [diff] [blame] | 488 | {b("netbsd-386-9_0", "go"), onlyPost}, |
| 489 | {b("netbsd-386-9_0", "net"), onlyPost}, |
Brad Fitzpatrick | fcf7a58 | 2019-04-30 22:37:31 +0000 | [diff] [blame] | 490 | |
Tobias Klauser | b7b6693 | 2019-03-13 09:29:15 +0100 | [diff] [blame] | 491 | // AIX starts at Go 1.12 |
| 492 | {b("aix-ppc64", "go"), onlyPost}, |
| 493 | {b("aix-ppc64", "net"), onlyPost}, |
Tobias Klauser | c2ec9e4 | 2019-06-04 10:14:55 +0200 | [diff] [blame] | 494 | {b("aix-ppc64", "mobile"), none}, |
| 495 | {b("aix-ppc64", "exp"), none}, |
Tobias Klauser | cbdd89b | 2019-10-14 11:31:13 +0200 | [diff] [blame] | 496 | {b("aix-ppc64", "term"), onlyPost}, |
Dmitri Shuralyov | 43ea694 | 2021-02-19 12:17:28 -0500 | [diff] [blame] | 497 | {b("aix-ppc64@go1.15", "go"), onlyPost}, |
| 498 | {b("aix-ppc64@go1.15", "net"), onlyPost}, |
| 499 | {b("aix-ppc64@go1.15", "mobile"), none}, |
| 500 | {b("aix-ppc64@go1.16", "net"), onlyPost}, |
| 501 | {b("aix-ppc64@go1.16", "mobile"), none}, |
Cherry Zhang | 50a7880 | 2020-03-13 17:09:21 -0400 | [diff] [blame] | 502 | {b("aix-ppc64@dev.link", "go"), onlyPost}, |
Tobias Klauser | b7b6693 | 2019-03-13 09:29:15 +0100 | [diff] [blame] | 503 | |
Brad Fitzpatrick | b8db43d | 2019-03-11 04:20:46 +0000 | [diff] [blame] | 504 | {b("linux-amd64-nocgo", "mobile"), none}, |
| 505 | |
Elias Naur | 4d0f77a | 2019-05-01 22:28:43 +0200 | [diff] [blame] | 506 | // Virtual mobiledevices |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 507 | {b("ios-arm64-corellium", "go"), onlyPost}, |
| 508 | {b("android-arm64-corellium", "go"), onlyPost}, |
| 509 | {b("android-arm-corellium", "go"), onlyPost}, |
Elias Naur | 6bebc8e | 2019-05-01 20:33:26 +0200 | [diff] [blame] | 510 | |
Elias Naur | 18919d6 | 2020-10-03 11:37:07 +0200 | [diff] [blame] | 511 | // Mobile builders that run with GOOS=linux/ios and have |
Brad Fitzpatrick | 13f1da9 | 2019-03-12 16:21:55 +0000 | [diff] [blame] | 512 | // a device attached. |
| 513 | {b("linux-amd64-androidemu", "mobile"), both}, |
Brad Fitzpatrick | 13f1da9 | 2019-03-12 16:21:55 +0000 | [diff] [blame] | 514 | |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 515 | // But the emulators run all: |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 516 | {b("android-amd64-emu", "mobile"), both}, |
| 517 | {b("android-386-emu", "mobile"), onlyPost}, |
| 518 | {b("android-amd64-emu", "net"), both}, |
| 519 | {b("android-386-emu", "net"), onlyPost}, |
| 520 | {b("android-amd64-emu", "go"), both}, |
| 521 | {b("android-386-emu", "go"), onlyPost}, |
Brad Fitzpatrick | b8db43d | 2019-03-11 04:20:46 +0000 | [diff] [blame] | 522 | |
Brad Fitzpatrick | 8665028 | 2019-03-11 18:49:56 +0000 | [diff] [blame] | 523 | // Only test tip for js/wasm, and only for some repos: |
Brad Fitzpatrick | b8db43d | 2019-03-11 04:20:46 +0000 | [diff] [blame] | 524 | {b("js-wasm", "go"), both}, |
Brad Fitzpatrick | 8665028 | 2019-03-11 18:49:56 +0000 | [diff] [blame] | 525 | {b("js-wasm", "arch"), onlyPost}, |
| 526 | {b("js-wasm", "crypto"), onlyPost}, |
| 527 | {b("js-wasm", "sys"), onlyPost}, |
Brad Fitzpatrick | b8db43d | 2019-03-11 04:20:46 +0000 | [diff] [blame] | 528 | {b("js-wasm", "net"), onlyPost}, |
| 529 | {b("js-wasm@go1.12", "net"), none}, |
Brad Fitzpatrick | 8665028 | 2019-03-11 18:49:56 +0000 | [diff] [blame] | 530 | {b("js-wasm", "benchmarks"), none}, |
| 531 | {b("js-wasm", "debug"), none}, |
| 532 | {b("js-wasm", "mobile"), none}, |
| 533 | {b("js-wasm", "perf"), none}, |
| 534 | {b("js-wasm", "talks"), none}, |
| 535 | {b("js-wasm", "tools"), none}, |
| 536 | {b("js-wasm", "tour"), none}, |
| 537 | {b("js-wasm", "website"), none}, |
| 538 | |
| 539 | // Race builders. Linux for all, GCE buidlers for |
| 540 | // post-submit, and only post-submit for "go" for |
| 541 | // Darwin (limited resources). |
| 542 | {b("linux-amd64-race", "go"), both}, |
| 543 | {b("linux-amd64-race", "net"), both}, |
| 544 | {b("windows-amd64-race", "go"), onlyPost}, |
| 545 | {b("windows-amd64-race", "net"), onlyPost}, |
| 546 | {b("freebsd-amd64-race", "go"), onlyPost}, |
| 547 | {b("freebsd-amd64-race", "net"), onlyPost}, |
| 548 | {b("darwin-amd64-race", "go"), onlyPost}, |
| 549 | {b("darwin-amd64-race", "net"), none}, |
| 550 | |
| 551 | // Long test. |
| 552 | {b("linux-amd64-longtest", "go"), onlyPost}, |
| 553 | {b("linux-amd64-longtest", "net"), onlyPost}, |
Dmitri Shuralyov | 5a8fb63 | 2020-05-26 18:19:05 -0400 | [diff] [blame] | 554 | {b("linux-amd64-longtest@go1.14", "go"), both}, |
Dmitri Shuralyov | 9e7a762 | 2020-05-26 18:12:12 -0400 | [diff] [blame] | 555 | {b("linux-amd64-longtest@go1.14", "net"), none}, |
Brad Fitzpatrick | f9c537e | 2019-10-28 20:16:36 +0000 | [diff] [blame] | 556 | {b("windows-amd64-longtest", "go"), onlyPost}, |
Dmitri Shuralyov | 5a8fb63 | 2020-05-26 18:19:05 -0400 | [diff] [blame] | 557 | {b("windows-amd64-longtest@go1.14", "go"), both}, |
Brad Fitzpatrick | f9c537e | 2019-10-28 20:16:36 +0000 | [diff] [blame] | 558 | {b("windows-amd64-longtest", "net"), onlyPost}, |
| 559 | {b("windows-amd64-longtest", "exp"), onlyPost}, |
| 560 | {b("windows-amd64-longtest", "mobile"), none}, |
Dmitri Shuralyov | dd5ac55 | 2020-07-01 14:14:47 -0400 | [diff] [blame] | 561 | {b("linux-386-longtest", "go"), onlyPost}, |
| 562 | {b("linux-386-longtest", "net"), onlyPost}, |
| 563 | {b("linux-386-longtest", "exp"), none}, |
| 564 | {b("linux-386-longtest", "mobile"), none}, |
Brad Fitzpatrick | 83c6b6a | 2019-03-14 20:35:32 +0000 | [diff] [blame] | 565 | |
Brad Fitzpatrick | d6a8c27 | 2019-04-05 05:26:05 +0000 | [diff] [blame] | 566 | // Experimental exp repo runs in very few places. |
Brad Fitzpatrick | 83c6b6a | 2019-03-14 20:35:32 +0000 | [diff] [blame] | 567 | {b("linux-amd64", "exp"), both}, |
Brad Fitzpatrick | d6a8c27 | 2019-04-05 05:26:05 +0000 | [diff] [blame] | 568 | {b("linux-amd64-race", "exp"), both}, |
| 569 | {b("linux-amd64-longtest", "exp"), onlyPost}, |
Jason A. Donenfeld | 3441580 | 2021-11-23 21:55:31 +0100 | [diff] [blame] | 570 | {b("windows-386-2008", "exp"), both}, |
Brad Fitzpatrick | d6a8c27 | 2019-04-05 05:26:05 +0000 | [diff] [blame] | 571 | {b("windows-amd64-2016", "exp"), both}, |
Brad Fitzpatrick | d6a8c27 | 2019-04-05 05:26:05 +0000 | [diff] [blame] | 572 | {b("darwin-amd64-10_14", "exp"), onlyPost}, |
Carlos Amedee | d6dec9c | 2019-11-19 14:55:01 +0000 | [diff] [blame] | 573 | {b("darwin-amd64-10_15", "exp"), onlyPost}, |
Brad Fitzpatrick | d6a8c27 | 2019-04-05 05:26:05 +0000 | [diff] [blame] | 574 | // ... but not on most others: |
Dmitri Shuralyov | 3b77b3a | 2019-09-28 17:43:42 +0000 | [diff] [blame] | 575 | {b("darwin-amd64-10_12", "exp"), none}, |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 576 | {b("freebsd-386-11_4", "exp"), none}, |
| 577 | {b("freebsd-386-12_2", "exp"), none}, |
| 578 | {b("freebsd-amd64-11_4", "exp"), none}, |
| 579 | {b("freebsd-amd64-12_2", "exp"), none}, |
Dmitri Shuralyov | 01e47d9 | 2020-12-21 14:12:25 -0500 | [diff] [blame] | 580 | {b("openbsd-amd64-68", "exp"), none}, |
Brad Fitzpatrick | d6a8c27 | 2019-04-05 05:26:05 +0000 | [diff] [blame] | 581 | {b("js-wasm", "exp"), none}, |
| 582 | |
| 583 | // exp is experimental; it doesn't test against release branches. |
Brad Fitzpatrick | d6a8c27 | 2019-04-05 05:26:05 +0000 | [diff] [blame] | 584 | {b("linux-amd64@go1.12", "exp"), none}, |
Brad Fitzpatrick | 8a071d4 | 2019-03-18 16:48:22 +0000 | [diff] [blame] | 585 | |
Brad Fitzpatrick | c8ca962 | 2019-12-07 05:14:28 +0000 | [diff] [blame] | 586 | // the build repo is only really useful for linux-amd64 (where we run it), |
| 587 | // and darwin-amd64 and perhaps windows-amd64 (for stuff like gomote). |
| 588 | // No need for any other operating systems to use it. |
| 589 | {b("linux-amd64", "build"), both}, |
| 590 | {b("linux-amd64-longtest", "build"), onlyPost}, |
| 591 | {b("windows-amd64-2016", "build"), both}, |
| 592 | {b("darwin-amd64-10_12", "build"), none}, |
| 593 | {b("darwin-amd64-10_14", "build"), none}, |
| 594 | {b("darwin-amd64-10_15", "build"), onlyPost}, |
Dmitri Shuralyov | 01e47d9 | 2020-12-21 14:12:25 -0500 | [diff] [blame] | 595 | {b("openbsd-amd64-68", "build"), none}, |
Brad Fitzpatrick | c8ca962 | 2019-12-07 05:14:28 +0000 | [diff] [blame] | 596 | {b("linux-amd64-fedora", "build"), none}, |
| 597 | {b("linux-amd64-clang", "build"), none}, |
| 598 | {b("linux-amd64-sid", "build"), none}, |
Carlos Amedee | 4386493 | 2021-08-16 15:35:39 -0400 | [diff] [blame] | 599 | {b("linux-amd64-bullseye", "build"), none}, |
Brad Fitzpatrick | f6d512d | 2019-12-12 17:43:59 +0000 | [diff] [blame] | 600 | {b("linux-amd64-nocgo", "build"), none}, |
| 601 | {b("linux-386-longtest", "build"), none}, |
Brad Fitzpatrick | f6d512d | 2019-12-12 17:43:59 +0000 | [diff] [blame] | 602 | {b("js-wasm", "build"), none}, |
| 603 | {b("android-386-emu", "build"), none}, |
| 604 | {b("android-amd64-emu", "build"), none}, |
Brad Fitzpatrick | c8ca962 | 2019-12-07 05:14:28 +0000 | [diff] [blame] | 605 | |
Brad Fitzpatrick | 8a071d4 | 2019-03-18 16:48:22 +0000 | [diff] [blame] | 606 | // Only use latest macOS for subrepos, and only amd64: |
Carlos Amedee | 6469a76 | 2021-04-22 13:51:16 -0400 | [diff] [blame] | 607 | {b("darwin-amd64-10_12@go1.16", "net"), onlyPost}, |
| 608 | {b("darwin-amd64-10_12", "net"), none}, |
| 609 | {b("darwin-amd64-10_14", "net"), onlyPost}, |
Brad Fitzpatrick | 8bd8e0e | 2019-03-26 23:04:31 +0000 | [diff] [blame] | 610 | |
Carlos Amedee | d6dec9c | 2019-11-19 14:55:01 +0000 | [diff] [blame] | 611 | {b("darwin-amd64-10_15", "go"), onlyPost}, |
Brad Fitzpatrick | 8bd8e0e | 2019-03-26 23:04:31 +0000 | [diff] [blame] | 612 | {b("darwin-amd64-10_14", "go"), onlyPost}, |
Carlos Amedee | 6469a76 | 2021-04-22 13:51:16 -0400 | [diff] [blame] | 613 | {b("darwin-amd64-10_12", "go"), none}, |
| 614 | {b("darwin-amd64-10_12@go1.16", "go"), onlyPost}, |
Brad Fitzpatrick | 85a73d7 | 2019-04-03 04:45:29 +0000 | [diff] [blame] | 615 | |
Brad Fitzpatrick | 67073b9 | 2019-04-18 19:33:19 +0000 | [diff] [blame] | 616 | // plan9 only lived at master. We didn't support any past releases. |
| 617 | // But it's off for now as it's always failing. |
| 618 | {b("plan9-386", "go"), none}, // temporarily disabled |
| 619 | {b("plan9-386", "net"), none}, // temporarily disabled |
Tobias Klauser | 22d3b24 | 2019-11-28 11:33:00 +0100 | [diff] [blame] | 620 | {b("plan9-386", "exp"), none}, |
| 621 | {b("plan9-386", "mobile"), none}, |
Brad Fitzpatrick | f7a5fcf | 2019-04-03 05:03:37 +0000 | [diff] [blame] | 622 | {b("plan9-386@go1.12", "go"), none}, |
Brad Fitzpatrick | f7a5fcf | 2019-04-03 05:03:37 +0000 | [diff] [blame] | 623 | {b("plan9-386@go1.12", "net"), none}, |
David du Colombier | 9d71121 | 2021-04-05 20:42:05 +0200 | [diff] [blame] | 624 | {b("plan9-amd64-0intro", "go"), onlyPost}, |
| 625 | {b("plan9-amd64-0intro", "exp"), none}, |
| 626 | {b("plan9-amd64-0intro", "mobile"), none}, |
| 627 | {b("plan9-amd64-0intro@go1.12", "go"), none}, |
| 628 | {b("plan9-amd64-0intro", "net"), onlyPost}, |
| 629 | {b("plan9-amd64-0intro@go1.12", "net"), none}, |
Brad Fitzpatrick | f7a5fcf | 2019-04-03 05:03:37 +0000 | [diff] [blame] | 630 | {b("plan9-arm", "go"), onlyPost}, |
Tobias Klauser | 22d3b24 | 2019-11-28 11:33:00 +0100 | [diff] [blame] | 631 | {b("plan9-arm", "exp"), none}, |
| 632 | {b("plan9-arm", "mobile"), none}, |
Brad Fitzpatrick | f7a5fcf | 2019-04-03 05:03:37 +0000 | [diff] [blame] | 633 | {b("plan9-arm@go1.12", "go"), none}, |
| 634 | {b("plan9-arm", "net"), onlyPost}, |
Brad Fitzpatrick | f7a5fcf | 2019-04-03 05:03:37 +0000 | [diff] [blame] | 635 | {b("plan9-arm@go1.12", "net"), none}, |
Brad Fitzpatrick | d6a8c27 | 2019-04-05 05:26:05 +0000 | [diff] [blame] | 636 | |
Brad Fitzpatrick | 5877195 | 2019-10-21 15:00:32 +0000 | [diff] [blame] | 637 | {b("dragonfly-amd64", "go"), onlyPost}, |
| 638 | {b("dragonfly-amd64", "net"), onlyPost}, |
| 639 | {b("dragonfly-amd64@go1.13", "net"), none}, // Dragonfly ABI changes only supported by Go 1.14+ |
| 640 | {b("dragonfly-amd64@go1.13", "go"), none}, // Dragonfly ABI changes only supported by Go 1.14+ |
Dmitri Shuralyov | 77c96bb | 2020-03-19 10:34:11 -0400 | [diff] [blame] | 641 | |
| 642 | {b("linux-amd64-staticlockranking", "go"), onlyPost}, |
| 643 | {b("linux-amd64-staticlockranking@go1.15", "go"), onlyPost}, |
| 644 | {b("linux-amd64-staticlockranking@go1.14", "go"), none}, |
| 645 | {b("linux-amd64-staticlockranking", "net"), none}, |
Austin Clements | 8088608 | 2020-12-21 16:08:53 -0500 | [diff] [blame] | 646 | |
Matthew Dempsky | 4f8007b | 2021-08-12 15:11:41 -0700 | [diff] [blame] | 647 | {b("linux-amd64-unified", "go"), both}, |
| 648 | {b("linux-amd64-unified", "tools"), both}, |
Matthew Dempsky | df58bba | 2021-06-16 23:08:22 -0700 | [diff] [blame] | 649 | {b("linux-amd64-unified", "net"), none}, |
| 650 | {b("linux-amd64-unified@dev.typeparams", "go"), both}, |
| 651 | {b("linux-amd64-unified@dev.typeparams", "tools"), both}, |
| 652 | {b("linux-amd64-unified@dev.typeparams", "net"), none}, |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 653 | } |
| 654 | for _, tt := range tests { |
| 655 | t.Run(tt.br.testName, func(t *testing.T) { |
Dmitri Shuralyov | e0288b0 | 2021-05-07 17:26:04 -0400 | [diff] [blame] | 656 | // Require a want value that asserts both dimensions: try or not, post or not. |
| 657 | switch tt.want { |
| 658 | case none, both, onlyPost: |
| 659 | // OK. |
| 660 | default: |
| 661 | t.Fatalf("tt.want must be one of: none, both, or onlyPost") |
| 662 | } |
| 663 | |
Brad Fitzpatrick | 756764c | 2019-03-07 17:44:41 +0000 | [diff] [blame] | 664 | bc, ok := Builders[tt.br.builder] |
| 665 | if !ok { |
| 666 | t.Fatalf("unknown builder %q", tt.br.builder) |
| 667 | } |
| 668 | gotPost := bc.BuildsRepoPostSubmit(tt.br.repo, tt.br.branch, tt.br.goBranch) |
| 669 | if tt.want&isBuilder != 0 && !gotPost { |
| 670 | t.Errorf("not a post-submit builder, but expected") |
| 671 | } |
| 672 | if tt.want¬Builder != 0 && gotPost { |
| 673 | t.Errorf("unexpectedly a post-submit builder") |
| 674 | } |
| 675 | |
| 676 | gotTry := bc.BuildsRepoTryBot(tt.br.repo, tt.br.branch, tt.br.goBranch) |
| 677 | if tt.want&isTrybot != 0 && !gotTry { |
| 678 | t.Errorf("not trybot, but expected") |
| 679 | } |
| 680 | if tt.want¬Trybot != 0 && gotTry { |
| 681 | t.Errorf("unexpectedly a trybot") |
| 682 | } |
| 683 | |
| 684 | if t.Failed() { |
| 685 | t.Logf("For: %+v", tt.br) |
| 686 | } |
| 687 | }) |
| 688 | } |
Brad Fitzpatrick | c328d04 | 2017-04-12 00:35:37 +0000 | [diff] [blame] | 689 | } |
| 690 | |
| 691 | func TestHostConfigsAllUsed(t *testing.T) { |
Dmitri Shuralyov | 0768812 | 2020-08-04 12:01:34 -0400 | [diff] [blame] | 692 | knownUnused := map[string]bool{ |
| 693 | // Currently host-linux-armhf-cross and host-linux-armel-cross aren't |
| 694 | // referenced, but the coordinator hard-codes them, so don't make |
| 695 | // these two an error for now. |
| 696 | "host-linux-armhf-cross": true, |
| 697 | "host-linux-armel-cross": true, |
| 698 | |
| 699 | "host-linux-x86-alpine": true, // TODO(golang.org/issue/19938): Fix the Alpine builder, or remove it. |
Dmitri Shuralyov | 0768812 | 2020-08-04 12:01:34 -0400 | [diff] [blame] | 700 | } |
| 701 | |
| 702 | used := make(map[string]bool) |
Brad Fitzpatrick | c328d04 | 2017-04-12 00:35:37 +0000 | [diff] [blame] | 703 | for _, conf := range Builders { |
| 704 | used[conf.HostType] = true |
| 705 | } |
| 706 | for hostType := range Hosts { |
Dmitri Shuralyov | 0768812 | 2020-08-04 12:01:34 -0400 | [diff] [blame] | 707 | if !used[hostType] && !knownUnused[hostType] { |
| 708 | t.Errorf("host type %q is not referenced from any build config", hostType) |
| 709 | } |
| 710 | if used[hostType] && knownUnused[hostType] { |
| 711 | t.Errorf("host type %q should not be listed in knownUnused since it's in use", hostType) |
Brad Fitzpatrick | c328d04 | 2017-04-12 00:35:37 +0000 | [diff] [blame] | 712 | } |
| 713 | } |
| 714 | } |
Brad Fitzpatrick | 8665028 | 2019-03-11 18:49:56 +0000 | [diff] [blame] | 715 | |
Dmitri Shuralyov | 2891c2e | 2021-11-16 12:42:29 -0500 | [diff] [blame] | 716 | // Test that all specified builder owners are non-nil. |
| 717 | func TestBuilderOwners(t *testing.T) { |
| 718 | for host, config := range Hosts { |
| 719 | for i, p := range config.Owners { |
| 720 | if p == nil { |
| 721 | t.Errorf("dashboard.Hosts[%q].Owners[%d] is nil, want non-nil", host, i) |
| 722 | } |
| 723 | } |
| 724 | } |
| 725 | } |
| 726 | |
Brad Fitzpatrick | 8665028 | 2019-03-11 18:49:56 +0000 | [diff] [blame] | 727 | // tests that goBranch is optional for repo == "go" |
| 728 | func TestBuildsRepoAtAllImplicitGoBranch(t *testing.T) { |
| 729 | builder := Builders["android-amd64-emu"] |
| 730 | got := builder.buildsRepoAtAll("go", "master", "") |
| 731 | if !got { |
| 732 | t.Error("got = false; want true") |
| 733 | } |
| 734 | } |
Brad Fitzpatrick | 43eb39e | 2019-04-02 15:27:10 +0000 | [diff] [blame] | 735 | |
| 736 | func TestShouldRunDistTest(t *testing.T) { |
| 737 | type buildMode int |
| 738 | const ( |
| 739 | tryMode buildMode = 0 |
| 740 | postSubmit buildMode = 1 |
| 741 | ) |
| 742 | |
| 743 | tests := []struct { |
| 744 | builder string |
| 745 | test string |
| 746 | mode buildMode |
| 747 | want bool |
| 748 | }{ |
| 749 | {"linux-amd64", "api", postSubmit, true}, |
| 750 | {"linux-amd64", "api", tryMode, true}, |
Carlos Amedee | 2ecf424 | 2021-04-23 11:33:51 -0400 | [diff] [blame] | 751 | {"freebsd-amd64-12_2", "api", postSubmit, true}, // freebsd-amd64-12_2 uses fasterTrybots policy, should still build. |
| 752 | {"freebsd-amd64-12_2", "api", tryMode, false}, // freebsd-amd64-12_2 uses fasterTrybots policy, should skip in try mode. |
Brad Fitzpatrick | 43eb39e | 2019-04-02 15:27:10 +0000 | [diff] [blame] | 753 | |
| 754 | {"linux-amd64", "reboot", tryMode, true}, |
| 755 | {"linux-amd64-race", "reboot", tryMode, false}, |
| 756 | |
Brad Fitzpatrick | 43eb39e | 2019-04-02 15:27:10 +0000 | [diff] [blame] | 757 | {"darwin-amd64-10_12", "test:foo", postSubmit, false}, |
| 758 | {"darwin-amd64-10_14", "test:foo", postSubmit, false}, |
Brad Fitzpatrick | 43eb39e | 2019-04-02 15:27:10 +0000 | [diff] [blame] | 759 | {"darwin-amd64-10_14", "reboot", postSubmit, false}, |
| 760 | {"darwin-amd64-10_14", "api", postSubmit, false}, |
| 761 | {"darwin-amd64-10_14", "codewalk", postSubmit, false}, |
Carlos Amedee | d6dec9c | 2019-11-19 14:55:01 +0000 | [diff] [blame] | 762 | {"darwin-amd64-10_15", "test:foo", postSubmit, false}, |
Brad Fitzpatrick | 43eb39e | 2019-04-02 15:27:10 +0000 | [diff] [blame] | 763 | } |
| 764 | for _, tt := range tests { |
| 765 | bc, ok := Builders[tt.builder] |
| 766 | if !ok { |
| 767 | t.Errorf("unknown builder %q", tt.builder) |
| 768 | continue |
| 769 | } |
| 770 | isTry := tt.mode == tryMode |
| 771 | if isTry && !bc.BuildsRepoTryBot("go", "master", "master") { |
| 772 | t.Errorf("builder %q is not a trybot, so can't run test %q in try mode", tt.builder, tt.test) |
| 773 | continue |
| 774 | } |
| 775 | got := bc.ShouldRunDistTest(tt.test, isTry) |
| 776 | if got != tt.want { |
| 777 | t.Errorf("%q.ShouldRunDistTest(%q, try %v) = %v; want %v", tt.builder, tt.test, isTry, got, tt.want) |
| 778 | } |
| 779 | } |
| 780 | } |
Dmitri Shuralyov | 01fd299 | 2019-09-09 16:48:08 -0400 | [diff] [blame] | 781 | |
Brad Fitzpatrick | aab8504 | 2019-10-16 06:02:29 +0000 | [diff] [blame] | 782 | func TestSlowBotAliases(t *testing.T) { |
| 783 | for term, name := range slowBotAliases { |
| 784 | if name == "" { |
| 785 | // Empty string means known missing builder. |
| 786 | continue |
| 787 | } |
| 788 | if _, ok := Builders[name]; !ok { |
| 789 | t.Errorf("slowbot term %q references unknown builder %q", term, name) |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | out, err := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "tool", "dist", "list").Output() |
| 794 | if err != nil { |
| 795 | t.Errorf("dist list: %v", err) |
| 796 | } |
| 797 | ports := strings.Fields(string(out)) |
| 798 | |
| 799 | done := map[string]bool{} |
Carlos Amedee | 3e01d87 | 2020-04-22 18:52:59 -0400 | [diff] [blame] | 800 | |
Brad Fitzpatrick | aab8504 | 2019-10-16 06:02:29 +0000 | [diff] [blame] | 801 | var add bytes.Buffer |
| 802 | check := func(term string, isArch bool) { |
| 803 | if done[term] { |
| 804 | return |
| 805 | } |
| 806 | done[term] = true |
| 807 | _, isBuilderName := Builders[term] |
| 808 | _, hasAlias := slowBotAliases[term] |
| 809 | if !isBuilderName && !hasAlias { |
| 810 | prefix := term |
| 811 | if isArch { |
| 812 | prefix = "linux-" + term |
| 813 | } |
| 814 | var matches []string |
| 815 | for name := range Builders { |
| 816 | if strings.HasPrefix(name, prefix) { |
| 817 | matches = append(matches, name) |
| 818 | } |
| 819 | } |
| 820 | sort.Strings(matches) |
| 821 | t.Errorf("term %q has no match in slowBotAliases", term) |
| 822 | if len(matches) == 1 { |
| 823 | fmt.Fprintf(&add, "%q: %q,\n", term, matches[0]) |
| 824 | } else if len(matches) > 1 { |
| 825 | t.Errorf("maybe add: %q: %q, (matches=%q)", term, matches[len(matches)-1], matches) |
| 826 | } |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | for _, port := range ports { |
| 831 | slash := strings.IndexByte(port, '/') |
| 832 | if slash == -1 { |
| 833 | t.Fatalf("unexpected port %q", port) |
| 834 | } |
| 835 | goos, goarch := port[:slash], port[slash+1:] |
| 836 | check(goos+"-"+goarch, false) |
| 837 | check(goos, false) |
| 838 | check(goarch, true) |
| 839 | } |
| 840 | |
| 841 | if add.Len() > 0 { |
| 842 | t.Errorf("Missing items from slowBotAliases:\n%s", add.String()) |
| 843 | } |
| 844 | } |
Brad Fitzpatrick | ad7af46 | 2019-10-19 02:49:53 +0000 | [diff] [blame] | 845 | |
| 846 | func TestCrossCompileConfigs(t *testing.T) { |
| 847 | // Verify that Builders.CrossCompileConfig have valid host types. |
| 848 | for name, bc := range Builders { |
| 849 | cc := bc.CrossCompileConfig |
| 850 | if cc == nil { |
| 851 | continue |
| 852 | } |
| 853 | if _, ok := Hosts[cc.CompileHostType]; !ok { |
| 854 | t.Errorf("unknown host type %q for builder %q", cc.CompileHostType, name) |
| 855 | } |
| 856 | } |
| 857 | } |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 858 | |
Dmitri Shuralyov | 646d48d | 2021-04-23 16:56:37 -0400 | [diff] [blame] | 859 | // TestTryBotsCompileAllPorts verifies that each port (go tool dist list) |
| 860 | // is covered by either a real TryBot or a misc-compile TryBot. |
| 861 | // |
| 862 | // The special pseudo-port 'linux-arm-arm5' is tested in TestMiscCompileLinuxGOARM5. |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 863 | func TestTryBotsCompileAllPorts(t *testing.T) { |
| 864 | out, err := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "tool", "dist", "list").Output() |
| 865 | if err != nil { |
| 866 | t.Errorf("dist list: %v", err) |
| 867 | } |
| 868 | ports := strings.Fields(string(out)) |
| 869 | |
Dmitri Shuralyov | ca01712 | 2021-04-23 14:08:15 -0400 | [diff] [blame] | 870 | // knownMissing tracks Go ports that that are known to be |
| 871 | // completely missing TryBot (pre-submit) test coverage. |
| 872 | // |
Dmitri Shuralyov | f9ec3ca | 2021-04-27 15:33:27 -0400 | [diff] [blame] | 873 | // All completed ports should have either a real TryBot or at least a misc-compile TryBot, |
Dmitri Shuralyov | ca01712 | 2021-04-23 14:08:15 -0400 | [diff] [blame] | 874 | // so this map is meant to be used to temporarily fix tests |
| 875 | // when the work of adding a new port is actively underway. |
Dmitri Shuralyov | f9ec3ca | 2021-04-27 15:33:27 -0400 | [diff] [blame] | 876 | knownMissing := map[string]bool{} |
Dmitri Shuralyov | ca01712 | 2021-04-23 14:08:15 -0400 | [diff] [blame] | 877 | |
| 878 | var done = make(map[string]bool) |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 879 | check := func(goos, goarch string) { |
Dmitri Shuralyov | 55e1ef6 | 2020-09-28 11:04:35 -0400 | [diff] [blame] | 880 | if goos == "android" || goos == "ios" { |
Brad Fitzpatrick | 8a3c1d9 | 2019-11-15 04:29:29 +0000 | [diff] [blame] | 881 | // TODO(golang.org/issue/25963): support |
Dmitri Shuralyov | 55e1ef6 | 2020-09-28 11:04:35 -0400 | [diff] [blame] | 882 | // compilation-only Android and iOS trybots. |
Brad Fitzpatrick | 8a3c1d9 | 2019-11-15 04:29:29 +0000 | [diff] [blame] | 883 | // buildall.bash doesn't set the environment |
| 884 | // up enough for e.g. compiling android-386 |
| 885 | // from linux-amd64. (Issue #35596 too) |
Dmitri Shuralyov | 55e1ef6 | 2020-09-28 11:04:35 -0400 | [diff] [blame] | 886 | // iOS likely needs to be built on macOS |
| 887 | // with Xcode available. |
Brad Fitzpatrick | 8a3c1d9 | 2019-11-15 04:29:29 +0000 | [diff] [blame] | 888 | return |
| 889 | } |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 890 | goosArch := goos + "-" + goarch |
| 891 | if done[goosArch] { |
| 892 | return |
| 893 | } |
| 894 | for _, conf := range Builders { |
Dmitri Shuralyov | 2e5c6aa | 2021-04-26 15:33:46 -0400 | [diff] [blame] | 895 | if conf.GOOS() == goos && conf.GOARCH() == goarch && |
| 896 | conf.BuildsRepoTryBot("go", "master", "master") { |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 897 | |
Dmitri Shuralyov | 2e5c6aa | 2021-04-26 15:33:46 -0400 | [diff] [blame] | 898 | // There's a real TryBot for this GOOS/GOARCH pair. |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 899 | done[goosArch] = true |
| 900 | break |
| 901 | } |
| 902 | |
| 903 | if strings.HasPrefix(conf.Name, "misc-compile-") { |
| 904 | re, err := regexp.Compile(conf.allScriptArgs[0]) |
| 905 | if err != nil { |
Dmitri Shuralyov | 2e5c6aa | 2021-04-26 15:33:46 -0400 | [diff] [blame] | 906 | t.Fatalf("invalid misc-compile filtering pattern for builder %q: %q", |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 907 | conf.Name, conf.allScriptArgs[0]) |
| 908 | } |
Dmitri Shuralyov | 2e5c6aa | 2021-04-26 15:33:46 -0400 | [diff] [blame] | 909 | if re.MatchString(goosArch) { |
| 910 | // There's a misc-compile TryBot for this GOOS/GOARCH pair. |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 911 | done[goosArch] = true |
| 912 | break |
| 913 | } |
| 914 | } |
| 915 | } |
Dmitri Shuralyov | ca01712 | 2021-04-23 14:08:15 -0400 | [diff] [blame] | 916 | if knownMissing[goosArch] && done[goosArch] { |
| 917 | // Make it visible when a builder is added but the old |
| 918 | // knownMissing entry isn't removed by failing the test. |
| 919 | t.Errorf("knownMissing[%q] is true, but a corresponding TryBot (real or misc-compile) exists", goosArch) |
| 920 | } else if _, ok := done[goosArch]; !ok && !knownMissing[goosArch] { |
| 921 | t.Errorf("missing real TryBot or misc-compile TryBot for %q", goosArch) |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 922 | } |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 923 | } |
| 924 | |
| 925 | for _, port := range ports { |
| 926 | slash := strings.IndexByte(port, '/') |
| 927 | if slash == -1 { |
| 928 | t.Fatalf("unexpected port %q", port) |
| 929 | } |
| 930 | check(port[:slash], port[slash+1:]) |
| 931 | } |
Tobias Klauser | cd82ecd | 2019-11-07 14:15:55 +0100 | [diff] [blame] | 932 | } |
Carlos Amedee | d6dec9c | 2019-11-19 14:55:01 +0000 | [diff] [blame] | 933 | |
Dmitri Shuralyov | 646d48d | 2021-04-23 16:56:37 -0400 | [diff] [blame] | 934 | // The 'linux-arm-arm5' pseduo-port is supported by src/buildall.bash |
| 935 | // and tests linux/arm with GOARM=5 set. Since it's not a normal port, |
| 936 | // the TestTryBotsCompileAllPorts wouldn't report if the misc-compile |
| 937 | // TryBot that covers is is accidentally removed. Check it explicitly. |
| 938 | func TestMiscCompileLinuxGOARM5(t *testing.T) { |
| 939 | var ok bool |
| 940 | for _, b := range Builders { |
| 941 | if !strings.HasPrefix(b.Name, "misc-compile-") { |
| 942 | continue |
| 943 | } |
| 944 | re, err := regexp.Compile(b.allScriptArgs[0]) |
| 945 | if err != nil { |
| 946 | t.Fatalf("invalid misc-compile filtering pattern for builder %q: %q", |
| 947 | b.Name, b.allScriptArgs[0]) |
| 948 | } |
| 949 | if re.MatchString("linux-arm-arm5") { |
| 950 | ok = true |
| 951 | break |
| 952 | } |
| 953 | } |
| 954 | if !ok { |
| 955 | // We get here if the linux-arm-arm5 port is no longer checked by |
| 956 | // a misc-compile TryBot. Report it as a failure in case the coverage |
| 957 | // was removed accidentally (e.g., as part of a refactor). |
| 958 | t.Errorf("no misc-compile TryBot coverage for the special 'linux-arm-arm5' pseudo-port") |
| 959 | } |
| 960 | } |
| 961 | |
Carlos Amedee | d6dec9c | 2019-11-19 14:55:01 +0000 | [diff] [blame] | 962 | // TestExpectedMacstadiumVMCount ensures that only 20 instances of macOS virtual machines |
| 963 | // are expected at MacStadium. |
| 964 | // TODO: remove once the scheduler allocates VMs based on demand https://golang.org/issue/35698 |
| 965 | func TestExpectedMacstadiumVMCount(t *testing.T) { |
| 966 | got := 0 |
| 967 | for host, config := range Hosts { |
Carlos Amedee | d576fd3 | 2021-01-29 15:47:13 -0500 | [diff] [blame] | 968 | if strings.HasPrefix(host, "host-darwin-10_") || strings.HasPrefix(host, "host-darwin-amd64-") { |
Carlos Amedee | d6dec9c | 2019-11-19 14:55:01 +0000 | [diff] [blame] | 969 | got += config.ExpectNum |
| 970 | } |
| 971 | } |
Carlos Amedee | b7678aa | 2021-04-06 11:28:57 -0400 | [diff] [blame] | 972 | if got != 16 { |
| 973 | t.Fatalf("macstadium host count: got %d; want 16", got) |
Carlos Amedee | d6dec9c | 2019-11-19 14:55:01 +0000 | [diff] [blame] | 974 | } |
| 975 | } |
Dmitri Shuralyov | df328b1 | 2020-05-13 14:30:25 -0400 | [diff] [blame] | 976 | |
| 977 | // Test that we have a longtest builder and |
| 978 | // that its environment configuration is okay. |
| 979 | func TestLongTestBuilder(t *testing.T) { |
| 980 | long, ok := Builders["linux-amd64-longtest"] |
| 981 | if !ok { |
| 982 | t.Fatal("we don't have a linux-amd64-longtest builder anymore, is that intentional?") |
| 983 | } |
| 984 | if !long.IsLongTest() { |
| 985 | t.Error("the linux-amd64-longtest builder isn't a longtest builder, is that intentional?") |
| 986 | } |
| 987 | var shortDisabled bool |
| 988 | for _, e := range long.Env() { |
| 989 | if e == "GO_TEST_SHORT=0" { |
| 990 | shortDisabled = true |
| 991 | } |
| 992 | } |
| 993 | if !shortDisabled { |
| 994 | t.Error("the linux-amd64-longtest builder doesn't set GO_TEST_SHORT=0, is that intentional?") |
| 995 | } |
| 996 | } |
Carlos Amedee | d77c6d0 | 2020-08-18 13:32:05 -0400 | [diff] [blame] | 997 | |
| 998 | func TestHostConfigIsVM(t *testing.T) { |
| 999 | testCases := []struct { |
| 1000 | desc string |
| 1001 | config *HostConfig |
| 1002 | want bool |
| 1003 | }{ |
| 1004 | { |
| 1005 | desc: "non-ec2-vm", |
| 1006 | config: &HostConfig{ |
| 1007 | VMImage: "image-x", |
| 1008 | ContainerImage: "", |
| 1009 | isEC2: false, |
| 1010 | }, |
| 1011 | want: true, |
| 1012 | }, |
| 1013 | { |
| 1014 | desc: "non-ec2-container", |
| 1015 | config: &HostConfig{ |
| 1016 | VMImage: "", |
| 1017 | ContainerImage: "container-image-x", |
| 1018 | isEC2: false, |
| 1019 | }, |
| 1020 | want: false, |
| 1021 | }, |
| 1022 | { |
| 1023 | desc: "ec2-container", |
| 1024 | config: &HostConfig{ |
| 1025 | VMImage: "image-x", |
| 1026 | ContainerImage: "container-image-x", |
| 1027 | isEC2: true, |
| 1028 | }, |
| 1029 | want: false, |
| 1030 | }, |
| 1031 | { |
| 1032 | desc: "ec2-vm", |
| 1033 | config: &HostConfig{ |
| 1034 | VMImage: "image-x", |
| 1035 | ContainerImage: "", |
| 1036 | isEC2: true, |
| 1037 | }, |
| 1038 | want: true, |
| 1039 | }, |
| 1040 | } |
| 1041 | for _, tc := range testCases { |
| 1042 | t.Run(fmt.Sprintf(tc.desc), func(t *testing.T) { |
| 1043 | if got := tc.config.IsVM(); got != tc.want { |
| 1044 | t.Errorf("HostConfig.IsVM() = %t; want %t", got, tc.want) |
| 1045 | } |
| 1046 | }) |
| 1047 | } |
| 1048 | } |
Carlos Amedee | 1e76199 | 2020-08-20 11:53:58 -0400 | [diff] [blame] | 1049 | |
| 1050 | func TestModulesEnv(t *testing.T) { |
| 1051 | testCases := []struct { |
| 1052 | desc string |
| 1053 | buildConfig *BuildConfig |
| 1054 | repo string |
| 1055 | want []string |
| 1056 | }{ |
| 1057 | { |
| 1058 | desc: "ec2-builder-repo-non-go", |
| 1059 | buildConfig: &BuildConfig{ |
| 1060 | testHostConf: &HostConfig{ |
| 1061 | IsReverse: false, |
| 1062 | isEC2: true, |
| 1063 | }, |
| 1064 | }, |
| 1065 | repo: "bar", |
| 1066 | want: []string{"GOPROXY=https://proxy.golang.org"}, |
| 1067 | }, |
| 1068 | { |
| 1069 | desc: "reverse-builder-repo-non-go", |
| 1070 | buildConfig: &BuildConfig{ |
| 1071 | testHostConf: &HostConfig{ |
| 1072 | IsReverse: true, |
| 1073 | isEC2: false, |
| 1074 | }, |
| 1075 | }, |
| 1076 | repo: "bar", |
| 1077 | want: []string{"GOPROXY=https://proxy.golang.org"}, |
| 1078 | }, |
| 1079 | { |
| 1080 | desc: "reverse-builder-repo-go", |
| 1081 | buildConfig: &BuildConfig{ |
| 1082 | testHostConf: &HostConfig{ |
| 1083 | IsReverse: true, |
| 1084 | isEC2: false, |
| 1085 | }, |
| 1086 | }, |
| 1087 | repo: "go", |
| 1088 | want: []string{"GOPROXY=off"}, |
| 1089 | }, |
| 1090 | { |
| 1091 | desc: "builder-repo-go", |
| 1092 | buildConfig: &BuildConfig{ |
| 1093 | testHostConf: &HostConfig{ |
| 1094 | IsReverse: false, |
| 1095 | isEC2: false, |
| 1096 | }, |
| 1097 | }, |
| 1098 | repo: "go", |
| 1099 | want: []string{"GOPROXY=off"}, |
| 1100 | }, |
| 1101 | { |
| 1102 | desc: "builder-repo-go-outbound-network-allowed", |
| 1103 | buildConfig: &BuildConfig{ |
| 1104 | Name: "test-longtest", |
| 1105 | testHostConf: &HostConfig{ |
| 1106 | IsReverse: false, |
| 1107 | isEC2: false, |
| 1108 | }, |
| 1109 | }, |
| 1110 | repo: "go", |
| 1111 | want: nil, |
| 1112 | }, |
| 1113 | { |
| 1114 | desc: "builder-repo-special-case", |
| 1115 | buildConfig: &BuildConfig{ |
| 1116 | testHostConf: &HostConfig{ |
| 1117 | IsReverse: false, |
| 1118 | isEC2: false, |
| 1119 | }, |
| 1120 | }, |
| 1121 | repo: "build", |
| 1122 | want: []string{"GO111MODULE=on"}, |
| 1123 | }, |
| 1124 | { |
| 1125 | desc: "reverse-builder-repo-special-case", |
| 1126 | buildConfig: &BuildConfig{ |
| 1127 | testHostConf: &HostConfig{ |
| 1128 | IsReverse: true, |
| 1129 | isEC2: false, |
| 1130 | }, |
| 1131 | }, |
| 1132 | repo: "build", |
| 1133 | want: []string{"GOPROXY=https://proxy.golang.org", "GO111MODULE=on"}, |
| 1134 | }, |
| 1135 | { |
| 1136 | desc: "builder-repo-non-special-case", |
| 1137 | buildConfig: &BuildConfig{ |
| 1138 | testHostConf: &HostConfig{ |
| 1139 | IsReverse: false, |
| 1140 | isEC2: false, |
| 1141 | }, |
| 1142 | }, |
| 1143 | repo: "bar", |
| 1144 | want: nil, |
| 1145 | }, |
| 1146 | } |
| 1147 | for _, tc := range testCases { |
| 1148 | t.Run(tc.desc, func(t *testing.T) { |
| 1149 | got := tc.buildConfig.ModulesEnv(tc.repo) |
| 1150 | if diff := cmp.Diff(tc.want, got); diff != "" { |
| 1151 | t.Errorf("BuildConfig.ModulesEnv(%q) mismatch (-want, +got)\n%s", tc.repo, diff) |
| 1152 | } |
| 1153 | }) |
| 1154 | } |
| 1155 | } |