[libc-commits] [PATCH] D149728: [libc][DO NOT SUBMIT] Extend add_fp_unittest to handle hermetic tests.

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


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

This is for demonstration only.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149728

Files:
  libc/test/src/CMakeLists.txt


Index: libc/test/src/CMakeLists.txt
===================================================================
--- libc/test/src/CMakeLists.txt
+++ libc/test/src/CMakeLists.txt
@@ -1,7 +1,7 @@
 function(add_fp_unittest name)
   cmake_parse_arguments(
     "MATH_UNITTEST"
-    "NEED_MPFR" # Optional arguments
+    "NEED_MPFR;HERMETIC_TEST_ONLY" # Optional arguments
     "" # Single value arguments
     "LINK_LIBRARIES" # Multi-value arguments
     ${ARGN}
@@ -14,13 +14,21 @@
     endif()
   endif()
 
+  if(MATH_UNITTEST_HERMETIC_TEST_ONLY)
+    set(test_type HERMETIC_TEST_ONLY)
+  endif()
   if(MATH_UNITTEST_NEED_MPFR)
+    if(MATH_UNITTEST_HERMETIC_TEST_ONLY)
+      message(FATAL "Hermetic math test cannot require MPFR.")
+    endif()
+    set(test_type UNIT_TEST_ONLY)
     list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper libc_math_test_utils -lmpfr -lgmp)
   endif()
   list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers)
 
-  add_libc_unittest(
+  add_libc_test(
     ${name}
+    ${test_type}
     LINK_LIBRARIES "${MATH_UNITTEST_LINK_LIBRARIES}"
     "${MATH_UNITTEST_UNPARSED_ARGUMENTS}"
   )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149728.518995.patch
Type: text/x-patch
Size: 1119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230503/6e649f3d/attachment.bin>


More information about the libc-commits mailing list