diff --git a/test/drivers/test_suites/syscall_exit_suite/process_vm_readv_x.cpp b/test/drivers/test_suites/syscall_exit_suite/process_vm_readv_x.cpp index 70305e8f20..c2ee918477 100644 --- a/test/drivers/test_suites/syscall_exit_suite/process_vm_readv_x.cpp +++ b/test/drivers/test_suites/syscall_exit_suite/process_vm_readv_x.cpp @@ -2,6 +2,11 @@ #ifdef __NR_process_vm_readv +void signal_handler(int signum) { + // Do nothing +} + + TEST(SyscallExit, process_vm_readvX_failure) { auto evt_test = get_syscall_event_test(__NR_process_vm_readv, EXIT_EVENT); @@ -71,19 +76,20 @@ TEST(SyscallExit, process_vm_readvX_success) remote[0].iov_len = sizeof(buf); void* target = &remote; + signal(SIGUSR2, signal_handler); + close(pipe_fd[0]); ssize_t read = write(pipe_fd[1], &target, sizeof(void*)); ASSERT_GT(read, 0); + close(pipe_fd[1]); + /* - * The following write call makes sure that the process_vm_readv + * The following pause call makes sure that the process_vm_readv * has been called. */ - read = write(pipe_fd[1], buf, 2); - ASSERT_GT(read, 0); - - close(pipe_fd[1]); + pause(); exit(EXIT_SUCCESS); } @@ -106,6 +112,8 @@ TEST(SyscallExit, process_vm_readvX_success) close(pipe_fd[0]); + kill(child_pid, SIGUSR2); + int wstatus; waitpid(child_pid, &wstatus, 0); }