[libc-commits] [libc] 6ecedb0 - [libc] Make a couple of math smoke tests more robust. (#120808)
via libc-commits
libc-commits at lists.llvm.org
Fri Dec 20 16:06:25 PST 2024
Author: Alexey Samsonov
Date: 2024-12-20T16:06:20-08:00
New Revision: 6ecedb05b0d320543968843159b1b29233b03fc7
URL: https://github.com/llvm/llvm-project/commit/6ecedb05b0d320543968843159b1b29233b03fc7
DIFF: https://github.com/llvm/llvm-project/commit/6ecedb05b0d320543968843159b1b29233b03fc7.diff
LOG: [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.
Added:
Modified:
libc/test/src/math/smoke/CanonicalizeTest.h
libc/test/src/math/smoke/FModTest.h
Removed:
################################################################################
diff --git a/libc/test/src/math/smoke/CanonicalizeTest.h b/libc/test/src/math/smoke/CanonicalizeTest.h
index ef75f568b8275b..e500bc38f98524 100644
--- a/libc/test/src/math/smoke/CanonicalizeTest.h
+++ b/libc/test/src/math/smoke/CanonicalizeTest.h
@@ -19,6 +19,7 @@
#include "hdr/math_macros.h"
#define TEST_SPECIAL(x, y, expected, expected_exception) \
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
EXPECT_EQ(expected, f(&x, &y)); \
EXPECT_FP_EXCEPTION(expected_exception); \
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT)
diff --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h
index ad9688fc01e7c1..8fbcc2a276542c 100644
--- a/libc/test/src/math/smoke/FModTest.h
+++ b/libc/test/src/math/smoke/FModTest.h
@@ -18,6 +18,7 @@
#include "hdr/fenv_macros.h"
#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
EXPECT_FP_EQ(expected, f(x, y)); \
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
EXPECT_FP_EXCEPTION(expected_exception); \
More information about the libc-commits
mailing list