зеркало из https://github.com/golang/build.git
cmd/coordinator: scale go test timeout by GO_TEST_TIMEOUT_SCALE
Previously, this environment variable was used to scale test timeout only in the main repository. Use it when running go test on packages in other repositories too. This unfortunately means that if some tests get so slow that they timeout with the default go test timeout value, builders that use timeout scale will not report such findings. Hopefully most builders are as fast as viable, and timeout scaling is only used when there's no other viable alternative. Fixes golang/go#56968. Change-Id: I84d5ab504c1bd808815ec5962f713d71dfec6758 Reviewed-on: https://go-review.googlesource.com/c/build/+/453975 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Родитель
270d707cc9
Коммит
a3014a8eb6
|
@ -1084,6 +1084,10 @@ func (st *buildStatus) runSubrepoTests() (remoteErr, err error) {
|
|||
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
|
||||
for _, tr := range testRuns {
|
||||
|
|
|
@ -963,12 +963,12 @@ func (c *BuildConfig) DistTestsExecTimeout(distTests []string) time.Duration {
|
|||
// up into separate dist tests or shards, like the test/ dir
|
||||
// was)
|
||||
d := 20 * time.Minute
|
||||
d *= time.Duration(c.timeoutScale())
|
||||
d *= time.Duration(c.GoTestTimeoutScale())
|
||||
return d
|
||||
}
|
||||
|
||||
// timeoutScale returns this builder's GO_TEST_TIMEOUT_SCALE value, or 1.
|
||||
func (c *BuildConfig) timeoutScale() int {
|
||||
// GoTestTimeoutScale returns this builder's GO_TEST_TIMEOUT_SCALE value, or 1.
|
||||
func (c *BuildConfig) GoTestTimeoutScale() int {
|
||||
const pfx = "GO_TEST_TIMEOUT_SCALE="
|
||||
for _, env := range [][]string{c.env, c.HostConfig().env} {
|
||||
for _, kv := range env {
|
||||
|
|
Загрузка…
Ссылка в новой задаче