aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2020-11-18 19:23:30 +0000
committerAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2020-11-18 19:23:30 +0000
commit758f9acf8ca9db2395d11c4d42f8cd12ac12d663 (patch)
tree840a0107ae709b3aef72afb7f65f78eca40f2aad /lib
parent30a56f9ef72705f2f3646ce4330cbc20675a465e (diff)
downloadsrc-758f9acf8ca9db2395d11c4d42f8cd12ac12d663.tar.gz
src-758f9acf8ca9db2395d11c4d42f8cd12ac12d663.zip
msun tests: use standard floating-point exception flags on lrint and fenv tests
Some platforms have additional architecture-specific floating-point flags. Msun test cases lrint and test_fegsetenv (fenv) expects only standard flags, so make sure to mask them appropriately. This makes test pass on PowerPC64. Reviewed by: jhibbits, ngie Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D27202
Notes
Notes: svn path=/head/; revision=367811
Diffstat (limited to 'lib')
-rw-r--r--lib/msun/tests/fenv_test.c16
-rw-r--r--lib/msun/tests/lrint_test.c5
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/msun/tests/fenv_test.c b/lib/msun/tests/fenv_test.c
index 1599644126ff..9b615b100e8a 100644
--- a/lib/msun/tests/fenv_test.c
+++ b/lib/msun/tests/fenv_test.c
@@ -43,13 +43,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-/*
- * Implementations are permitted to define additional exception flags
- * not specified in the standard, so it is not necessarily true that
- * FE_ALL_EXCEPT == ALL_STD_EXCEPT.
- */
-#define ALL_STD_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \
- FE_OVERFLOW | FE_UNDERFLOW)
+#include "test-utils.h"
#define NEXCEPTS (sizeof(std_excepts) / sizeof(std_excepts[0]))
@@ -373,7 +367,13 @@ test_fegsetenv(void)
assert(fegetround() == FE_TONEAREST);
assert(fesetenv(&env2) == 0);
- assert(fetestexcept(FE_ALL_EXCEPT) == excepts);
+
+ /*
+ * Some platforms like powerpc may set extra exception bits. Since
+ * only standard exceptions are tested, mask against ALL_STD_EXCEPT
+ */
+ assert((fetestexcept(FE_ALL_EXCEPT) & ALL_STD_EXCEPT) == excepts);
+
assert(fegetround() == FE_DOWNWARD);
assert(fesetenv(&env1) == 0);
assert(fetestexcept(FE_ALL_EXCEPT) == 0);
diff --git a/lib/msun/tests/lrint_test.c b/lib/msun/tests/lrint_test.c
index 0c85df079be4..321e1fdb5887 100644
--- a/lib/msun/tests/lrint_test.c
+++ b/lib/msun/tests/lrint_test.c
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
#include <ieeefp.h>
#endif
+#include "test-utils.h"
+
/*
* XXX The volatile here is to avoid gcc's bogus constant folding and work
* around the lack of support for the FENV_ACCESS pragma.
@@ -49,7 +51,8 @@ __FBSDID("$FreeBSD$");
volatile double _d = x; \
assert(feclearexcept(FE_ALL_EXCEPT) == 0); \
assert((func)(_d) == (result) || fetestexcept(FE_INVALID)); \
- assert(fetestexcept(FE_ALL_EXCEPT) == (excepts)); \
+ assert((fetestexcept(FE_ALL_EXCEPT) & ALL_STD_EXCEPT) \
+ == (excepts)); \
} while (0)
#define testall(x, result, excepts) do { \