diff --git a/test/test.h b/test/test.h index ecd4a867..d438dfc9 100644 --- a/test/test.h +++ b/test/test.h @@ -298,7 +298,10 @@ class testcase_nested : public testcase { bool trim_tail(unsigned window_width); bool grow_head(unsigned head_count); bool pop_txn(bool abort); - bool pop_txn() { return pop_txn(flipcoin_x2()); } + bool pop_txn() { + return pop_txn(inherited::is_nested_txn_available() ? flipcoin_x3() + : flipcoin_x2()); + } void push_txn(); bool stochastic_breakable_restart_with_nested(bool force_restart = false); diff --git a/test/utils.cc b/test/utils.cc index c807d0e5..311cf544 100644 --- a/test/utils.cc +++ b/test/utils.cc @@ -332,6 +332,8 @@ double double_from_upper(uint64_t salt) { bool flipcoin() { return bleach32((uint32_t)entropy_ticks()) & 1; } bool flipcoin_x2() { return (bleach32((uint32_t)entropy_ticks()) & 3) == 0; } +bool flipcoin_x3() { return (bleach32((uint32_t)entropy_ticks()) & 7) == 0; } +bool flipcoin_x4() { return (bleach32((uint32_t)entropy_ticks()) & 15) == 0; } bool jitter(unsigned probability_percent) { const uint32_t top = UINT32_MAX - UINT32_MAX % 100; diff --git a/test/utils.h b/test/utils.h index 35a54d30..2a5a54de 100644 --- a/test/utils.h +++ b/test/utils.h @@ -356,5 +356,7 @@ void prng_fill(void *ptr, size_t bytes); bool flipcoin(); bool flipcoin_x2(); +bool flipcoin_x3(); +bool flipcoin_x4(); bool jitter(unsigned probability_percent); void jitter_delay(bool extra = false);