Module Name: src Committed By: rin Date: Mon Jun 22 02:51:07 UTC 2020
Modified Files: src/tests/lib/libc/sys: t_ptrace_signal_wait.h t_ptrace_wait.h Log Message: Turn trigger_fpe() back to integer division by zero for a while until QEMU bug #1668041 is fixed: https://bugs.launchpad.net/qemu/+bug/1668041 by which floating-point division by zero is not trapped correctly both on amd64 and i386. Skip *_crash_fpe tests on powerpc, where integer division by zero is never trapped. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_ptrace_signal_wait.h cvs rdiff -u -r1.30 -r1.31 src/tests/lib/libc/sys/t_ptrace_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/lib/libc/sys/t_ptrace_signal_wait.h diff -u src/tests/lib/libc/sys/t_ptrace_signal_wait.h:1.2 src/tests/lib/libc/sys/t_ptrace_signal_wait.h:1.3 --- src/tests/lib/libc/sys/t_ptrace_signal_wait.h:1.2 Wed Jun 17 08:42:16 2020 +++ src/tests/lib/libc/sys/t_ptrace_signal_wait.h Mon Jun 22 02:51:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_signal_wait.h,v 1.2 2020/06/17 08:42:16 rin Exp $ */ +/* $NetBSD: t_ptrace_signal_wait.h,v 1.3 2020/06/22 02:51:06 rin Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -423,7 +423,7 @@ traceme_crash(int sig) info.psi_siginfo.si_code <= ILL_BADSTK); break; case SIGFPE: - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, FPE_FLTDIV); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, FPE_INTDIV); break; case SIGBUS: ATF_REQUIRE_EQ(info.psi_siginfo.si_code, BUS_ADRERR); @@ -603,7 +603,7 @@ traceme_signalmasked_crash(int sig) info.psi_siginfo.si_code <= ILL_BADSTK); break; case SIGFPE: - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, FPE_FLTDIV); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, FPE_INTDIV); break; case SIGBUS: ATF_REQUIRE_EQ(info.psi_siginfo.si_code, BUS_ADRERR); @@ -786,7 +786,7 @@ traceme_signalignored_crash(int sig) info.psi_siginfo.si_code <= ILL_BADSTK); break; case SIGFPE: - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, FPE_FLTDIV); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, FPE_INTDIV); break; case SIGBUS: ATF_REQUIRE_EQ(info.psi_siginfo.si_code, BUS_ADRERR); @@ -1890,7 +1890,7 @@ unrelated_tracer_sees_crash(int sig, boo info.psi_siginfo.si_code <= ILL_BADSTK); break; case SIGFPE: - FORKEE_ASSERT_EQ(info.psi_siginfo.si_code, FPE_FLTDIV); + FORKEE_ASSERT_EQ(info.psi_siginfo.si_code, FPE_INTDIV); break; case SIGBUS: FORKEE_ASSERT_EQ(info.psi_siginfo.si_code, BUS_ADRERR); Index: src/tests/lib/libc/sys/t_ptrace_wait.h diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.30 src/tests/lib/libc/sys/t_ptrace_wait.h:1.31 --- src/tests/lib/libc/sys/t_ptrace_wait.h:1.30 Wed Jun 17 08:42:16 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.h Mon Jun 22 02:51:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.h,v 1.30 2020/06/17 08:42:16 rin Exp $ */ +/* $NetBSD: t_ptrace_wait.h,v 1.31 2020/06/22 02:51:06 rin Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -671,6 +671,9 @@ are_fpu_exceptions_supported(void) return false; return true; } +#elif __powerpc__ +/* Integer division by zero do not trap on powerpc. */ +#define are_fpu_exceptions_supported() 0 #else #define are_fpu_exceptions_supported() 1 #endif @@ -678,14 +681,15 @@ are_fpu_exceptions_supported(void) static void __used trigger_fpe(void) { - volatile double a = getpid(); - volatile double b = atoi("0"); + volatile int a = getpid(); + volatile int b = atoi("0"); #ifdef __HAVE_FENV feenableexcept(FE_ALL_EXCEPT); #endif - usleep((int)(a / b)); + /* Division by zero causes CPU trap, translated to SIGFPE */ + usleep(a / b); } static void __used