Open arthurprs opened 3 years ago
This is a great idea! Thanks for the suggestion 💯
Hmm, there is an obstacle here. I use the atomic crate a lot for atomic enums. Unfortunately, it doesn't support loom. I think I'll need to write my own enum wrapper in order to implement this.
Yeah, it's a very invasive test suite. There's also the crossbeam-queue data structures.
Tokio uses a trick that imports all primitives from a loom module, then swaps its contents based on a cfg flag https://github.com/tokio-rs/tokio/blob/master/tokio/src/loom/mod.rs but that breaks as soon as you have a single external crate :weary:
Loom https://github.com/tokio-rs/loom
This can be a significant amount of work but in my experience it is MUCH more effective catching concurrency bugs compared to stress tests.
Eg. https://github.com/tokio-rs/tokio/blob/master/tokio/src/sync/tests/loom_broadcast.rs