[libc-commits] [libc] 4311246 - Revert "[libc] Enable hermetic floating point tests"

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu May 25 17:16:40 PDT 2023


Author: Joseph Huber
Date: 2023-05-25T19:15:02-05:00
New Revision: 4311246a3a31687f94b519de322c63998bcff3be

URL: https://github.com/llvm/llvm-project/commit/4311246a3a31687f94b519de322c63998bcff3be
DIFF: https://github.com/llvm/llvm-project/commit/4311246a3a31687f94b519de322c63998bcff3be.diff

LOG: Revert "[libc] Enable hermetic floating point tests"

This passed locally but unfortauntely it seems some tests are not ready
to be made hermetic. Revert for now until we can investigate
specifically which tests are failing and mark those as `UNIT_TEST_ONLY`.

This reverts commit 417ea79e792a87d53f5ac4f5388af4b25aa04d7d.

Added: 
    

Modified: 
    libc/test/UnitTest/RoundingModeUtils.cpp
    libc/test/src/CMakeLists.txt
    libc/test/src/fenv/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/test/UnitTest/RoundingModeUtils.cpp b/libc/test/UnitTest/RoundingModeUtils.cpp
index c55e0d7818291..8cc6834d89edb 100644
--- a/libc/test/UnitTest/RoundingModeUtils.cpp
+++ b/libc/test/UnitTest/RoundingModeUtils.cpp
@@ -8,7 +8,7 @@
 
 #include "RoundingModeUtils.h"
 
-#include "src/__support/FPUtil/FEnvImpl.h"
+#include <fenv.h>
 
 namespace __llvm_libc {
 namespace fputil {
@@ -34,15 +34,15 @@ int get_fe_rounding(RoundingMode mode) {
 }
 
 ForceRoundingMode::ForceRoundingMode(RoundingMode mode) {
-  old_rounding_mode = get_round();
+  old_rounding_mode = fegetround();
   rounding_mode = get_fe_rounding(mode);
   if (old_rounding_mode != rounding_mode)
-    set_round(rounding_mode);
+    fesetround(rounding_mode);
 }
 
 ForceRoundingMode::~ForceRoundingMode() {
   if (old_rounding_mode != rounding_mode)
-    set_round(old_rounding_mode);
+    fesetround(old_rounding_mode);
 }
 
 } // namespace testing

diff  --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt
index 52452cd1037db..9e6c02c1f9f4b 100644
--- a/libc/test/src/CMakeLists.txt
+++ b/libc/test/src/CMakeLists.txt
@@ -1,7 +1,7 @@
 function(add_fp_unittest name)
   cmake_parse_arguments(
     "MATH_UNITTEST"
-    "NEED_MPFR;UNIT_TEST_ONLY;HERMETIC_TEST_ONLY" # Optional arguments
+    "NEED_MPFR;HERMETIC_TEST_ONLY" # Optional arguments
     "" # Single value arguments
     "LINK_LIBRARIES" # Multi-value arguments
     ${ARGN}
@@ -16,8 +16,6 @@ function(add_fp_unittest name)
 
   if(MATH_UNITTEST_HERMETIC_TEST_ONLY)
     set(test_type HERMETIC_TEST_ONLY)
-  elseif(MATH_UNITTEST_UNIT_TEST_ONLY)
-    set(test_type UNIT_TEST_ONLY)
   endif()
   if(MATH_UNITTEST_NEED_MPFR)
     if(MATH_UNITTEST_HERMETIC_TEST_ONLY)
@@ -28,7 +26,7 @@ function(add_fp_unittest name)
   endif()
   list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers)
 
-  add_libc_test(
+  add_libc_unittest(
     ${name}
     ${test_type}
     LINK_LIBRARIES "${MATH_UNITTEST_LINK_LIBRARIES}"

diff  --git a/libc/test/src/fenv/CMakeLists.txt b/libc/test/src/fenv/CMakeLists.txt
index 6334d3635f8e9..11179cc88c380 100644
--- a/libc/test/src/fenv/CMakeLists.txt
+++ b/libc/test/src/fenv/CMakeLists.txt
@@ -106,7 +106,6 @@ if (NOT (LLVM_USE_SANITIZER OR (${LIBC_TARGET_OS} STREQUAL "windows")
       libc.src.__support.FPUtil.fenv_impl
     LINK_LIBRARIES
       LibcFPExceptionHelpers
-    UNIT_TEST_ONLY
   )
 
   add_fp_unittest(
@@ -121,6 +120,5 @@ if (NOT (LLVM_USE_SANITIZER OR (${LIBC_TARGET_OS} STREQUAL "windows")
       libc.src.__support.FPUtil.fenv_impl
     LINK_LIBRARIES
       LibcFPExceptionHelpers
-    UNIT_TEST_ONLY
   )
 endif()


        


More information about the libc-commits mailing list