-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shrinking goes into semi-infinite recursion #968
Comments
I encountered this issue too. It seems like it's not actually infinite, just an extremely enormous amount of shrinks being traversed for long sequences. It looks like the shrinker essentially attempts to construct all possible subsequences as shrink candidates: scalacheck/core/shared/src/main/scala/org/scalacheck/Shrink.scala Lines 57 to 65 in a745072
scalacheck/core/shared/src/main/scala/org/scalacheck/Shrink.scala Lines 78 to 92 in a745072
and then it looks like it visits all of them? At least that's what it looks like when I print the input to each run of the property check. This is fine for sequences of at most ~10 elements or so, and when the property check is fast. But already at 10 ms per check, the runtime explodes somewhere around ~20 elements. Here's a minimal example - the "<= 5" and "<= 10" tests finish in a few seconds on my machine, but the "<= 20" test takes about half a minute and the "<= 40" test takes several minutes: it("length <= 5") {
forAll(sizeRange(100)) { l: List[Byte] =>
Thread.sleep(10)
l.length should be <= 5
}
}
it("length <= 10") {
forAll(sizeRange(100)) { l: List[Byte] =>
Thread.sleep(10)
l.length should be <= 10
}
}
it("length <= 20") {
forAll(sizeRange(100)) { l: List[Byte] =>
Thread.sleep(10)
l.length should be <= 20
}
}
it("length <= 40") {
forAll(sizeRange(100)) { l: List[Byte] =>
Thread.sleep(10)
l.length should be <= 40
}
} I encountered this in a test case that takes an |
Here is a commit, for which
IteratorExtensionSpec
never ends after enteringProp.findFirstFailure
: sugar.This happens fairly often for me; here is another one
Stacktrace:
The text was updated successfully, but these errors were encountered: