Scale test time limits under the race detector

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 18:28:48 +00:00
co-authored by Claude Sonnet 5.5
parent d4b44b6ffb
commit ec4b27c005
3 changed files with 17 additions and 3 deletions
+7
View File
@@ -0,0 +1,7 @@
//go:build !race
package sfz
// slowdown is how many times slower tests run than usual, which time limits
// allow for.
const slowdown = 1
+7
View File
@@ -0,0 +1,7 @@
//go:build race
package sfz
// slowdown is how many times slower tests run than usual, which time limits
// allow for.
const slowdown = 10
+3 -3
View File
@@ -25,7 +25,7 @@ func TestDefinesCannotOutgrowLimit(t *testing.T) {
if !errors.Is(err, ErrInvalid) {
t.Errorf("err %v", err)
}
if d := time.Since(start); d > 5*time.Second {
if d := time.Since(start); d > slowdown*5*time.Second {
t.Errorf("took %v", d)
}
}
@@ -94,7 +94,7 @@ func TestLexScales(t *testing.T) {
if doc.String() != text {
t.Errorf("%s: not written back", name)
}
if d := time.Since(start); d > 3*time.Second {
if d := time.Since(start); d > slowdown*3*time.Second {
t.Errorf("%s: took %v", name, d)
}
}
@@ -318,7 +318,7 @@ func TestBuildVariablesWithAbsoluteSamples(t *testing.T) {
}()
select {
case <-done:
case <-time.After(5 * time.Second):
case <-time.After(slowdown * 5 * time.Second):
t.Fatalf("%q: Build didn't return", samples)
}
}