From 45abee46be9223dd4bbe895f836093c04ead1e89 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 10 Jul 2022 20:15:35 -0400 Subject: [PATCH 1/2] make a test deterministic --- rust-version | 2 +- tests/fail/data_race/enable_after_join_to_main.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-version b/rust-version index 53e7908f42c..2a26cb60823 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -1517f5de01c445b5124b30f02257b02b4c5ef3b2 +c396bb3b8a16b1f2762b7c6078dc3e023f6a2493 diff --git a/tests/fail/data_race/enable_after_join_to_main.rs b/tests/fail/data_race/enable_after_join_to_main.rs index 757a41adc93..290589690a3 100644 --- a/tests/fail/data_race/enable_after_join_to_main.rs +++ b/tests/fail/data_race/enable_after_join_to_main.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::thread::spawn; From 444ba75ac5fb0754b306b56b2fc2427d008f6b06 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 10 Jul 2022 20:19:41 -0400 Subject: [PATCH 2/2] make more tests deterministic --- tests/fail/data_race/atomic_read_na_write_race1.rs | 2 ++ tests/fail/data_race/atomic_read_na_write_race2.rs | 2 ++ tests/fail/data_race/atomic_write_na_read_race1.rs | 2 ++ tests/fail/data_race/atomic_write_na_read_race2.rs | 2 ++ tests/fail/data_race/atomic_write_na_write_race1.rs | 2 ++ tests/fail/data_race/atomic_write_na_write_race2.rs | 2 ++ tests/fail/data_race/dangling_thread_async_race.rs | 3 ++- tests/fail/data_race/dangling_thread_race.rs | 3 ++- tests/fail/data_race/dealloc_read_race1.rs | 2 ++ tests/fail/data_race/dealloc_read_race2.rs | 2 ++ tests/fail/data_race/dealloc_write_race1.rs | 2 ++ tests/fail/data_race/dealloc_write_race2.rs | 2 ++ tests/fail/data_race/read_write_race.rs | 2 ++ tests/fail/data_race/write_write_race.rs | 2 ++ tests/fail/weak_memory/racing_mixed_size.rs | 2 ++ tests/fail/weak_memory/racing_mixed_size_read.rs | 2 ++ 16 files changed, 32 insertions(+), 2 deletions(-) diff --git a/tests/fail/data_race/atomic_read_na_write_race1.rs b/tests/fail/data_race/atomic_read_na_write_race1.rs index 71d7a66597d..ada25173f25 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.rs +++ b/tests/fail/data_race/atomic_read_na_write_race1.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. #![feature(core_intrinsics)] diff --git a/tests/fail/data_race/atomic_read_na_write_race2.rs b/tests/fail/data_race/atomic_read_na_write_race2.rs index a490f47da7c..b355e4816dd 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.rs +++ b/tests/fail/data_race/atomic_read_na_write_race2.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::sync::atomic::AtomicUsize; diff --git a/tests/fail/data_race/atomic_write_na_read_race1.rs b/tests/fail/data_race/atomic_write_na_read_race1.rs index 40066d91b1f..53305c68cb7 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.rs +++ b/tests/fail/data_race/atomic_write_na_read_race1.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::sync::atomic::AtomicUsize; diff --git a/tests/fail/data_race/atomic_write_na_read_race2.rs b/tests/fail/data_race/atomic_write_na_read_race2.rs index 0bfadcba3ed..21b0abbcaba 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.rs +++ b/tests/fail/data_race/atomic_write_na_read_race2.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. #![feature(core_intrinsics)] diff --git a/tests/fail/data_race/atomic_write_na_write_race1.rs b/tests/fail/data_race/atomic_write_na_write_race1.rs index 258f5dd142e..a8ac18f3213 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.rs +++ b/tests/fail/data_race/atomic_write_na_write_race1.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. #![feature(core_intrinsics)] diff --git a/tests/fail/data_race/atomic_write_na_write_race2.rs b/tests/fail/data_race/atomic_write_na_write_race2.rs index 51068262d58..e3b3e226d8c 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.rs +++ b/tests/fail/data_race/atomic_write_na_write_race2.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::sync::atomic::AtomicUsize; diff --git a/tests/fail/data_race/dangling_thread_async_race.rs b/tests/fail/data_race/dangling_thread_async_race.rs index 7bb20adfcd5..be06740201d 100644 --- a/tests/fail/data_race/dangling_thread_async_race.rs +++ b/tests/fail/data_race/dangling_thread_async_race.rs @@ -1,5 +1,6 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-disable-isolation -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. -//@compile-flags: -Zmiri-disable-isolation use std::mem; use std::thread::{sleep, spawn}; diff --git a/tests/fail/data_race/dangling_thread_race.rs b/tests/fail/data_race/dangling_thread_race.rs index 7e198eef6e9..90957e4026e 100644 --- a/tests/fail/data_race/dangling_thread_race.rs +++ b/tests/fail/data_race/dangling_thread_race.rs @@ -1,5 +1,6 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-disable-isolation -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. -//@compile-flags: -Zmiri-disable-isolation use std::mem; use std::thread::{sleep, spawn}; diff --git a/tests/fail/data_race/dealloc_read_race1.rs b/tests/fail/data_race/dealloc_read_race1.rs index 634904cbfdc..b37f4fda2bd 100644 --- a/tests/fail/data_race/dealloc_read_race1.rs +++ b/tests/fail/data_race/dealloc_read_race1.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::thread::spawn; diff --git a/tests/fail/data_race/dealloc_read_race2.rs b/tests/fail/data_race/dealloc_read_race2.rs index 91ec3c2bd87..280b86924be 100644 --- a/tests/fail/data_race/dealloc_read_race2.rs +++ b/tests/fail/data_race/dealloc_read_race2.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::thread::spawn; diff --git a/tests/fail/data_race/dealloc_write_race1.rs b/tests/fail/data_race/dealloc_write_race1.rs index f95a9be1727..17fb444f9c6 100644 --- a/tests/fail/data_race/dealloc_write_race1.rs +++ b/tests/fail/data_race/dealloc_write_race1.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::thread::spawn; diff --git a/tests/fail/data_race/dealloc_write_race2.rs b/tests/fail/data_race/dealloc_write_race2.rs index 922738354fb..6afb1182a02 100644 --- a/tests/fail/data_race/dealloc_write_race2.rs +++ b/tests/fail/data_race/dealloc_write_race2.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::thread::spawn; diff --git a/tests/fail/data_race/read_write_race.rs b/tests/fail/data_race/read_write_race.rs index cffbba1a70f..4c1d87746d7 100644 --- a/tests/fail/data_race/read_write_race.rs +++ b/tests/fail/data_race/read_write_race.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::thread::spawn; diff --git a/tests/fail/data_race/write_write_race.rs b/tests/fail/data_race/write_write_race.rs index ddd710bce08..de4d4d70c50 100644 --- a/tests/fail/data_race/write_write_race.rs +++ b/tests/fail/data_race/write_write_race.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. use std::thread::spawn; diff --git a/tests/fail/weak_memory/racing_mixed_size.rs b/tests/fail/weak_memory/racing_mixed_size.rs index 3608377e919..d697e5f8fbe 100644 --- a/tests/fail/weak_memory/racing_mixed_size.rs +++ b/tests/fail/weak_memory/racing_mixed_size.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. #![feature(core_intrinsics)] diff --git a/tests/fail/weak_memory/racing_mixed_size_read.rs b/tests/fail/weak_memory/racing_mixed_size_read.rs index e87b6d6fd01..0eacaeeaa9e 100644 --- a/tests/fail/weak_memory/racing_mixed_size_read.rs +++ b/tests/fail/weak_memory/racing_mixed_size_read.rs @@ -1,3 +1,5 @@ +// We want to control preemption here. +//@compile-flags: -Zmiri-preemption-rate=0 //@ignore-windows: Concurrency on Windows is not supported yet. #![feature(core_intrinsics)]