From ff801e8e17c02b2f8946629d00d5dc1bd02e8096 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 20 Oct 2021 17:34:56 +0100 Subject: [PATCH] test_all: allow configuring a multiplier for the timeout #5734 --- fstest/test_all/config.go | 2 ++ fstest/test_all/run.go | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fstest/test_all/config.go b/fstest/test_all/config.go index 609e4c0a5..e5a012488 100644 --- a/fstest/test_all/config.go +++ b/fstest/test_all/config.go @@ -37,6 +37,7 @@ type Backend struct { Ignore []string // test names to ignore the failure of Tests []string // paths of tests to run, blank for all ListRetries int // -list-retries if > 0 + ExtraTime float64 // factor to multiply the timeout by } // includeTest returns true if this backend should be included in this @@ -91,6 +92,7 @@ func (b *Backend) MakeRuns(t *Test) (runs []*Run) { SizeLimit: int64(maxSize), Ignore: ignore, ListRetries: b.ListRetries, + ExtraTime: b.ExtraTime, } if t.AddBackend { run.Path = path.Join(run.Path, b.Backend) diff --git a/fstest/test_all/run.go b/fstest/test_all/run.go index 56d6dde2d..e084e3d81 100644 --- a/fstest/test_all/run.go +++ b/fstest/test_all/run.go @@ -46,7 +46,8 @@ type Run struct { NoBinary bool // set to not build a binary SizeLimit int64 // maximum test file size Ignore map[string]struct{} - ListRetries int // -list-retries if > 0 + ListRetries int // -list-retries if > 0 + ExtraTime float64 // multiply the timeout by this // Internals CmdLine []string CmdString string @@ -337,7 +338,12 @@ func (r *Run) Init() { } else { r.CmdLine = []string{"./" + r.BinaryName()} } - r.CmdLine = append(r.CmdLine, prefix+"v", prefix+"timeout", timeout.String(), "-remote", r.Remote) + testTimeout := *timeout + log.Printf("extra time: %f", r.ExtraTime) + if r.ExtraTime > 0 { + testTimeout = time.Duration(float64(testTimeout) * r.ExtraTime) + } + r.CmdLine = append(r.CmdLine, prefix+"v", prefix+"timeout", testTimeout.String(), "-remote", r.Remote) listRetries := *listRetries if r.ListRetries > 0 { listRetries = r.ListRetries