[libc-commits] [PATCH] D149730: [libc] Improve the add_libc_test rule.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed May 3 01:03:51 PDT 2023


sivachandra created this revision.
sivachandra added a reviewer: jhuber6.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
sivachandra requested review of this revision.

A target for the test named ${fq_target_name} has been added. It depends
on ${fq_target_name}.__unit__ and ${fq_target_name}.__hermetic__ as
relevant.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149730

Files:
  libc/cmake/modules/LLVMLibCTestRules.cmake


Index: libc/cmake/modules/LLVMLibCTestRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCTestRules.cmake
+++ libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -700,10 +700,18 @@
     "" # Multi-value arguments
     ${ARGN}
   )
+  get_fq_target_name(${test_name} fq_target_name)
+  if(LIBC_TEST_UNIT_TEST_ONLY AND LIBC_TEST_HERMETIC_TEST_ONLY)
+    message(FATAL_ERROR
+            "${fq_target_name}: Only one of UNIT_TEST_ONLY and HERMETIC_TEST_ONLY can be listed.")
+  endif()
+  add_custom_target(${fq_target_name})
   if(LIBC_ENABLE_UNITTESTS AND NOT LIBC_TEST_HERMETIC_TEST_ONLY)
     add_libc_unittest(${test_name}.__unit__ ${LIBC_TEST_UNPARSED_ARGUMENTS})
+    add_dependencies(${fq_target_name} ${fq_target_name}.__unit__)
   endif()
   if(LIBC_ENABLE_HERMETIC_TESTS AND NOT LIBC_TEST_UNIT_TEST_ONLY)
     add_libc_hermetic_test(${test_name}.__hermetic__ ${LIBC_TEST_UNPARSED_ARGUMENTS})
+    add_dependencies(${fq_target_name} ${fq_target_name}.__hermetic__)
   endif()
 endfunction(add_libc_test)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149730.518996.patch
Type: text/x-patch
Size: 1064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230503/e3cd0a60/attachment.bin>


More information about the libc-commits mailing list