Skip to content

Commit 86f0626

Browse files
authored
Fix miri test failure (#2665)
1 parent 7669031 commit 86f0626

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

futures/tests/eventual.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ fn join1() {
1616
run(future::try_join(ok::<i32, i32>(1), ok(2)).map_ok(move |v| tx.send(v).unwrap()));
1717
assert_eq!(rx.recv(), Ok((1, 2)));
1818
assert!(rx.recv().is_err());
19+
20+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
1921
}
2022

2123
#[test]
@@ -30,6 +32,8 @@ fn join2() {
3032
c2.send(2).unwrap();
3133
assert_eq!(rx.recv(), Ok((1, 2)));
3234
assert!(rx.recv().is_err());
35+
36+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
3337
}
3438

3539
#[test]
@@ -43,6 +47,8 @@ fn join3() {
4347
assert_eq!(rx.recv(), Ok(1));
4448
assert!(rx.recv().is_err());
4549
drop(c2);
50+
51+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
4652
}
4753

4854
#[test]
@@ -56,6 +62,8 @@ fn join4() {
5662
assert!(rx.recv().is_ok());
5763
drop(c2);
5864
assert!(rx.recv().is_err());
65+
66+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
5967
}
6068

6169
#[test]
@@ -73,6 +81,8 @@ fn join5() {
7381
c3.send(3).unwrap();
7482
assert_eq!(rx.recv(), Ok(((1, 2), 3)));
7583
assert!(rx.recv().is_err());
84+
85+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
7686
}
7787

7888
#[test]
@@ -92,6 +102,8 @@ fn select1() {
92102
c2.send(2).unwrap();
93103
assert_eq!(rx.recv(), Ok(2));
94104
assert!(rx.recv().is_err());
105+
106+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
95107
}
96108

97109
#[test]
@@ -111,6 +123,8 @@ fn select2() {
111123
c2.send(2).unwrap();
112124
assert_eq!(rx.recv(), Ok(2));
113125
assert!(rx.recv().is_err());
126+
127+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
114128
}
115129

116130
#[test]
@@ -130,6 +144,8 @@ fn select3() {
130144
drop(c2);
131145
assert_eq!(rx.recv(), Ok(2));
132146
assert!(rx.recv().is_err());
147+
148+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
133149
}
134150

135151
#[test]
@@ -158,4 +174,6 @@ fn select4() {
158174
drop(tx);
159175

160176
t.join().unwrap();
177+
178+
std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
161179
}

0 commit comments

Comments
 (0)