[libc-commits] [libc] [libc] Add missing dependency for test target (PR #138423)

Mikhail R. Gadelha via libc-commits libc-commits at lists.llvm.org
Sat May 3 13:58:42 PDT 2025


https://github.com/mikhailramalho created https://github.com/llvm/llvm-project/pull/138423

It seems we were missing a dependency when adding a new test target, e.g., test libc.test.src.math.sqrt_test.__unit__ would create a custom target in the form of:

add_custom_target(
  libc.test.src.__support.FPUtil.dyadic_float_test.__unit__
  COMMAND  ${LIBC_UNITTEST_ENV} ${CMAKE_CROSSCOMPILING_EMULATOR} libc.test.src.__support.FPUtil.dyadic_float_test.__unit__.__build__
  COMMENT Running unit test libc.test.src.__support.FPUtil.dyadic_float_test.__unit__ )

but it wouldn't set that it depends on libc.test.src.__support.FPUtil.dyadic_float_test.__unit__.__build__ being built.

For some reason, it would break the rv32b buildbot, as it would try to run a test but the __build__ is nowhere to be found, since it wasn't built in the first place.

>From 8020e170700fbea746705838cd4c312772234668 Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Sat, 3 May 2025 17:52:22 -0300
Subject: [PATCH] [libc] Add missing dependency for test target

It seems we were missing a dependency when adding a new test target, e.g.,
test libc.test.src.math.sqrt_test.__unit__ would create a custom target
in the form of:

add_custom_target(
  libc.test.src.__support.FPUtil.dyadic_float_test.__unit__
  COMMAND  ${LIBC_UNITTEST_ENV} ${CMAKE_CROSSCOMPILING_EMULATOR} libc.test.src.__support.FPUtil.dyadic_float_test.__unit__.__build__
  COMMENT Running unit test libc.test.src.__support.FPUtil.dyadic_float_test.__unit__ )

but it wouldn't set that it depends on libc.test.src.__support.FPUtil.dyadic_float_test.__unit__.__build__
being built.

For some reason, it would break the rv32b buildbot, as it would try to
run a test but the __build__ is nowhere to be found, since it wasn't
built in the first place.
---
 libc/cmake/modules/LLVMLibCTestRules.cmake | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index a28e15fc5e394..3f804694b5bae 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -321,6 +321,7 @@ function(create_libc_unittest fq_target_name)
       ${fq_target_name}
       COMMAND ${LIBC_UNITTEST_ENV} ${CMAKE_CROSSCOMPILING_EMULATOR} ${fq_build_target_name}
       COMMENT "Running unit test ${fq_target_name}"
+      DEPENDS ${fq_build_target_name}
     )
   endif()
 



More information about the libc-commits mailing list