Skip to content

Commit e5de711

Browse files
committed
Fixed loom test and reset github workflow
1 parent 4aa3a83 commit e5de711

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

.github/workflows/loom.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
push:
3-
branches: ["*"]
3+
branches: ["master", "tokio-*.x"]
44
pull_request:
55
types: [labeled, opened, synchronize, reopened]
66
branches: ["master", "tokio-*.x"]
@@ -26,7 +26,7 @@ jobs:
2626
loom-sync:
2727
name: loom tokio::sync
2828
# base_ref is null when it's not a pull request
29-
# if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-sync') || (github.base_ref == null))
29+
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-sync') || (github.base_ref == null))
3030
runs-on: ubuntu-latest
3131
steps:
3232
- uses: actions/checkout@v4
@@ -42,7 +42,7 @@ jobs:
4242
loom-time-driver:
4343
name: loom time driver
4444
# base_ref is null when it's not a pull request
45-
# if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-time-driver') || (github.base_ref == null))
45+
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-time-driver') || (github.base_ref == null))
4646
runs-on: ubuntu-latest
4747
steps:
4848
- uses: actions/checkout@v4
@@ -58,7 +58,7 @@ jobs:
5858
loom-current-thread:
5959
name: loom current-thread scheduler
6060
# base_ref is null when it's not a pull request
61-
# if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-current-thread') || (github.base_ref == null))
61+
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-current-thread') || (github.base_ref == null))
6262
runs-on: ubuntu-latest
6363
steps:
6464
- uses: actions/checkout@v4
@@ -74,7 +74,7 @@ jobs:
7474
loom-multi-thread:
7575
name: loom multi-thread scheduler
7676
# base_ref is null when it's not a pull request
77-
# if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-multi-thread') || (github.base_ref == null))
77+
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-multi-thread') || (github.base_ref == null))
7878
runs-on: ubuntu-latest
7979
strategy:
8080
matrix:
@@ -99,7 +99,7 @@ jobs:
9999
loom-multi-thread-alt:
100100
name: loom ALT multi-thread scheduler
101101
# base_ref is null when it's not a pull request
102-
# if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-multi-thread-alt') || (github.base_ref == null))
102+
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-multi-thread-alt') || (github.base_ref == null))
103103
runs-on: ubuntu-latest
104104
strategy:
105105
matrix:

tokio-util/src/sync/tests/loom_cancellation_token.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,9 @@ fn run_until_cancelled_completes() {
187187
};
188188

189189
if let Some(res) = token.run_until_cancelled(fut).await {
190-
assert!(res, 42);
190+
assert_eq!(res, 42);
191191
} else {
192-
// Should not happen since we are not cancelling the token
193-
assert!(false);
192+
panic!("Should not happen since we are not cancelling the token");
194193
}
195194
});
196195
});
@@ -204,16 +203,14 @@ fn run_until_cancelled_with_cancel() {
204203
let token1 = token.clone();
205204

206205
let th1 = std::thread::spawn(move || {
207-
std::time::sleep(std::time::Duration::from_millis(500));
206+
std::thread::sleep(std::time::Duration::from_millis(500));
208207
token1.cancel();
209208
});
210209

211210
if let None = token.run_until_cancelled(std::future::pending).await {
212211
assert!(true);
213212
} else {
214-
// This branch should not be entered since we cancel the token before the future
215-
// finishes
216-
assert!(false);
213+
panic!("Should not happen since token got cancelled before future could finish");
217214
}
218215

219216
assert_ok!(th1.join());

0 commit comments

Comments
 (0)