[libcxx-commits] [libcxx] [libc++] tests with picolibc: add has-compolete-fenv feature (PR #74610)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 6 07:44:10 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Dominik Wójt (domin144)

<details>
<summary>Changes</summary>

The FE_* macros checked for in cfenv.pass.cpp are not required to be defined, if the relevant options are available. Picolibc happens not to provide these on some platforms.
Added a test in features.py to skip fenv test automatically.

---
Full diff: https://github.com/llvm/llvm-project/pull/74610.diff


3 Files Affected:

- (modified) libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp (+1-1) 
- (modified) libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp (+1-1) 
- (modified) libcxx/utils/libcxx/test/features.py (+29) 


``````````diff
diff --git a/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
index dcc97573d6073..a896f5e03c3af 100644
--- a/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // Floating point exceptions are required for the FE_... macros to be defined.
-// XFAIL: LIBCXX-PICOLIBC-FIXME
+// REQUIRES: has-compolete-fenv
 
 // <fenv.h>
 
diff --git a/libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp b/libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
index 7b3b490eba273..5a39003d00d0f 100644
--- a/libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
+++ b/libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // Floating point exceptions are required for the FE_... macros to be defined.
-// XFAIL: LIBCXX-PICOLIBC-FIXME
+// REQUIRES: has-compolete-fenv
 
 // <cfenv>
 
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index ccabb48833f10..f5b12f90c0510 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -212,6 +212,35 @@ def _getAndroidDeviceApi(cfg):
           """,
         ),
     ),
+    # Some platform do not provide complete floating point environment.
+    Feature(
+        name="has-compolete-fenv",
+        when=lambda cfg: sourceBuilds(
+            cfg,
+            """
+            #include <fenv.h>
+
+            #if !( \
+                defined FE_DIVBYZERO \
+                && defined FE_INEXACT \
+                && defined FE_INVALID \
+                && defined FE_INEXACT \
+                && defined FE_OVERFLOW \
+                && defined FE_UNDERFLOW \
+                && defined FE_ALL_EXCEPT \
+                && defined FE_DOWNWARD \
+                && defined FE_TONEAREST \
+                && defined FE_TOWARDZERO \
+                && defined FE_UPWARD \
+                && defined FE_DFL_ENV \
+                && defined FE_INEXACT)
+            #error Floating point environment not complete
+            #endif
+
+            int main(int, char**) { return 0; }
+          """,
+        ),
+    ),
     # Check for a Windows UCRT bug (fixed in UCRT/Windows 10.0.20348.0):
     # https://developercommunity.visualstudio.com/t/utf-8-locales-break-ctype-functions-for-wchar-type/1653678
     Feature(

``````````

</details>


https://github.com/llvm/llvm-project/pull/74610


More information about the libcxx-commits mailing list