[libc-commits] [PATCH] D149691: [libc] Add 'UNIT_TEST_ONLY' and 'HERMETIC_TEST_ONLY' to 'add_libc_test'

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 2 16:51:35 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG644b63bd31f5: [libc] Add 'UNIT_TEST_ONLY' and 'HERMETIC_TEST_ONLY' to 'add_libc_test' (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149691/new/

https://reviews.llvm.org/D149691

Files:
  libc/cmake/modules/LLVMLibCTestRules.cmake
  libc/test/src/string/memory_utils/CMakeLists.txt


Index: libc/test/src/string/memory_utils/CMakeLists.txt
===================================================================
--- libc/test/src/string/memory_utils/CMakeLists.txt
+++ libc/test/src/string/memory_utils/CMakeLists.txt
@@ -1,5 +1,5 @@
-# This test uses too much memory to be made hermetic.
-add_libc_unittest(
+# This test currently uses too much memory to be made hermetic.
+add_libc_test(
   utils_test
   SUITE
     libc-string-tests
@@ -15,4 +15,5 @@
     libc.src.__support.CPP.span
     libc.src.__support.macros.sanitizer
     libc.src.string.memory_utils.memory_utils
+  UNIT_TEST_ONLY
 )
Index: libc/cmake/modules/LLVMLibCTestRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCTestRules.cmake
+++ libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -693,10 +693,17 @@
 
 # A convenience function to add both a unit test as well as a hermetic test.
 function(add_libc_test test_name)
-  if(LIBC_ENABLE_UNITTESTS)
-    add_libc_unittest(${test_name}.__unit__ ${ARGN})
+  cmake_parse_arguments(
+    "LIBC_TEST"
+    "UNIT_TEST_ONLY;HERMETIC_TEST_ONLY" # Optional arguments
+    "" # Single value arguments
+    "" # Multi-value arguments
+    ${ARGN}
+  )
+  if(LIBC_ENABLE_UNITTESTS AND NOT LIBC_TEST_HERMETIC_TEST_ONLY)
+    add_libc_unittest(${test_name}.__unit__ ${LIBC_TEST_UNPARSED_ARGUMENTS})
   endif()
-  if(LIBC_ENABLE_HERMETIC_TESTS)
-    add_libc_hermetic_test(${test_name}.__hermetic__ ${ARGN})
+  if(LIBC_ENABLE_HERMETIC_TESTS AND NOT LIBC_TEST_UNIT_TEST_ONLY)
+    add_libc_hermetic_test(${test_name}.__hermetic__ ${LIBC_TEST_UNPARSED_ARGUMENTS})
   endif()
 endfunction(add_libc_test)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149691.518913.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230502/2eec7c65/attachment.bin>


More information about the libc-commits mailing list