[libc-commits] [libc] [libc] Fix incorrect dependencies in various tests (PR #210297)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Tue Jul 21 00:10:55 PDT 2026
https://github.com/kaladron updated https://github.com/llvm/llvm-project/pull/210297
>From acdf71f40fe2dc90690be0175e66ccc3d585a868 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 17 Jul 2026 13:41:34 +0100
Subject: [PATCH 1/2] [libc] Fix incorrect dependencies in various tests
(#210297)
Resolved several issues causing tests to be skipped during CMake
configuration due to missing or incorrect dependencies:
* RPC: Updated rpc_smoke_test to use the new shared RPC headers
and corrected the dependency to libc.shared.rpc. Also fixed a
type mismatch in the test (index should be uint32_t, not uint64_t)
which was causing compile failures in CI.
* epoll: Enabled epoll_pwait2 entrypoint for x86_64, aarch64,
and riscv Linux. Removed TODO comments since kernel 5.10
is EOL at the end of December, making this safe to enable.
Also updated the epoll_pwait2 test to allow ENOSYS failures,
which is necessary for compatibility with older kernels or
QEMU user mode emulation.
* arpa/inet: Updated inet_ntoa test dependency to
libc.src.__support.common.
* wchar: Fixed typo in mbrlen_test dependency (mbsrlen -> mbrlen).
* time: Removed unnecessary LibcTest dependency from time_test_utils.
Closes #150665
Assisted-by: Automated tooling, human reviewed.
---
libc/config/linux/aarch64/entrypoints.txt | 4 +---
libc/config/linux/riscv/entrypoints.txt | 4 +---
libc/config/linux/x86_64/entrypoints.txt | 4 +---
libc/shared/CMakeLists.txt | 10 ++++++++++
libc/test/src/__support/RPC/CMakeLists.txt | 2 +-
libc/test/src/__support/RPC/rpc_smoke_test.cpp | 10 +++++-----
libc/test/src/arpa/inet/CMakeLists.txt | 2 +-
libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp | 11 +++++++----
libc/test/src/time/CMakeLists.txt | 1 -
libc/test/src/wchar/CMakeLists.txt | 2 +-
10 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index f418ad2a1e685..55a33edf497be 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -262,9 +262,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.sys.epoll.epoll_ctl
libc.src.sys.epoll.epoll_pwait
libc.src.sys.epoll.epoll_wait
- # TODO: Need to check if pwait2 is available before providing.
- # https://github.com/llvm/llvm-project/issues/80060
- # libc.src.sys.epoll.epoll_pwait2
+ libc.src.sys.epoll.epoll_pwait2
# sys/ioctl.h entrypoints
libc.src.sys.ioctl.ioctl
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index fea7d03096a79..07674dd30de2f 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -285,9 +285,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.sys.epoll.epoll_ctl
libc.src.sys.epoll.epoll_pwait
libc.src.sys.epoll.epoll_wait
- # TODO: Need to check if pwait2 is available before providing.
- # https://github.com/llvm/llvm-project/issues/80060
- # libc.src.sys.epoll.epoll_pwait2
+ libc.src.sys.epoll.epoll_pwait2
# sys/ioctl.h entrypoints
libc.src.sys.ioctl.ioctl
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index fa6fd16f3842d..9c501312bad8a 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -285,9 +285,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.sys.epoll.epoll_ctl
libc.src.sys.epoll.epoll_pwait
libc.src.sys.epoll.epoll_wait
- # TODO: Need to check if pwait2 is available before providing.
- # https://github.com/llvm/llvm-project/issues/80060
- # libc.src.sys.epoll.epoll_pwait2
+ libc.src.sys.epoll.epoll_pwait2
# sys/ioctl.h entrypoints
libc.src.sys.ioctl.ioctl
diff --git a/libc/shared/CMakeLists.txt b/libc/shared/CMakeLists.txt
index d27484909f652..4d7f627acc413 100644
--- a/libc/shared/CMakeLists.txt
+++ b/libc/shared/CMakeLists.txt
@@ -14,3 +14,13 @@ if(LIBC_TARGET_OS_IS_GPU)
COMPONENT libc-headers)
endforeach()
endif()
+
+add_header_library(
+ rpc
+ HDRS
+ rpc.h
+ rpc_util.h
+ rpc_dispatch.h
+ rpc_server.h
+ rpc_opcodes.h
+)
diff --git a/libc/test/src/__support/RPC/CMakeLists.txt b/libc/test/src/__support/RPC/CMakeLists.txt
index 8f79a49cec40c..ce4ce92581054 100644
--- a/libc/test/src/__support/RPC/CMakeLists.txt
+++ b/libc/test/src/__support/RPC/CMakeLists.txt
@@ -7,5 +7,5 @@ add_libc_test(
SRCS
rpc_smoke_test.cpp
DEPENDS
- libc.src.__support.RPC.rpc
+ libc.shared.rpc
)
diff --git a/libc/test/src/__support/RPC/rpc_smoke_test.cpp b/libc/test/src/__support/RPC/rpc_smoke_test.cpp
index 58b318c7cfa61..a6bf14799464a 100644
--- a/libc/test/src/__support/RPC/rpc_smoke_test.cpp
+++ b/libc/test/src/__support/RPC/rpc_smoke_test.cpp
@@ -6,15 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/RPC/rpc.h"
+#include "shared/rpc.h"
#include "test/UnitTest/Test.h"
namespace {
enum { lane_size = 8, port_count = 4 };
-using ProcAType = LIBC_NAMESPACE::rpc::Process<false>;
-using ProcBType = LIBC_NAMESPACE::rpc::Process<true>;
+using ProcAType = rpc::Process<false>;
+using ProcBType = rpc::Process<true>;
static_assert(ProcAType::inbox_offset(port_count) ==
ProcBType::outbox_offset(port_count));
@@ -32,7 +32,7 @@ TEST(LlvmLibcRPCSmoke, SanityCheck) {
ProcAType ProcA(port_count, buffer);
ProcBType ProcB(port_count, buffer);
- uint64_t index = 0; // any < port_count
+ uint32_t index = 0; // any < port_count
uint64_t lane_mask = 1;
// Each process has its own local lock for index
@@ -54,7 +54,7 @@ TEST(LlvmLibcRPCSmoke, SanityCheck) {
// ProcA write to outbox
uint32_t ProcAOutbox = ProcA.load_outbox(lane_mask, index);
EXPECT_EQ(ProcAOutbox, 0u);
- ProcAOutbox = ProcA.invert_outbox(index, ProcAOutbox);
+ ProcAOutbox = ProcA.invert_outbox(lane_mask, index, ProcAOutbox);
EXPECT_EQ(ProcAOutbox, 1u);
// No longer available for ProcA
diff --git a/libc/test/src/arpa/inet/CMakeLists.txt b/libc/test/src/arpa/inet/CMakeLists.txt
index d6d92eacddabb..cdbd9232bb5a4 100644
--- a/libc/test/src/arpa/inet/CMakeLists.txt
+++ b/libc/test/src/arpa/inet/CMakeLists.txt
@@ -53,7 +53,7 @@ add_libc_unittest(
DEPENDS
libc.src.arpa.inet.inet_ntoa
libc.hdr.types.struct_in_addr
- libc.src.__support.endian_internal
+ libc.src.__support.common
)
add_libc_unittest(
diff --git a/libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp b/libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp
index 6da070e2561e8..83aa59a04ad6c 100644
--- a/libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp
+++ b/libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp
@@ -42,12 +42,15 @@ TEST_F(LlvmLibcEpollPwaitTest, Basic) {
// Timeout of 0 causes immediate return. We just need to check that the
// interface works, we're not testing the kernel behavior here.
- ASSERT_THAT(
- LIBC_NAMESPACE::epoll_pwait2(epfd, &event, 1, &time_spec, nullptr),
- Succeeds());
+ int res = LIBC_NAMESPACE::epoll_pwait2(epfd, &event, 1, &time_spec, nullptr);
+ if (res == -1) {
+ ASSERT_ERRNO_EQ(ENOSYS);
+ } else {
+ ASSERT_EQ(res, 0);
+ }
ASSERT_THAT(LIBC_NAMESPACE::epoll_pwait2(-1, &event, 1, &time_spec, nullptr),
- Fails(EBADF));
+ Fails(any_of(EBADF, ENOSYS)));
ASSERT_THAT(LIBC_NAMESPACE::epoll_ctl(epfd, EPOLL_CTL_DEL, pipefd[0], &event),
Succeeds());
diff --git a/libc/test/src/time/CMakeLists.txt b/libc/test/src/time/CMakeLists.txt
index eb633a814333e..85cd00f0300b9 100644
--- a/libc/test/src/time/CMakeLists.txt
+++ b/libc/test/src/time/CMakeLists.txt
@@ -9,7 +9,6 @@ add_header_library(
libc.hdr.types.struct_tm
libc.src.__support.macros.config
libc.src.time.time_constants
- LibcTest
)
add_libc_unittest(
diff --git a/libc/test/src/wchar/CMakeLists.txt b/libc/test/src/wchar/CMakeLists.txt
index 52406fdcfd2d6..82e8b0b7ade13 100644
--- a/libc/test/src/wchar/CMakeLists.txt
+++ b/libc/test/src/wchar/CMakeLists.txt
@@ -89,7 +89,7 @@ add_libc_test(
libc.hdr.errno_macros
libc.src.__support.wchar.mbstate
libc.src.string.memset
- libc.src.wchar.mbsrlen
+ libc.src.wchar.mbrlen
libc.hdr.types.mbstate_t
libc.hdr.types.wchar_t
libc.test.UnitTest.ErrnoCheckingTest
>From 3f8edf10cc44ead8652eb365748d695b32a047de Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Tue, 21 Jul 2026 08:10:37 +0100
Subject: [PATCH 2/2] [libc] Move RPC header library target to
src/__support/RPC (#210297)
Move the add_header_library(rpc ...) target definition from
libc/shared/CMakeLists.txt to libc/src/__support/RPC/CMakeLists.txt
so that the target name becomes libc.src.__support.RPC.rpc instead of
libc.shared.rpc. Update the rpc_smoke_test dependency accordingly.
Assisted-by: Automated tooling, human reviewed.
---
libc/shared/CMakeLists.txt | 10 ----------
libc/src/__support/RPC/CMakeLists.txt | 15 +++++++++++++++
libc/test/src/__support/RPC/CMakeLists.txt | 2 +-
3 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/libc/shared/CMakeLists.txt b/libc/shared/CMakeLists.txt
index 4d7f627acc413..d27484909f652 100644
--- a/libc/shared/CMakeLists.txt
+++ b/libc/shared/CMakeLists.txt
@@ -14,13 +14,3 @@ if(LIBC_TARGET_OS_IS_GPU)
COMPONENT libc-headers)
endforeach()
endif()
-
-add_header_library(
- rpc
- HDRS
- rpc.h
- rpc_util.h
- rpc_dispatch.h
- rpc_server.h
- rpc_opcodes.h
-)
diff --git a/libc/src/__support/RPC/CMakeLists.txt b/libc/src/__support/RPC/CMakeLists.txt
index cac9c4e05e369..511d3f3ec1885 100644
--- a/libc/src/__support/RPC/CMakeLists.txt
+++ b/libc/src/__support/RPC/CMakeLists.txt
@@ -1,3 +1,18 @@
+add_header_library(
+ rpc
+ HDRS
+ ${LIBC_SOURCE_DIR}/shared/rpc.h
+ ${LIBC_SOURCE_DIR}/shared/rpc_util.h
+ ${LIBC_SOURCE_DIR}/shared/rpc_dispatch.h
+ ${LIBC_SOURCE_DIR}/shared/rpc_server.h
+ ${LIBC_SOURCE_DIR}/shared/rpc_opcodes.h
+ DEPENDS
+ libc.src.__support.common
+ libc.src.__support.CPP.atomic
+ libc.src.__support.CPP.optional
+ libc.src.__support.CPP.functional
+)
+
if(NOT LIBC_TARGET_OS_IS_GPU)
return()
endif()
diff --git a/libc/test/src/__support/RPC/CMakeLists.txt b/libc/test/src/__support/RPC/CMakeLists.txt
index ce4ce92581054..5078ec4ff106b 100644
--- a/libc/test/src/__support/RPC/CMakeLists.txt
+++ b/libc/test/src/__support/RPC/CMakeLists.txt
@@ -7,5 +7,5 @@ add_libc_test(
SRCS
rpc_smoke_test.cpp
DEPENDS
- libc.shared.rpc
+ libc.src.__support.RPC.rpc
)
More information about the libc-commits
mailing list