Fail 80% of the time on weak cmpxchg, not 50%
This commit is contained in:
parent
efd2d55e00
commit
d4b592ed17
@ -567,10 +567,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
|
||||
let old = this.allow_data_races_mut(|this| this.read_immediate(place.into()))?;
|
||||
// `binary_op` will bail if either of them is not a scalar.
|
||||
let eq = this.overflowing_binary_op(mir::BinOp::Eq, old, expect_old)?.0;
|
||||
// If the operation would succeed, but is "weak", fail 50% of the time.
|
||||
// If the operation would succeed, but is "weak", fail 80% of the time.
|
||||
// FIXME: this is quite arbitrary.
|
||||
let cmpxchg_success = eq.to_bool()?
|
||||
&& (!can_fail_spuriously || this.memory.extra.rng.borrow_mut().gen_range(0, 2) == 0);
|
||||
&& (!can_fail_spuriously || this.memory.extra.rng.borrow_mut().gen_range(0, 10) < 8);
|
||||
let res = Immediate::ScalarPair(
|
||||
old.to_scalar_or_uninit(),
|
||||
Scalar::from_bool(cmpxchg_success).into(),
|
||||
|
@ -89,7 +89,7 @@ fn atomic_fences() {
|
||||
|
||||
fn weak_sometimes_fails() {
|
||||
let atomic = AtomicBool::new(false);
|
||||
let tries = 20;
|
||||
let tries = 100;
|
||||
for _ in 0..tries {
|
||||
let cur = atomic.load(Relaxed);
|
||||
// Try (weakly) to flip the flag.
|
||||
|
Loading…
x
Reference in New Issue
Block a user