]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Some fixes for the faultstatus testcase. Fixes #253206.
authorJulian Seward <jseward@acm.org>
Tue, 15 Mar 2011 08:13:08 +0000 (08:13 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 15 Mar 2011 08:13:08 +0000 (08:13 +0000)
(Christian Borntraeger, borntraeger@de.ibm.com)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11644

none/tests/faultstatus.c

index a41dfd4422ed3453fb1c40a6a75257d238e3d9d6..4f2de03dd8b1e2f0aec64878c07801803ae39fd9 100644 (file)
@@ -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);