Skip to content

Commit

Permalink
fix test for file send
Browse files Browse the repository at this point in the history
The test is broken because we can't really guarantee that the old fd
will fail to open. It is entirely possible that by now, some other test
(remember tests are threaded) have opened a new file for itself that
ended up with the same fd as original_fd.

This test was always failing for me when I ran "cargo test" but always
succeeding if I ran the test in isolation, which confirms that this is
the likely cause.
  • Loading branch information
Glauber Costa authored and glommer committed Nov 23, 2023
1 parent dd38075 commit c6ca6f2
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions glommio/src/io/dma_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,6 @@ pub(crate) mod test {
};
use futures::join;
use futures_lite::{stream, StreamExt};
use nix::fcntl::{fcntl, FcntlArg::F_GETFD};
use rand::{seq::SliceRandom, thread_rng};
use std::{cell::RefCell, convert::TryInto, path::PathBuf, time::Duration};

Expand Down Expand Up @@ -1547,8 +1546,6 @@ pub(crate) mod test {
.join()
.unwrap();

assert_eq!(fcntl(original_fd, F_GETFD), Err(nix::errno::Errno::EBADF));

let file: DmaFile = result.into();
assert_ne!(file.as_raw_fd(), original_fd);
assert_eq!(file.file.inode, original_inode);
Expand Down

0 comments on commit c6ca6f2

Please sign in to comment.