Skip to content

Commit 9e7ec18

Browse files
committed
[libc++] tests with picolibc: add has-compolete-fenv feature
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.
1 parent 777b6de commit 9e7ec18

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
// Floating point exceptions are required for the FE_... macros to be defined.
10-
// XFAIL: LIBCXX-PICOLIBC-FIXME
10+
// REQUIRES: has-compolete-fenv
1111

1212
// <fenv.h>
1313

libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
// Floating point exceptions are required for the FE_... macros to be defined.
10-
// XFAIL: LIBCXX-PICOLIBC-FIXME
10+
// REQUIRES: has-compolete-fenv
1111

1212
// <cfenv>
1313

libcxx/utils/libcxx/test/features.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,35 @@ def _getAndroidDeviceApi(cfg):
224224
""",
225225
),
226226
),
227+
# Some platform do not provide complete floating point environment.
228+
Feature(
229+
name="has-compolete-fenv",
230+
when=lambda cfg: sourceBuilds(
231+
cfg,
232+
"""
233+
#include <fenv.h>
234+
235+
#if !( \
236+
defined FE_DIVBYZERO \
237+
&& defined FE_INEXACT \
238+
&& defined FE_INVALID \
239+
&& defined FE_INEXACT \
240+
&& defined FE_OVERFLOW \
241+
&& defined FE_UNDERFLOW \
242+
&& defined FE_ALL_EXCEPT \
243+
&& defined FE_DOWNWARD \
244+
&& defined FE_TONEAREST \
245+
&& defined FE_TOWARDZERO \
246+
&& defined FE_UPWARD \
247+
&& defined FE_DFL_ENV \
248+
&& defined FE_INEXACT)
249+
#error Floating point environment not complete
250+
#endif
251+
252+
int main(int, char**) { return 0; }
253+
""",
254+
),
255+
),
227256
# Check for a Windows UCRT bug (fixed in UCRT/Windows 10.0.20348.0):
228257
# https://developercommunity.visualstudio.com/t/utf-8-locales-break-ctype-functions-for-wchar-type/1653678
229258
Feature(

0 commit comments

Comments
 (0)