Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/gen Revert previous, si_addr is expected to b...
details: https://anonhg.NetBSD.org/src/rev/fae7bd0e3a07
branches: trunk
changeset: 778976:fae7bd0e3a07
user: martin <martin%NetBSD.org@localhost>
date: Mon Apr 23 15:07:56 2012 +0000
description:
Revert previous, si_addr is expected to be the faulting *data* address
(mmm, consistent standards).
Add a few tweaks to prevent the compiler's optimizer outsmarting the test.
diffstat:
tests/lib/libc/gen/t_siginfo.c | 21 +++++----------------
1 files changed, 5 insertions(+), 16 deletions(-)
diffs (60 lines):
diff -r dcca3529a1e9 -r fae7bd0e3a07 tests/lib/libc/gen/t_siginfo.c
--- a/tests/lib/libc/gen/t_siginfo.c Mon Apr 23 15:07:02 2012 +0000
+++ b/tests/lib/libc/gen/t_siginfo.c Mon Apr 23 15:07:56 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.16 2012/04/22 08:52:26 martin Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.17 2012/04/23 15:07:56 martin Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
#endif
/* for sigbus */
-char *addr;
+volatile char *addr;
/* for sigchild */
pid_t child;
@@ -412,31 +412,19 @@
sigbus_action(int signo, siginfo_t *info, void *ptr)
{
+ printf("si_addr = %p\n", info->si_addr);
sig_debug(signo, info, (ucontext_t *)ptr);
ATF_REQUIRE_EQ(info->si_signo, SIGBUS);
ATF_REQUIRE_EQ(info->si_errno, 0);
ATF_REQUIRE_EQ(info->si_code, BUS_ADRALN);
-#if 0
if (strcmp(atf_config_get("atf_arch"), "i386") == 0 ||
strcmp(atf_config_get("atf_arch"), "x86_64") == 0) {
atf_tc_expect_fail("x86 architecture does not correctly "
"report the address where the unaligned access occured");
}
-
- /*
- * XXX: This is bogus: si_addr is documented as the text address
- * where the fault occurs, addr is the faulting data address,
- * see TOG about siginfo_t:
- *
- * void * si_addr Address of faulting instruction.
- *
- * Is there a portable way to get the accessed data address from
- * the handler?
- */
- ATF_REQUIRE_EQ(info->si_addr, (void *)addr);
-#endif
+ ATF_REQUIRE_EQ(info->si_addr, (volatile void *)addr);
atf_tc_pass();
/* NOTREACHED */
@@ -480,6 +468,7 @@
/* Force an unaligned access */
addr++;
+ printf("now trying to access unaligned address %p\n", addr);
ATF_REQUIRE_EQ(*(volatile int *)addr, 0);
atf_tc_fail("Test did not fault as expected");
Home |
Main Index |
Thread Index |
Old Index