[libc-commits] [libc] [libc][test] Gate HashTable tests without linking hsearch (PR #247015)
via libc-commits
libc-commits at lists.llvm.org
Sun Nov 29 13:51:00 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Roland McGrath (frobtech)
<details>
<summary>Changes</summary>
Commit 6fd1c1b8ef40 (#<!-- -->74371) added `libc.src.search.hsearch` to the `DEPENDS` list of `bitmask_test`, `table_test`, and `group_test` solely so those tests are skipped on targets where `hsearch` is not enabled. Listing the entrypoint in `DEPENDS` also links `hsearch.cpp` and its global table state into unit tests that never call `hsearch`.
Check `TARGET_LLVMLIBC_ENTRYPOINTS` at the top of `libc/test/src/__support/HashTable/CMakeLists.txt` instead, drop `libc.src.search.hsearch` from all three `DEPENDS` lists, and list the direct `libc.hdr.types.ENTRY` dependency on `table_test`.
Assisted-by: Gemini
---
Full diff: https://github.com/llvm/llvm-project/pull/247015.diff
1 Files Affected:
- (modified) libc/test/src/__support/HashTable/CMakeLists.txt (+5-3)
``````````diff
diff --git a/libc/test/src/__support/HashTable/CMakeLists.txt b/libc/test/src/__support/HashTable/CMakeLists.txt
index 800c18f7366189..660b476f1bcdfc 100644
--- a/libc/test/src/__support/HashTable/CMakeLists.txt
+++ b/libc/test/src/__support/HashTable/CMakeLists.txt
@@ -1,3 +1,7 @@
+if(NOT "libc.src.search.hsearch" IN_LIST TARGET_LLVMLIBC_ENTRYPOINTS)
+ return()
+endif()
+
add_libc_test(
bitmask_test
SUITE
@@ -6,7 +10,6 @@ add_libc_test(
bitmask_test.cpp
DEPENDS
libc.src.__support.HashTable.bitmask
- libc.src.search.hsearch
)
add_libc_test(
@@ -16,10 +19,10 @@ add_libc_test(
SRCS
table_test.cpp
DEPENDS
+ libc.hdr.types.ENTRY
libc.src.__support.HashTable.randomness
libc.src.__support.HashTable.table
libc.src.__support.common
- libc.src.search.hsearch
)
add_libc_test(
@@ -32,5 +35,4 @@ add_libc_test(
libc.hdr.stdint_proxy
libc.src.__support.HashTable.bitmask
libc.src.stdlib.rand
- libc.src.search.hsearch
)
``````````
</details>
https://github.com/llvm/llvm-project/pull/247015
More information about the libc-commits
mailing list