Scale test time limits under the race detector
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||||
@@ -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
@@ -25,7 +25,7 @@ func TestDefinesCannotOutgrowLimit(t *testing.T) {
|
|||||||
if !errors.Is(err, ErrInvalid) {
|
if !errors.Is(err, ErrInvalid) {
|
||||||
t.Errorf("err %v", err)
|
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)
|
t.Errorf("took %v", d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ func TestLexScales(t *testing.T) {
|
|||||||
if doc.String() != text {
|
if doc.String() != text {
|
||||||
t.Errorf("%s: not written back", name)
|
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)
|
t.Errorf("%s: took %v", name, d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,7 +318,7 @@ func TestBuildVariablesWithAbsoluteSamples(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
case <-time.After(5 * time.Second):
|
case <-time.After(slowdown * 5 * time.Second):
|
||||||
t.Fatalf("%q: Build didn't return", samples)
|
t.Fatalf("%q: Build didn't return", samples)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user