Add a bugshaker that's run when testing
Purpose: To introduce nondeterministic lag to provoke races and thread unsafe code
Something like this:
object BugShaker {
val random = DynamicVariable(new Random(System.currentTimeMillis))
val on = false
def shake() {
random.nextInt(100) match {
case 10 => Thread.sleepNanos(10)
case 20 => Thread.yield
}
}
}
usage:
if (BugShaker.on) BugShaker.shake //Will be optimized away by compiler if off
Something like this:
object BugShaker {
val random = DynamicVariable(new Random(System.currentTimeMillis))
val on = false
def shake() {
random.nextInt(100) match {
case 10 => Thread.sleepNanos(10)
case 20 => Thread.yield
}
}
}
usage:
if (BugShaker.on) BugShaker.shake //Will be optimized away by compiler if off
Leave a comment
on 2012-04-24 10:42 *
By viktorklang
Milestone changed from Backlog to Infrastructure and Framework For Distributed and Load Testing
on 2012-07-05 06:53 *
By viktorklang
Milestone changed from Infrastructure and Framework For Distributed and Load Testing to Coltrane