Module Name: src
Committed By: martin
Date: Mon Apr 23 15:07:56 UTC 2012
Modified Files:
src/tests/lib/libc/gen: t_siginfo.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libc/gen/t_siginfo.c
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/gen/t_siginfo.c
diff -u src/tests/lib/libc/gen/t_siginfo.c:1.16 src/tests/lib/libc/gen/t_siginfo.c:1.17
--- src/tests/lib/libc/gen/t_siginfo.c:1.16 Sun Apr 22 08:52:26 2012
+++ src/tests/lib/libc/gen/t_siginfo.c Mon Apr 23 15:07:56 2012
@@ -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 @@ static void
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 @@ ATF_TC_BODY(sigbus_adraln, tc)
/* 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");