[libc-commits] [libc] [libc] Fix incorrect dependencies in various tests (PR #210297)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Fri Jul 17 03:56:02 PDT 2026
https://github.com/kaladron updated https://github.com/llvm/llvm-project/pull/210297
>From 68f48c22039c34b456fd54f2dcca935f7ac7c64f Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 17 Jul 2026 11:24:15 +0100
Subject: [PATCH 1/3] [libc] Fix incorrect dependencies in various tests
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.
* 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.
* 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 | 8 ++++----
libc/test/src/arpa/inet/CMakeLists.txt | 2 +-
libc/test/src/time/CMakeLists.txt | 1 -
libc/test/src/wchar/CMakeLists.txt | 2 +-
9 files changed, 20 insertions(+), 17 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..5a80c349c5893 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));
@@ -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/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 5c43a5b07907faaf29a0a41dbd63828745e67d13 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 17 Jul 2026 11:54:51 +0100
Subject: [PATCH 2/3] [libc] Fix RPC smoke test type mismatch (#210297)
Changed index type from uint64_t to uint32_t in rpc_smoke_test.cpp
to fix compile errors due to -Wshorten-64-to-32 (conversion from
uint64_t to uint32_t) in CI.
Assisted-by: Automated tooling, human reviewed.
---
libc/test/src/__support/RPC/rpc_smoke_test.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/test/src/__support/RPC/rpc_smoke_test.cpp b/libc/test/src/__support/RPC/rpc_smoke_test.cpp
index 5a80c349c5893..a6bf14799464a 100644
--- a/libc/test/src/__support/RPC/rpc_smoke_test.cpp
+++ b/libc/test/src/__support/RPC/rpc_smoke_test.cpp
@@ -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
>From 6390ae2ab0de8b42b7b728df6592cc7c8a4d6c26 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 17 Jul 2026 11:55:49 +0100
Subject: [PATCH 3/3] [libc] Allow ENOSYS in epoll_pwait2 test (#210297)
Allow epoll_pwait2 to fail with ENOSYS in tests. This is necessary
for compatibility with older kernels or QEMU user mode emulation
which might not support this syscall yet.
Assisted-by: Automated tooling, human reviewed.
---
libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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..1328b63dfe350 100644
--- a/libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp
+++ b/libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp
@@ -42,9 +42,12 @@ 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));
More information about the libc-commits
mailing list