@@ -485,7 +485,8 @@ fn test_event_overwrite() {
485485 assert ! ( check_epoll_wait:: <8 >( epfd, vec![ ( expected_event, expected_value) ] ) ) ;
486486}
487487
488- // read in socketpair will only provide epoll notification if it emptied the buffer.
488+ // An epoll notification will be provided for every succesful read in a socketpair.
489+ // This behaviour differs from the real system.
489490fn test_socketpair_read ( ) {
490491 // Create an epoll instance.
491492 let epfd = unsafe { libc:: epoll_create1 ( 0 ) } ;
@@ -529,8 +530,11 @@ fn test_socketpair_read() {
529530 assert_eq ! ( res, 3 ) ;
530531 assert_eq ! ( buf, "abc" . as_bytes( ) ) ;
531532
532- // No notification should be provided.
533- assert ! ( check_epoll_wait:: <8 >( epfd, vec![ ] ) ) ;
533+ // Notification will be provided.
534+ // But in real system, no notification will be provided here.
535+ let expected_event = u32:: try_from ( libc:: EPOLLOUT ) . unwrap ( ) ;
536+ let expected_value = fds[ 1 ] as u64 ;
537+ assert ! ( check_epoll_wait:: <8 >( epfd, vec![ ( expected_event, expected_value) ] ) ) ;
534538
535539 // Read until the buffer is empty.
536540 let mut buf: [ u8 ; 2 ] = [ 0 ; 2 ] ;
@@ -540,7 +544,8 @@ fn test_socketpair_read() {
540544 assert_eq ! ( res, 2 ) ;
541545 assert_eq ! ( buf, "de" . as_bytes( ) ) ;
542546
543- // Notification should be provided.
547+ // Notification will be provided.
548+ // In real system, notification will be provided too.
544549 let expected_event = u32:: try_from ( libc:: EPOLLOUT ) . unwrap ( ) ;
545550 let expected_value = fds[ 1 ] as u64 ;
546551 assert ! ( check_epoll_wait:: <8 >( epfd, vec![ ( expected_event, expected_value) ] ) ) ;
0 commit comments