• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Test dropping an AioCb that hasn't yet finished.
2 // This must happen in its own process, because on OSX this test seems to hose
3 // the AIO subsystem and causes subsequent tests to fail
4 #[test]
5 #[should_panic(expected = "Dropped an in-progress AioCb")]
6 #[cfg(all(not(target_env = "musl"),
7           any(target_os = "linux",
8               target_os = "ios",
9               target_os = "macos",
10               target_os = "freebsd",
11               target_os = "netbsd")))]
test_drop()12 fn test_drop() {
13     use nix::sys::aio::*;
14     use nix::sys::signal::*;
15     use std::os::unix::io::AsRawFd;
16     use tempfile::tempfile;
17 
18     const WBUF: &[u8] = b"CDEF";
19 
20     let f = tempfile().unwrap();
21     f.set_len(6).unwrap();
22     let mut aiocb = AioCb::from_slice( f.as_raw_fd(),
23                            2,   //offset
24                            WBUF,
25                            0,   //priority
26                            SigevNotify::SigevNone,
27                            LioOpcode::LIO_NOP);
28     aiocb.write().unwrap();
29 }
30