-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
tokio-util: enable loom testing for cancellation token #7644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
959ba27
24187f9
2b27516
1981e52
3bdecd2
361b3fc
e251d3a
10c4d32
c687941
a69c053
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -95,3 +95,19 @@ jobs: | |||||
| working-directory: tokio | ||||||
| env: | ||||||
| SCOPE: ${{ matrix.scope }} | ||||||
|
|
||||||
| loom-util: | ||||||
| name: loom tokio-util | ||||||
| # base_ref is null when it's not a pull request | ||||||
| if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-util') || (github.base_ref == null)) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't want |
||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v5 | ||||||
| - name: Install Rust ${{ env.rust_stable }} | ||||||
| uses: dtolnay/rust-toolchain@master | ||||||
| with: | ||||||
| toolchain: ${{ env.rust_stable }} | ||||||
| - uses: Swatinem/rust-cache@v2 | ||||||
| - name: run tests | ||||||
| run: cargo test --lib --release --features full -- --nocapture | ||||||
| working-directory: tokio-util | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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}; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| #![cfg(not(loom))] | ||
|
|
||
| //! TCP/UDP/Unix helpers for tokio. | ||
|
|
||
| use crate::either::Either; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -100,6 +100,8 @@ 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] | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
See tokio/tokio-util/src/sync/tests/mod.rs Lines 1 to 2 in a69c053
|
||||||||||||
| #[test] | ||||||||||||
| fn drop_token_with_children() { | ||||||||||||
| loom::model(|| { | ||||||||||||
|
|
@@ -125,6 +127,8 @@ 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] | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not #[cfg_attr(loom, ignore)] ? |
||||||||||||
| #[test] | ||||||||||||
| fn drop_and_cancel_token() { | ||||||||||||
| loom::model(|| { | ||||||||||||
|
|
@@ -150,6 +154,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] | ||||||||||||
ADD-SP marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
| #[test] | ||||||||||||
| fn cancel_parent_and_child() { | ||||||||||||
| loom::model(|| { | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
|
|
||
| #[cfg(loom)] | ||
| mod loom_cancellation_token; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| #![cfg(not(loom))] | ||
|
|
||
| //! UDP framing | ||
|
|
||
| mod frame; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.