Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Mar 2021 12:00:30 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 6ccdee8ab576 - main - lib/msun/tests: Add more debug output to fenv_test.c
Message-ID:  <202103221200.12MC0UXT055187@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=6ccdee8ab576577224fb9e4baed05bd0efe933fd

commit 6ccdee8ab576577224fb9e4baed05bd0efe933fd
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-03-04 18:41:06 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-03-22 11:55:07 +0000

    lib/msun/tests: Add more debug output to fenv_test.c
    
    Output a hex dump of the current fenv and the expected value to allow
    comparing them without having to resort to interactive use of GDB.
---
 lib/msun/tests/Makefile    | 1 +
 lib/msun/tests/fenv_test.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile
index 4ef25c0a909a..7da1944c8ed8 100644
--- a/lib/msun/tests/Makefile
+++ b/lib/msun/tests/Makefile
@@ -86,6 +86,7 @@ IGNORE_PRAGMA=
 
 SRCS.ilogb2_test=	ilogb_test.c
 
+LIBADD.fenv_test+=	util
 LIBADD+=	m
 
 WARNS?=		6
diff --git a/lib/msun/tests/fenv_test.c b/lib/msun/tests/fenv_test.c
index f275f0725504..aafdd32b7fbd 100644
--- a/lib/msun/tests/fenv_test.c
+++ b/lib/msun/tests/fenv_test.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <err.h>
 #include <fenv.h>
 #include <float.h>
+#include <libutil.h>
 #include <math.h>
 #include <signal.h>
 #include <stdio.h>
@@ -173,7 +174,10 @@ ATF_TC_BODY(dfl_env, tc)
 	fenv_t env;
 
 	fegetenv(&env);
-
+	/* Print the default environment for debugging purposes. */
+	hexdump(&env, sizeof(env), "current fenv ", HD_OMIT_CHARS);
+	hexdump(FE_DFL_ENV, sizeof(env), "default fenv ", HD_OMIT_CHARS);
+	CHECK_FP_EXCEPTIONS(0, FE_ALL_EXCEPT);
 #ifdef __amd64__
 	/*
 	 * Compare the fields that the AMD [1] and Intel [2] specs say will be
@@ -202,7 +206,7 @@ ATF_TC_BODY(dfl_env, tc)
 #endif
 
 #endif
-	ATF_CHECK_EQ(0, fetestexcept(FE_ALL_EXCEPT));
+	CHECK_FP_EXCEPTIONS(0, FE_ALL_EXCEPT);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103221200.12MC0UXT055187>