Skip to content

Commit

Permalink
implement first 'real' loom test
Browse files Browse the repository at this point in the history
  • Loading branch information
glendc committed Sep 15, 2023
1 parent ffc7f90 commit 41b7718
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/plabayo/tokio-graceful"

[target.'cfg(loom)'.dependencies]
loom = "0.7"
loom = { version = "0.7", features = ["futures", "checkpoint"] }

[dependencies]
pin-project-lite = "0.2"
Expand Down
18 changes: 17 additions & 1 deletion src/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,22 @@ pub fn trigger() -> (Sender, Receiver) {
mod loom_tests {
use super::*;

use loom::{future::block_on, thread};

#[test]
fn test_loom_concurrent() {}
fn test_loom_sender_trigger() {
loom::model(|| {
let (sender, receiver) = trigger();

let th = thread::spawn(move || {
sender.trigger();
});

block_on(async move {
receiver.await;
});

th.join().unwrap();
});
}
}

0 comments on commit 41b7718

Please sign in to comment.