[libc-commits] [libc] [libc] fix EXPECT_EXIT suspend/timeout for darwin (PR #166065)

via libc-commits libc-commits at lists.llvm.org
Sun Nov 2 04:42:31 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Shreeyash Pandey (bojle)

<details>
<summary>Changes</summary>

Fixes: https://github.com/llvm/llvm-project/issues/166059


---
Full diff: https://github.com/llvm/llvm-project/pull/166065.diff


2 Files Affected:

- (modified) libc/test/UnitTest/CMakeLists.txt (+1-1) 
- (modified) libc/test/UnitTest/ExecuteFunctionUnix.cpp (+2-1) 


``````````diff
diff --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt
index 31d1e9dce8204..028e8e3a2ea67 100644
--- a/libc/test/UnitTest/CMakeLists.txt
+++ b/libc/test/UnitTest/CMakeLists.txt
@@ -83,7 +83,7 @@ add_unittest_framework_library(
 )
 
 set(libc_death_test_srcs LibcDeathTestExecutors.cpp)
-if(${LIBC_TARGET_OS} STREQUAL "linux")
+if(${LIBC_TARGET_OS} STREQUAL "linux" OR ${LIBC_TARGET_OS} STREQUAL "darwin")
   list(APPEND libc_death_test_srcs ExecuteFunctionUnix.cpp)
 endif()
 
diff --git a/libc/test/UnitTest/ExecuteFunctionUnix.cpp b/libc/test/UnitTest/ExecuteFunctionUnix.cpp
index c0e85c2144005..0b450578adde2 100644
--- a/libc/test/UnitTest/ExecuteFunctionUnix.cpp
+++ b/libc/test/UnitTest/ExecuteFunctionUnix.cpp
@@ -13,6 +13,7 @@
 #include <poll.h>
 #include <signal.h>
 #include <stdio.h>
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/wait.h>
@@ -58,7 +59,7 @@ ProcessStatus invoke_in_subprocess(FunctionCaller *func, int timeout_ms) {
   ::close(pipe_fds[1]);
 
   struct pollfd poll_fd {
-    pipe_fds[0], 0, 0
+    pipe_fds[0], POLLIN, 0
   };
   // No events requested so this call will only return after the timeout or if
   // the pipes peer was closed, signaling the process exited.

``````````

</details>


https://github.com/llvm/llvm-project/pull/166065


More information about the libc-commits mailing list