[libc-commits] [libc] 80368a1 - [libc] Check if the hermetic test target exists

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Wed Jul 5 10:09:07 PDT 2023


Author: Petr Hosek
Date: 2023-07-05T17:09:01Z
New Revision: 80368a104e09f50ceab23f84dea97ed117804ba2

URL: https://github.com/llvm/llvm-project/commit/80368a104e09f50ceab23f84dea97ed117804ba2
DIFF: https://github.com/llvm/llvm-project/commit/80368a104e09f50ceab23f84dea97ed117804ba2.diff

LOG: [libc] Check if the hermetic test target exists

When crt1 isn't available, which is typical on baremetal, hermetic tests
aren't created and the hermetic test target won't be available.

Differential Revision: https://reviews.llvm.org/D154279

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCTestRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 8ce195291b6710..b2666d407b23e3 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -747,7 +747,7 @@ function(add_libc_test test_name)
   if(LIBC_ENABLE_HERMETIC_TESTS AND NOT LIBC_TEST_UNIT_TEST_ONLY)
     add_libc_hermetic_test(${test_name}.__hermetic__ ${LIBC_TEST_UNPARSED_ARGUMENTS})
     get_fq_target_name(${test_name} fq_test_name)
-    if(TARGET ${fq_test_name}.__unit__)
+    if(TARGET ${fq_test_name}.__hermetic__ AND TARGET ${fq_test_name}.__unit__)
       # Tests like the file tests perform file operations on disk file. If we
       # don't chain up the unit test and hermetic test, then those tests will
       # step on each other's files.


        


More information about the libc-commits mailing list