dashboard: add test post-submit misc-compile builders for subrepos

This change adds experimental post-submit misc-compile builders for
subrepos only.

For golang/go#58163.

Change-Id: I05e78a3aeefb62669afc364ae04c67d358af80c3
Reviewed-on: https://go-review.googlesource.com/c/build/+/464957
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Michael Anthony Knyszek 2023-02-02 19:11:23 +00:00 коммит произвёл Michael Knyszek
Родитель 0962551575
Коммит a695691b42
3 изменённых файлов: 132 добавлений и 19 удалений

Просмотреть файл

@ -1049,15 +1049,21 @@ func (st *buildStatus) runSubrepoTests() (remoteErr, err error) {
env = append(env, st.conf.ModulesEnv(st.SubName)...)
args := []string{"test"}
if !st.conf.IsLongTest() {
args = append(args, "-short")
}
if st.conf.IsRace() {
args = append(args, "-race")
}
if scale := st.conf.GoTestTimeoutScale(); scale != 1 {
const goTestDefaultTimeout = 10 * time.Minute // Default value taken from Go 1.20.
args = append(args, "-timeout="+(goTestDefaultTimeout*time.Duration(scale)).String())
if st.conf.CompileOnly {
// Build all packages, but avoid running the binary by executing /bin/true for the tests.
// We assume for a compile-only build we're just running on a Linux system.
args = append(args, "-exec", "/bin/true")
} else {
if !st.conf.IsLongTest() {
args = append(args, "-short")
}
if st.conf.IsRace() {
args = append(args, "-race")
}
if scale := st.conf.GoTestTimeoutScale(); scale != 1 {
const goTestDefaultTimeout = 10 * time.Minute // Default value taken from Go 1.20.
args = append(args, "-timeout="+(goTestDefaultTimeout*time.Duration(scale)).String())
}
}
var remoteErrors []error

Просмотреть файл

@ -741,6 +741,9 @@ type BuildConfig struct {
// Note that this will not prevent the test binary from running for tests
// for the main Go repo, so this flag is insufficient for disabling
// tests in a cross-compiled setting. See #58297.
//
// For subrepo tests however, this flag is sufficient to ensure that test
// binaries will only be built, not executed.
CompileOnly bool
// FlakyNet indicates that network tests are flaky on this builder.
@ -1222,10 +1225,6 @@ func (c *BuildConfig) buildsRepoAtAll(repo, branch, goBranch string) bool {
return false
}
}
if repo != "go" && c.IsCrossCompileOnly() {
// Cross-compiling builders are explicitly disabled for subrepo builds for now.
return false
}
if p := c.buildsRepo; p != nil {
return p(repo, branch, goBranch)
}
@ -1458,6 +1457,44 @@ func explicitTrySet(projs ...string) func(proj, branch, goBranch string) bool {
}
}
// crossCompileBuildSet returns a policy function that reports whether a project
// should use trybots based on the platform.
func crossCompileBuildSet(goos, goarch string) func(proj, branch, goBranch string) bool {
return func(proj, branch, goBranch string) bool {
if branch != "master" {
// TODO(#58163): Remove this once we finish testing misc-compile builders for subrepos.
return false
}
switch proj {
case "go":
// TODO(#58163): Remove this once we finish testing misc-compile builders for subrepos.
return false
case "benchmarks":
return goarch != "loong64" // #58306
case "build":
return goarch != "riscv64" // #58307
case "exp":
// exp fails to build most cross-compile platforms, partly because of x/mobile dependencies.
return false
case "mobile":
// mobile fails to build on all cross-compile platforms. This is somewhat expected
// given the nature of the repository. Leave this as a blanket policy for now.
return false
case "pkgsite-metrics":
return goos != "aix" && goos != "solaris" // #58301
case "vuln":
// Failure to build because of a dependency not supported on plan9.
return goos != "plan9"
case "vulndb":
return goos != "aix" // #58308
case "website":
// Failure to build because of a dependency not supported on plan9.
return goos != "plan9"
}
return true
}
}
func init() {
addBuilder(BuildConfig{
Name: "freebsd-amd64-12_3",
@ -1569,7 +1606,7 @@ func init() {
addBuilder(BuildConfig{
Name: "misc-compile-" + platform,
HostType: "host-linux-amd64-bullseye",
tryBot: defaultTrySet(),
tryBot: onlyGo,
env: append(extraEnv, "GO_DISABLE_OUTBOUND_NETWORK=1", "GOOS="+goos, "GOARCH="+goarch),
tryOnly: true,
MinimumGoVersion: v,
@ -1625,6 +1662,39 @@ func init() {
addMiscCompileGo1(0, "linux", "arm", "-arm5", "GOARM=5")
addMiscCompileGo1(20, "freebsd", "riscv64", "-go1.20")
tryNewMiscCompileForSubrepos("windows", "arm", "", 58163, nil)
tryNewMiscCompileForSubrepos("windows", "arm64", "", 58163, nil)
tryNewMiscCompileForSubrepos("darwin", "amd64", "", 58163, nil)
tryNewMiscCompileForSubrepos("darwin", "arm64", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "mips", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "mips64", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "mipsle", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "mips64le", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "ppc64", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "ppc64le", "", 58163, nil)
tryNewMiscCompileForSubrepos("aix", "ppc64", "", 58163, nil)
tryNewMiscCompileForSubrepos("freebsd", "386", "", 58163, nil)
tryNewMiscCompileForSubrepos("freebsd", "arm", "", 58163, nil)
tryNewMiscCompileForSubrepos("freebsd", "arm64", "", 58163, nil)
tryNewMiscCompileForSubrepos("netbsd", "386", "", 58163, nil)
tryNewMiscCompileForSubrepos("netbsd", "amd64", "", 58163, nil)
tryNewMiscCompileForSubrepos("netbsd", "arm", "", 58163, nil)
tryNewMiscCompileForSubrepos("netbsd", "arm64", "", 58163, nil)
tryNewMiscCompileForSubrepos("openbsd", "386", "", 58163, nil)
tryNewMiscCompileForSubrepos("openbsd", "arm", "", 58163, nil)
tryNewMiscCompileForSubrepos("openbsd", "arm64", "", 58163, nil)
tryNewMiscCompileForSubrepos("plan9", "386", "", 58163, nil)
tryNewMiscCompileForSubrepos("plan9", "amd64", "", 58163, nil)
tryNewMiscCompileForSubrepos("plan9", "arm", "", 58163, nil)
tryNewMiscCompileForSubrepos("solaris", "amd64", "", 58163, nil)
tryNewMiscCompileForSubrepos("illumos", "amd64", "", 58163, nil)
tryNewMiscCompileForSubrepos("dragonfly", "amd64", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "loong64", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "riscv64", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "s390x", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "arm", "", 58163, nil)
tryNewMiscCompileForSubrepos("linux", "arm", "-arm5", 58163, nil, "GOARM=5")
// TODO: Issue 25963, get the misc-compile trybots for Android/iOS.
// Then consider subrepos too, so "mobile" can at least be included
// as a misc-compile for ^android- and ^ios-.
@ -3033,25 +3103,30 @@ func addBuilder(c BuildConfig) {
Builders[c.Name] = &c
}
// tryNewMiscCompile is an intermediate step towards adding a real addMiscCompile TryBot.
// tryNewMiscCompileForSubrepos is an intermediate step towards adding a real addMiscCompile TryBot
// for only subrepos.
//
// It adds a post-submit-only builder with KnownIssue, GoDeps set to the provided values,
// and runs on a limited set of branches to get test results without potential disruption
// for contributors. It can be modified as needed when onboarding a misc-compile builder.
func tryNewMiscCompile(goos, goarch, extraSuffix string, knownIssue int, goDeps []string, extraEnv ...string) {
//
// TODO(#58163): This function is supposed to be for all repos, but while we set up misc-compile
// builders for subrepos we first only want to add it as a post-submit builder.
func tryNewMiscCompileForSubrepos(goos, goarch, extraSuffix string, knownIssue int, goDeps []string, extraEnv ...string) {
if knownIssue == 0 {
panic("tryNewMiscCompile: knownIssue parameter must be non-zero")
}
platform := goos + "-" + goarch + extraSuffix
addBuilder(BuildConfig{
Name: "misc-compile-" + platform,
Name: "misc-compile-" + platform + "-subrepo",
HostType: "host-linux-amd64-bullseye",
buildsRepo: func(repo, branch, goBranch string) bool { return repo == "go" && branch == "master" },
buildsRepo: crossCompileBuildSet(goos, goarch),
KnownIssues: []int{knownIssue},
GoDeps: goDeps,
env: append(extraEnv, "GOOS="+goos, "GOARCH="+goarch, "GO_DISABLE_OUTBOUND_NETWORK=1"),
CompileOnly: true,
SkipSnapshot: true,
Notes: fmt.Sprintf("Tries make.bash for "+platform+" See go.dev/issue/%d.", knownIssue),
Notes: fmt.Sprintf("Tries make.bash (or compile-only go test) for "+platform+" See go.dev/issue/%d.", knownIssue),
})
}

Просмотреть файл

@ -397,6 +397,38 @@ func TestPostSubmit(t *testing.T) {
want: []string{
"linux-amd64",
"linux-amd64-longtest",
"misc-compile-windows-arm-subrepo",
"misc-compile-windows-arm64-subrepo",
"misc-compile-darwin-amd64-subrepo",
"misc-compile-darwin-arm64-subrepo",
"misc-compile-linux-mips-subrepo",
"misc-compile-linux-mips64-subrepo",
"misc-compile-linux-mipsle-subrepo",
"misc-compile-linux-mips64le-subrepo",
"misc-compile-linux-ppc64-subrepo",
"misc-compile-linux-ppc64le-subrepo",
"misc-compile-freebsd-386-subrepo",
"misc-compile-freebsd-arm-subrepo",
"misc-compile-freebsd-arm64-subrepo",
"misc-compile-netbsd-386-subrepo",
"misc-compile-netbsd-amd64-subrepo",
"misc-compile-netbsd-arm-subrepo",
"misc-compile-netbsd-arm64-subrepo",
"misc-compile-openbsd-386-subrepo",
"misc-compile-openbsd-arm-subrepo",
"misc-compile-openbsd-arm64-subrepo",
"misc-compile-plan9-386-subrepo",
"misc-compile-plan9-amd64-subrepo",
"misc-compile-plan9-arm-subrepo",
"misc-compile-solaris-amd64-subrepo",
"misc-compile-illumos-amd64-subrepo",
"misc-compile-dragonfly-amd64-subrepo",
"misc-compile-linux-loong64-subrepo",
"misc-compile-linux-riscv64-subrepo",
"misc-compile-linux-s390x-subrepo",
"misc-compile-linux-arm-subrepo",
"misc-compile-linux-arm-arm5-subrepo",
},
},
}