util: enable loom tests (#7644)

Co-authored-by: Benjamin Ran <[email protected]>
This commit is contained in:
Benjamin Ran
2025-11-06 19:20:08 +08:00
committed by GitHub
co-authored by Benjamin Ran
parent 0671c205cc
commit d84a9e9af3
12 changed files with 60 additions and 7 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ where
}
}
#[cfg(test)]
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use tokio::io::{repeat, AsyncReadExt, Repeat};
+9 -1
View File
@@ -1 +1,9 @@
pub(crate) use std::sync;
//! This module abstracts over `loom` and `std::sync` types depending on whether we
//! are running loom tests or not.
pub(crate) mod sync {
#[cfg(all(test, loom))]
pub(crate) use loom::sync::{Arc, Mutex, MutexGuard};
#[cfg(not(all(test, loom)))]
pub(crate) use std::sync::{Arc, Mutex, MutexGuard};
}
+2
View File
@@ -1,3 +1,5 @@
#![cfg(not(loom))]
//! TCP/UDP/Unix helpers for tokio.
use crate::either::Either;
+3
View File
@@ -15,3 +15,6 @@ pub use poll_semaphore::PollSemaphore;
mod reusable_box;
pub use reusable_box::ReusableBoxFuture;
#[cfg(test)]
mod tests;
@@ -100,6 +100,9 @@ fn drop_token_no_child() {
});
}
// Temporarily disabled due to a false positive in loom -
// see https://github.com/tokio-rs/tokio/pull/7644#issuecomment-3328381344
#[ignore]
#[test]
fn drop_token_with_children() {
loom::model(|| {
@@ -125,6 +128,9 @@ fn drop_token_with_children() {
});
}
// Temporarily disabled due to a false positive in loom -
// see https://github.com/tokio-rs/tokio/pull/7644#issuecomment-3328381344
#[ignore]
#[test]
fn drop_and_cancel_token() {
loom::model(|| {
@@ -150,6 +156,9 @@ fn drop_and_cancel_token() {
});
}
// Temporarily disabled due to a false positive in loom -
// see https://github.com/tokio-rs/tokio/pull/7644#issuecomment-3328381344
#[ignore]
#[test]
fn cancel_parent_and_child() {
loom::model(|| {
+2 -1
View File
@@ -1 +1,2 @@
#[cfg(loom)]
mod loom_cancellation_token;
+2
View File
@@ -1,3 +1,5 @@
#![cfg(not(loom))]
//! UDP framing
mod frame;