Skip to content

Commit d84bd42

Browse files
committed
Fix tests by removing invalid test cases
Due to rust-lang/rust#124210, when an owned fd has already been closed before it's dropped means that something else touched the fd in ways its not allowed to. Therefore, these tests fail due to this new behavior enforcement Signed-off-by: Bryant Biggs <[email protected]>
1 parent a6d7bb8 commit d84bd42

File tree

2 files changed

+2
-45
lines changed

2 files changed

+2
-45
lines changed

benches/lai/no_op.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use tokio::task::JoinSet;
44
#[derive(Clone)]
55
struct Options {
66
iterations: usize,
7+
#[allow(dead_code)]
78
concurrency: usize,
89
sq_size: usize,
910
cq_size: usize,

tests/fs_file.rs

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use std::{
2-
io::prelude::*,
3-
os::unix::io::{AsRawFd, FromRawFd, RawFd},
4-
};
1+
use std::io::prelude::*;
52

63
use tempfile::NamedTempFile;
74

@@ -129,21 +126,6 @@ fn cancel_read() {
129126
});
130127
}
131128

132-
#[test]
133-
fn explicit_close() {
134-
let mut tempfile = tempfile();
135-
tempfile.write_all(HELLO).unwrap();
136-
137-
tokio_uring::start(async {
138-
let file = File::open(tempfile.path()).await.unwrap();
139-
let fd = file.as_raw_fd();
140-
141-
file.close().await.unwrap();
142-
143-
assert_invalid_fd(fd);
144-
})
145-
}
146-
147129
#[test]
148130
fn drop_open() {
149131
tokio_uring::start(async {
@@ -160,19 +142,6 @@ fn drop_open() {
160142
});
161143
}
162144

163-
#[test]
164-
fn drop_off_runtime() {
165-
let file = tokio_uring::start(async {
166-
let tempfile = tempfile();
167-
File::open(tempfile.path()).await.unwrap()
168-
});
169-
170-
let fd = file.as_raw_fd();
171-
drop(file);
172-
173-
assert_invalid_fd(fd);
174-
}
175-
176145
#[test]
177146
fn sync_doesnt_kill_anything() {
178147
let tempfile = tempfile();
@@ -319,7 +288,6 @@ fn tempfile() -> NamedTempFile {
319288

320289
async fn poll_once(future: impl std::future::Future) {
321290
use std::future::poll_fn;
322-
// use std::future::Future;
323291
use std::task::Poll;
324292
use tokio::pin;
325293

@@ -331,15 +299,3 @@ async fn poll_once(future: impl std::future::Future) {
331299
})
332300
.await;
333301
}
334-
335-
fn assert_invalid_fd(fd: RawFd) {
336-
use std::fs::File;
337-
338-
let mut f = unsafe { File::from_raw_fd(fd) };
339-
let mut buf = vec![];
340-
341-
match f.read_to_end(&mut buf) {
342-
Err(ref e) if e.raw_os_error() == Some(libc::EBADF) => {}
343-
res => panic!("assert_invalid_fd finds for fd {:?}, res = {:?}", fd, res),
344-
}
345-
}

0 commit comments

Comments
 (0)