[PATCH] math: Fix unsupported check in test-narrowing-trap

Yury Khrustalev <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
---

Base commit: af51ed63d0

Test change only. Passes regression on aarch64-linux-gnu,
x86_64-linux-gnu, i686-linux-gnu and build-tested for
several targets with build-many-glibcs.py.

Andreas, I suppose we could merge this test fix now? It's OK if not.

---
 math/test-narrowing-trap.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/math/test-narrowing-trap.c b/math/test-narrowing-trap.c
index 6d21357913..5820de42ad 100644
--- a/math/test-narrowing-trap.c
+++ b/math/test-narrowing-trap.c
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <support/check.h>
 #include <support/xunistd.h>
+#include <support/test-driver.h>
 
 static int
 do_test (void)
@@ -29,14 +30,14 @@ do_test (void)
 #ifdef FE_INVALID
   pid_t pid;
 
-  if (!EXCEPTION_ENABLE_SUPPORTED (FE_INVALID))
-    FAIL_UNSUPPORTED ("feenableexcept (FE_INVALID) not supported");
-
   pid = xfork ();
   if (pid == 0)
     {
       int r = feenableexcept (FE_INVALID);
 
+      if (!EXCEPTION_ENABLE_SUPPORTED (FE_INVALID) && r == -1)
+        FAIL_UNSUPPORTED ("feenableexcept (FE_INVALID) not supported");
+
       TEST_COMPARE (r, 0);
       fdiv (0.0, 0.0);
       _exit (0);
@@ -46,6 +47,9 @@ do_test (void)
       int status;
       xwaitpid (pid, &status, 0);
 
+      if (WEXITSTATUS (status) == EXIT_UNSUPPORTED)
+        FAIL_UNSUPPORTED ("feenableexcept (FE_INVALID) not supported");
+
       TEST_VERIFY (WIFSIGNALED (status));
       TEST_COMPARE (WTERMSIG (status), SIGFPE);
     }
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.