From d9150b0483b7441ac994a7590160d96e67418c0b Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 24 Sep 2024 10:22:48 -0700 Subject: [PATCH] Debugging. --- tests/event/select.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/event/select.rs b/tests/event/select.rs index 847e6f414..0b2d8879c 100644 --- a/tests/event/select.rs +++ b/tests/event/select.rs @@ -297,11 +297,13 @@ fn test_select_with_maxfd_sockets() { } setrlimit(Resource::Nofile, rlimit).unwrap(); + dbg!("hello"); // Renumber the fds to the maximum possible values. let great_fd = unsafe { libc::dup2(reader.as_raw_fd(), fd_limit as RawFd - 1) }; let reader = unsafe { OwnedFd::from_raw_fd(great_fd) }; let great_fd = unsafe { libc::dup2(writer.as_raw_fd(), fd_limit as RawFd - 2) }; let writer = unsafe { OwnedFd::from_raw_fd(great_fd) }; + dbg!("hello"); let nfds = max(reader.as_raw_fd(), writer.as_raw_fd()) + 1; @@ -311,6 +313,7 @@ fn test_select_with_maxfd_sockets() { // `select` should say there's nothing ready to be read from the pipe. let mut readfds = vec![FdSetElement::default(); fd_set_num_elements(2, nfds as RawFd)]; fd_set_insert(&mut readfds, reader.as_raw_fd()); + dbg!("hello"); let num = retry_on_intr(|| unsafe { select( nfds, @@ -324,16 +327,19 @@ fn test_select_with_maxfd_sockets() { ) }) .unwrap(); + dbg!("hello"); assert_eq!(num, 0); assert!(!fd_set_contains(&readfds, reader.as_raw_fd())); assert_eq!(fd_set_bound(&readfds), 0); + dbg!("hello"); // Write a byte to the pipe. assert_eq!( retry_on_intr(|| send(&writer, b"a", SendFlags::empty())).unwrap(), 1 ); + dbg!("hello"); // `select` should now say there's data to be read. let mut readfds = vec![FdSetElement::default(); fd_set_num_elements(2, nfds as RawFd)]; fd_set_insert(&mut readfds, reader.as_raw_fd()); @@ -346,6 +352,7 @@ fn test_select_with_maxfd_sockets() { assert!(!fd_set_contains(&readfds, reader.as_raw_fd())); assert_eq!(fd_set_bound(&readfds), 0); + dbg!("hello"); // Read the byte from the pipe. let mut buf = [b'\0']; assert_eq!( @@ -372,6 +379,7 @@ fn test_select_with_maxfd_sockets() { assert_eq!(num, 0); assert!(!fd_set_contains(&readfds, reader.as_raw_fd())); assert_eq!(fd_set_bound(&readfds), 0); + dbg!("hello"); setrlimit(Resource::Nofile, orig_rlimit).unwrap(); }