Skip to content

Commit 6ecedb0

Browse files
authored
[libc] Make a couple of math smoke tests more robust. (#120808)
Make sure to clear out all FE_ALL_EXCEPT bits both before and after invoking function under test -- otherwise the very first check for the exception bits in the unit test may fail due to bits set prior to test invocation.
1 parent 96839a4 commit 6ecedb0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

libc/test/src/math/smoke/CanonicalizeTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "hdr/math_macros.h"
2020

2121
#define TEST_SPECIAL(x, y, expected, expected_exception) \
22+
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
2223
EXPECT_EQ(expected, f(&x, &y)); \
2324
EXPECT_FP_EXCEPTION(expected_exception); \
2425
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT)

libc/test/src/math/smoke/FModTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "hdr/fenv_macros.h"
1919

2020
#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \
21+
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
2122
EXPECT_FP_EQ(expected, f(x, y)); \
2223
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
2324
EXPECT_FP_EXCEPTION(expected_exception); \

0 commit comments

Comments
 (0)