From 8554d5b4024a548df634db6333ddd4220df95004 Mon Sep 17 00:00:00 2001 From: lind Date: Wed, 23 Oct 2024 17:34:07 +0000 Subject: [PATCH 1/2] fix: test case ut_lind_fs_lseek_on_epoll --- src/tests/fs_tests.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/tests/fs_tests.rs b/src/tests/fs_tests.rs index ffb7c22..0124bff 100644 --- a/src/tests/fs_tests.rs +++ b/src/tests/fs_tests.rs @@ -4480,12 +4480,19 @@ pub mod fs_tests { assert!(epfd > 0); // Attempt to seek from the epoll and check if it returns an error - assert_eq!( - cage.lseek_syscall(epfd, 10, SEEK_SET), - -(Errno::ESPIPE as i32) - ); - - assert_eq!(cage.exit_syscall(libc::EXIT_SUCCESS), libc::EXIT_SUCCESS); + let lseek_result = unsafe { + libc::lseek(epfd, 10, libc::SEEK_SET) + }; + assert_eq!(lseek_result, -1); + // If lseek failed, check the errno + let errno = unsafe { *libc::__errno_location() }; + println!("lseek failed with errno: {} ()", errno); + + assert_eq!(errno, libc::ESPIPE, "Expected ESPIPE error, got: {}", errno); + // Exit and finalize + let exit_status = cage.exit_syscall(libc::EXIT_SUCCESS); + println!("Exit syscall returned: {}", exit_status); + assert_eq!(exit_status, libc::EXIT_SUCCESS); lindrustfinalize(); } From 9d737a26f831f6076a12ab8ce097e80f26809d07 Mon Sep 17 00:00:00 2001 From: lind Date: Wed, 23 Oct 2024 17:35:00 +0000 Subject: [PATCH 2/2] refactor: removed println lines --- src/tests/fs_tests.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/tests/fs_tests.rs b/src/tests/fs_tests.rs index 0124bff..c9c84fe 100644 --- a/src/tests/fs_tests.rs +++ b/src/tests/fs_tests.rs @@ -4486,12 +4486,9 @@ pub mod fs_tests { assert_eq!(lseek_result, -1); // If lseek failed, check the errno let errno = unsafe { *libc::__errno_location() }; - println!("lseek failed with errno: {} ()", errno); - assert_eq!(errno, libc::ESPIPE, "Expected ESPIPE error, got: {}", errno); // Exit and finalize let exit_status = cage.exit_syscall(libc::EXIT_SUCCESS); - println!("Exit syscall returned: {}", exit_status); assert_eq!(exit_status, libc::EXIT_SUCCESS); lindrustfinalize(); }