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