summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2020-01-13 14:58:39 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2020-01-13 14:58:39 +0000
commitd725f78bb370bc150bc762e10b7bef82a4e11872 (patch)
tree63304ccf3e07b81bfcfa18ee520264c6e2ca195a /regress/lib
parentf14bef29bc5717a96436b7cacb59768f0cb23530 (diff)
Split setjmp-fpu regress into separate tests. Use errx(3) to explain
potential problems. Regress still failing on amd64.
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libc/setjmp-fpu/Makefile12
-rw-r--r--regress/lib/libc/setjmp-fpu/_setjmp.c11
-rw-r--r--regress/lib/libc/setjmp-fpu/main.c12
-rw-r--r--regress/lib/libc/setjmp-fpu/setjmp-fpu.c44
-rw-r--r--regress/lib/libc/setjmp-fpu/setjmp.c11
-rw-r--r--regress/lib/libc/setjmp-fpu/sigsetjmp.c11
6 files changed, 69 insertions, 32 deletions
diff --git a/regress/lib/libc/setjmp-fpu/Makefile b/regress/lib/libc/setjmp-fpu/Makefile
index 33d0f7e88a0..7b9fae5f5fc 100644
--- a/regress/lib/libc/setjmp-fpu/Makefile
+++ b/regress/lib/libc/setjmp-fpu/Makefile
@@ -1,8 +1,14 @@
-# $OpenBSD: Makefile,v 1.2 2013/12/29 05:46:43 martynas Exp $
+# $OpenBSD: Makefile,v 1.3 2020/01/13 14:58:38 bluhm Exp $
-PROG= setjmp-fpu
-SRCS= _setjmp.c main.c setjmp.c sigsetjmp.c
+PROGS= _setjmp setjmp sigsetjmp
LDADD= -lm
+.for p in ${PROGS}
+REGRESS_TARGETS += run-$p
+run-$p: $p
+ @echo '======== $@ ========'
+ ./$p
+.endfor
+
.include <bsd.regress.mk>
diff --git a/regress/lib/libc/setjmp-fpu/_setjmp.c b/regress/lib/libc/setjmp-fpu/_setjmp.c
index a2195a5ff8e..dba5d7259d3 100644
--- a/regress/lib/libc/setjmp-fpu/_setjmp.c
+++ b/regress/lib/libc/setjmp-fpu/_setjmp.c
@@ -1,4 +1,13 @@
-/* $OpenBSD: _setjmp.c,v 1.3 2015/11/08 18:10:14 miod Exp $ */
+/* $OpenBSD: _setjmp.c,v 1.4 2020/01/13 14:58:38 bluhm Exp $ */
+
+int test__setjmp(void);
+
+int
+main(int argc, char *argv[])
+{
+ return test__setjmp();
+}
+
#define SETJMP(env, savemask) _setjmp(env)
#define LONGJMP(env, val) _longjmp(env, val)
#define TEST_SETJMP test__setjmp
diff --git a/regress/lib/libc/setjmp-fpu/main.c b/regress/lib/libc/setjmp-fpu/main.c
deleted file mode 100644
index 5050fee8557..00000000000
--- a/regress/lib/libc/setjmp-fpu/main.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $OpenBSD: main.c,v 1.2 2015/01/20 04:41:01 krw Exp $ */
-int test__setjmp(void);
-int test_setjmp(void);
-int test_sigsetjmp(void);
-
-int
-main(int argc, char *argv[])
-{
- return (test__setjmp()
- | test_setjmp()
- | test_sigsetjmp());
-}
diff --git a/regress/lib/libc/setjmp-fpu/setjmp-fpu.c b/regress/lib/libc/setjmp-fpu/setjmp-fpu.c
index 694061dcbb9..11d616ae712 100644
--- a/regress/lib/libc/setjmp-fpu/setjmp-fpu.c
+++ b/regress/lib/libc/setjmp-fpu/setjmp-fpu.c
@@ -1,46 +1,62 @@
+#include <err.h>
#include <fenv.h>
#include <setjmp.h>
int
-TEST_SETJMP(int argc, char *argv[])
+TEST_SETJMP(void)
{
JMP_BUF env;
int rv;
/* Set up the FPU control word register. */
- fesetround(FE_UPWARD);
+ rv = fesetround(FE_UPWARD);
+ if (rv != 0)
+ errx(1, "fesetround FE_UPWARD returned %d", rv);
fedisableexcept(FE_ALL_EXCEPT);
feenableexcept(FE_DIVBYZERO);
rv = SETJMP(env, 0);
- if (rv == 0) {
+ switch(rv) {
+ case 0: {
fexcept_t flag = FE_OVERFLOW;
/* Mess with the FPU control word. */
- fesetround(FE_DOWNWARD);
+ rv = fesetround(FE_DOWNWARD);
+ if (rv != 0)
+ errx(1, "fesetround FE_DOWNWARD returned %d", rv);
fedisableexcept(FE_DIVBYZERO);
/* Set the FPU exception flags. */
- fesetexceptflag(&flag, FE_ALL_EXCEPT);
+ rv = fesetexceptflag(&flag, FE_ALL_EXCEPT);
+ if (rv != 0)
+ errx(1, "fesetexceptflag returned %d", rv);
LONGJMP(env, 1);
- } else if (rv == 1) {
+ errx(1, "longjmp returned");
+ }
+ case 1: {
fexcept_t flag = 0;
/* Verify that the FPU control word is preserved. */
- if (fegetround() != FE_UPWARD
- || fegetexcept() != FE_DIVBYZERO)
- return (1);
+ rv = fegetround();
+ if (rv != FE_UPWARD)
+ errx(1, "fegetround returned %d, not FE_UPWARD", rv);
+ rv = fegetexcept();
+ if (rv != FE_DIVBYZERO)
+ errx(1, "fegetexcept returned %d, not FE_DIVBYZERO",
+ rv);
/* Verify that the FPU exception flags weren't clobbered. */
- fegetexceptflag(&flag, FE_ALL_EXCEPT);
+ rv = fegetexceptflag(&flag, FE_ALL_EXCEPT);
+ if (rv != 0)
+ errx(1, "fegetexceptflag returned %d", rv);
if (flag != FE_OVERFLOW)
- return (1);
+ errx(1, "except flag is %d, no FE_OVERFLOW", rv);
return (0);
}
-
- /* This is not supposed to happen. */
- return (1);
+ default:
+ errx(1, "setjmp returned %d", rv);
+ }
}
diff --git a/regress/lib/libc/setjmp-fpu/setjmp.c b/regress/lib/libc/setjmp-fpu/setjmp.c
index 48d72056d06..e12731da37d 100644
--- a/regress/lib/libc/setjmp-fpu/setjmp.c
+++ b/regress/lib/libc/setjmp-fpu/setjmp.c
@@ -1,4 +1,13 @@
-/* $OpenBSD: setjmp.c,v 1.3 2015/11/08 18:10:14 miod Exp $ */
+/* $OpenBSD: setjmp.c,v 1.4 2020/01/13 14:58:38 bluhm Exp $ */
+
+int test_setjmp(void);
+
+int
+main(int argc, char *argv[])
+{
+ return test_setjmp();
+}
+
#define SETJMP(env, savemask) setjmp(env)
#define LONGJMP(env, val) longjmp(env, val)
#define TEST_SETJMP test_setjmp
diff --git a/regress/lib/libc/setjmp-fpu/sigsetjmp.c b/regress/lib/libc/setjmp-fpu/sigsetjmp.c
index 158fd83296d..8c7a22a92bf 100644
--- a/regress/lib/libc/setjmp-fpu/sigsetjmp.c
+++ b/regress/lib/libc/setjmp-fpu/sigsetjmp.c
@@ -1,4 +1,13 @@
-/* $OpenBSD: sigsetjmp.c,v 1.3 2015/11/08 18:10:14 miod Exp $ */
+/* $OpenBSD: sigsetjmp.c,v 1.4 2020/01/13 14:58:38 bluhm Exp $ */
+
+int test_sigsetjmp(void);
+
+int
+main(int argc, char *argv[])
+{
+ return test_sigsetjmp();
+}
+
#define SETJMP(env, savemask) sigsetjmp(env, savemask)
#define LONGJMP(env, val) siglongjmp(env, val)
#define TEST_SETJMP test_sigsetjmp