From 5dc692e3045f5102e1f7752d40ec7e4f81cbc29e Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Mon, 11 Mar 2024 10:55:19 +0100 Subject: [PATCH] chore(test/drivers): some small fixes for file_opener and a couple of tests. Signed-off-by: Federico Di Pierro --- test/drivers/helpers/file_opener.cpp | 1 + test/drivers/test_suites/syscall_exit_suite/dup3_x.cpp | 2 +- test/drivers/test_suites/syscall_exit_suite/newfstatat_x.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/drivers/helpers/file_opener.cpp b/test/drivers/helpers/file_opener.cpp index 15bf4b6bc8..446e10273c 100644 --- a/test/drivers/helpers/file_opener.cpp +++ b/test/drivers/helpers/file_opener.cpp @@ -3,6 +3,7 @@ file_opener::file_opener(const char* filename, int flags, int dirfd) { + errno = 0; m_fd = syscall(__NR_openat, dirfd, filename, flags, 0); // Using the macro that deals with ENOSYS produces a build issue since GTEST_SKIP returns value in a ctor. _assert_syscall_state(SYSCALL_SUCCESS, "openat", m_fd, NOT_EQUAL, -1); diff --git a/test/drivers/test_suites/syscall_exit_suite/dup3_x.cpp b/test/drivers/test_suites/syscall_exit_suite/dup3_x.cpp index 8d9bf369a1..bbefe514b8 100644 --- a/test/drivers/test_suites/syscall_exit_suite/dup3_x.cpp +++ b/test/drivers/test_suites/syscall_exit_suite/dup3_x.cpp @@ -17,8 +17,8 @@ TEST(SyscallExit, dup3X) int32_t new_fd = old_fd; uint32_t flags = O_CLOEXEC; int32_t res = syscall(__NR_dup3, old_fd, new_fd, flags); - assert_syscall_state(SYSCALL_FAILURE, "dup3", res); int64_t errno_value = -errno; + assert_syscall_state(SYSCALL_FAILURE, "dup3", res); syscall(__NR_close, new_fd); syscall(__NR_close, res); diff --git a/test/drivers/test_suites/syscall_exit_suite/newfstatat_x.cpp b/test/drivers/test_suites/syscall_exit_suite/newfstatat_x.cpp index ad72ba7b58..fcae5d44a3 100644 --- a/test/drivers/test_suites/syscall_exit_suite/newfstatat_x.cpp +++ b/test/drivers/test_suites/syscall_exit_suite/newfstatat_x.cpp @@ -65,8 +65,8 @@ TEST(SyscallExit, newfstatatX_failure) int flags = AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW; int32_t res = syscall(__NR_newfstatat, dirfd, pathname, &buffer, flags); - assert_syscall_state(SYSCALL_FAILURE, "newfstatat", res); int64_t errno_value = -errno; + assert_syscall_state(SYSCALL_FAILURE, "newfstatat", res); /*=============================== TRIGGER SYSCALL ===========================*/