From: Julian Seward Date: Tue, 15 Mar 2011 08:13:08 +0000 (+0000) Subject: Some fixes for the faultstatus testcase. Fixes #253206. X-Git-Tag: svn/VALGRIND_3_7_0~585 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1f4fc7b346016337238008f69e73c13ddfc2f354;p=thirdparty%2Fvalgrind.git Some fixes for the faultstatus testcase. Fixes #253206. (Christian Borntraeger, borntraeger@de.ibm.com) git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11644 --- diff --git a/none/tests/faultstatus.c b/none/tests/faultstatus.c index a41dfd4422..4f2de03dd8 100644 --- a/none/tests/faultstatus.c +++ b/none/tests/faultstatus.c @@ -70,7 +70,13 @@ static int testcode(int code, int want) static int testaddr(void *addr, volatile void *want) { + /* Some architectures (e.g. s390) just provide enough information to + resolve the page fault, but do not provide the offset within a page */ +#if defined(__s390__) + if (addr != (void *) ((unsigned long) want & ~0xffful)) { +#else if (addr != want) { +#endif fprintf(stderr, " FAIL: expected si_addr==%p, not %p\n", want, addr); return 0; } @@ -132,7 +138,8 @@ int main() for(i = 0; i < sizeof(sigs)/sizeof(*sigs); i++) sigaction(sigs[i], &sa, NULL); - fd = open("faultstatus.tmp", O_CREAT|O_TRUNC|O_EXCL, 0600); + /* we need O_RDWR for the truncate below */ + fd = open("faultstatus.tmp", O_CREAT|O_TRUNC|O_EXCL|O_RDWR, 0600); if (fd == -1) { perror("tmpfile"); exit(1);