From 91ff2cb513525420f82b5900b2e340e2ccdd3f92 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 28 Oct 2021 10:20:01 -0400 Subject: [PATCH] Remove filedescriptor test_consumed 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. --- core-foundation/src/filedescriptor.rs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/core-foundation/src/filedescriptor.rs b/core-foundation/src/filedescriptor.rs index 061bd2d..e153c70 100644 --- a/core-foundation/src/filedescriptor.rs +++ b/core-foundation/src/filedescriptor.rs @@ -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();