Skip to content

Commit

Permalink
Remove filedescriptor test_consumed
Browse files Browse the repository at this point in the history
This test was failing intermittently on github actions.

There's no safe way to check that a file descriptor has been closed,
because a new file could have been reopened with the same number. We'd
then end up closing that new file instead of having close() fail.
  • Loading branch information
jrmuizel committed Oct 28, 2021
1 parent e231cb7 commit 91ff2cb
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions core-foundation/src/filedescriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,6 @@ mod test {
use libc::O_RDWR;
use runloop::{CFRunLoop};

#[test]
fn test_consumed() {
let path = CString::new("/dev/null").unwrap();
let raw_fd = unsafe { libc::open(path.as_ptr(), O_RDWR, 0) };
let cf_fd = CFFileDescriptor::new(raw_fd, true, never_callback, None);
assert!(cf_fd.is_some());
let cf_fd = cf_fd.unwrap();

assert!(cf_fd.valid());
cf_fd.invalidate();
assert!(!cf_fd.valid());

// close() should fail
assert_eq!(unsafe { libc::close(raw_fd) }, -1);
}

#[test]
fn test_unconsumed() {
let path = CString::new("/dev/null").unwrap();
Expand Down

0 comments on commit 91ff2cb

Please sign in to comment.