Skip to content

Commit

Permalink
Fixed loom test and reset github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tglane committed Jun 6, 2024
1 parent 4aa3a83 commit e5de711
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/loom.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: ["*"]
branches: ["master", "tokio-*.x"]
pull_request:
types: [labeled, opened, synchronize, reopened]
branches: ["master", "tokio-*.x"]
Expand All @@ -26,7 +26,7 @@ jobs:
loom-sync:
name: loom tokio::sync
# 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-sync') || (github.base_ref == null))
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-sync') || (github.base_ref == null))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -42,7 +42,7 @@ jobs:
loom-time-driver:
name: loom time driver
# 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-time-driver') || (github.base_ref == null))
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-time-driver') || (github.base_ref == null))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -58,7 +58,7 @@ jobs:
loom-current-thread:
name: loom current-thread scheduler
# 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-current-thread') || (github.base_ref == null))
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-current-thread') || (github.base_ref == null))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -74,7 +74,7 @@ jobs:
loom-multi-thread:
name: loom multi-thread scheduler
# 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-multi-thread') || (github.base_ref == null))
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-multi-thread') || (github.base_ref == null))
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -99,7 +99,7 @@ jobs:
loom-multi-thread-alt:
name: loom ALT multi-thread scheduler
# 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-multi-thread-alt') || (github.base_ref == null))
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-multi-thread-alt') || (github.base_ref == null))
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
11 changes: 4 additions & 7 deletions tokio-util/src/sync/tests/loom_cancellation_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,9 @@ fn run_until_cancelled_completes() {
};

if let Some(res) = token.run_until_cancelled(fut).await {
assert!(res, 42);
assert_eq!(res, 42);
} else {
// Should not happen since we are not cancelling the token
assert!(false);
panic!("Should not happen since we are not cancelling the token");
}
});
});
Expand All @@ -204,16 +203,14 @@ fn run_until_cancelled_with_cancel() {
let token1 = token.clone();

let th1 = std::thread::spawn(move || {
std::time::sleep(std::time::Duration::from_millis(500));
std::thread::sleep(std::time::Duration::from_millis(500));
token1.cancel();
});

if let None = token.run_until_cancelled(std::future::pending).await {
assert!(true);
} else {
// This branch should not be entered since we cancel the token before the future
// finishes
assert!(false);
panic!("Should not happen since token got cancelled before future could finish");
}

assert_ok!(th1.join());
Expand Down

0 comments on commit e5de711

Please sign in to comment.