]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Move the Darwin _nocancel tests to a different file so they can be tested
authorNicholas Nethercote <njn@valgrind.org>
Wed, 10 Jun 2009 23:09:40 +0000 (23:09 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 10 Jun 2009 23:09:40 +0000 (23:09 +0000)
properly.

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

memcheck/tests/darwin/Makefile.am
memcheck/tests/darwin/scalar.c
memcheck/tests/darwin/scalar.stderr.exp
memcheck/tests/darwin/scalar_nocancel.c [new file with mode: 0644]
memcheck/tests/darwin/scalar_nocancel.stderr.exp [new file with mode: 0644]
memcheck/tests/darwin/scalar_nocancel.vgtest [new file with mode: 0644]

index 9d41756e3304027fbf40d6b968759f44a4f2e899..54270213e0cab5a287e6e15315fb448b75a1c6f2 100644 (file)
@@ -8,10 +8,14 @@ noinst_HEADERS = scalar.h
 EXTRA_DIST = $(noinst_SCRIPTS) \
        scalar.stderr.exp scalar.vgtest \
        scalar_fork.stderr.exp scalar_fork.vgtest \
+       scalar_nocancel.stderr.exp scalar_nocancel.vgtest \
        scalar_vfork.stderr.exp scalar_vfork.vgtest
 
 check_PROGRAMS = \
-       scalar scalar_fork scalar_vfork
+       scalar \
+       scalar_fork \
+       scalar_nocancel \
+       scalar_vfork
 
 
 AM_CFLAGS    += @FLAG_M32@ $(FLAG_MMMX) $(FLAG_MSSE)
index 7da3282058e3f07dcb2550d87af3c59fd81b06fb..5d65820c2780398130618a589f22a5bc7f76e31e 100644 (file)
@@ -518,46 +518,16 @@ int main(void)
    // __NR___mac_set_lctx 393
    // __NR_setlcid 394
    // __NR_getlcid 395
-   // __NR_read_nocancel 396
-   // __NR_write_nocancel 397
-   // __NR_open_nocancel 398
-   // __NR_close_nocancel 399
-   // __NR_wait4_nocancel 400
-   // __NR_recvmsg_nocancel 401
-   // __NR_sendmsg_nocancel 402
-   // __NR_recvfrom_nocancel 403
-   // __NR_accept_nocancel 404
-   // __NR_msync_nocancel 405
-   // __NR_fcntl_nocancel 406
-   // __NR_select_nocancel 407
-   // __NR_fsync_nocancel 408
-   // __NR_connect_nocancel 409
-   // __NR_sigsuspend_nocancel 410
-   // __NR_readv_nocancel 411
-   // __NR_writev_nocancel 412
-   // __NR_sendto_nocancel 413
-   // __NR_pread_nocancel 414
-   // __NR_pwrite_nocancel 415
-   // __NR_waitid_nocancel 416
-   // __NR_poll_nocancel 417
-   // __NR_msgsnd_nocancel 418
-   // __NR_msgrcv_nocancel 419
-
-   // __NR_sem_wait_nocancel 420
-   // The error doesn't appear because it's a dup of the one from sem_wait.
-   GO(__NR_sem_wait_nocancel, "0s* 0m");
-   SY(__NR_sem_wait_nocancel, x0); FAIL;
-
-   // __NR_aio_suspend_nocancel 421
-   // __NR___sigwait_nocancel 422
-   // __NR___semwait_signal_nocancel 423
+
+   // The nocancel syscalls (396--423) are tested in scalar_nocancel.c.
+
    // __NR___mac_mount 424
    // __NR___mac_get_mount 425
    // __NR___mac_getfsstat 426
    // __NR_MAXSYSCALL 427
 
 #if 0
-   // XXX: all these are copied from x86-darwin/scalar.c.
+   // XXX: all these are copied from x86-linux/scalar.c.
 
    // __NR_open 5
    GO(__NR_open, "(2-args) 2s 1m");
index 1307bc8d2eebe4632145e48662f224ef3edd8dc3..4d62fca770efbaf64853a75dfed1ac6a1443c5e8 100644 (file)
@@ -358,9 +358,6 @@ Syscall param lstat64_extended(fsacl) points to unaddressable byte(s)
    ...
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
 -----------------------------------------------------
-x20001a4(420):__NR_sem_wait_nocancel 0s* 0m
------------------------------------------------------
------------------------------------------------------
 x270f(9999):                9999 1e
 -----------------------------------------------------
 WARNING: unhandled syscall: unix:9999
diff --git a/memcheck/tests/darwin/scalar_nocancel.c b/memcheck/tests/darwin/scalar_nocancel.c
new file mode 100644 (file)
index 0000000..6c468cc
--- /dev/null
@@ -0,0 +1,61 @@
+#include "../../memcheck.h"
+#include "scalar.h"
+#include <unistd.h>
+#include <sched.h>
+#include <signal.h>
+#include <sys/shm.h>
+
+// See memcheck/tests/x86-linux/scalar.c for an explanation of what this test
+// is doing.
+
+int main(void)
+{
+   // uninitialised, but we know px[0] is 0x0
+   long* px  = malloc(sizeof(long));
+   long  x0  = px[0];
+   long  res;
+
+   VALGRIND_MAKE_MEM_NOACCESS(0, 0x1000);
+
+   // The nocancel syscalls all use the same wrappers as the corresponding
+   // non-nocancel syscall.  This means that if we try to test both in the
+   // same file, the nocancel ones won't result in errors being generated
+   // because errors are too similar.  So we test them in this separate file.
+
+   // __NR_read_nocancel 396
+   // __NR_write_nocancel 397
+   // __NR_open_nocancel 398
+   // __NR_close_nocancel 399
+   // __NR_wait4_nocancel 400
+   // __NR_recvmsg_nocancel 401
+   // __NR_sendmsg_nocancel 402
+   // __NR_recvfrom_nocancel 403
+   // __NR_accept_nocancel 404
+   // __NR_msync_nocancel 405
+   // __NR_fcntl_nocancel 406
+   // __NR_select_nocancel 407
+   // __NR_fsync_nocancel 408
+   // __NR_connect_nocancel 409
+   // __NR_sigsuspend_nocancel 410
+   // __NR_readv_nocancel 411
+   // __NR_writev_nocancel 412
+   // __NR_sendto_nocancel 413
+   // __NR_pread_nocancel 414
+   // __NR_pwrite_nocancel 415
+   // __NR_waitid_nocancel 416
+   // __NR_poll_nocancel 417
+   // __NR_msgsnd_nocancel 418
+   // __NR_msgrcv_nocancel 419
+
+   // __NR_sem_wait_nocancel 420
+   // The error doesn't appear because it's a dup of the one from sem_wait.
+   GO(__NR_sem_wait_nocancel, "1s 0m");
+   SY(__NR_sem_wait_nocancel, x0); FAIL;
+
+   // __NR_aio_suspend_nocancel 421
+   // __NR___sigwait_nocancel 422
+   // __NR___semwait_signal_nocancel 423
+
+   return 0;
+}
+
diff --git a/memcheck/tests/darwin/scalar_nocancel.stderr.exp b/memcheck/tests/darwin/scalar_nocancel.stderr.exp
new file mode 100644 (file)
index 0000000..63c7325
--- /dev/null
@@ -0,0 +1,5 @@
+-----------------------------------------------------
+x20001a4(420):__NR_sem_wait_nocancel 1s 0m
+-----------------------------------------------------
+Syscall param sem_wait(sem) contains uninitialised byte(s)
+   ...
diff --git a/memcheck/tests/darwin/scalar_nocancel.vgtest b/memcheck/tests/darwin/scalar_nocancel.vgtest
new file mode 100644 (file)
index 0000000..7887572
--- /dev/null
@@ -0,0 +1,3 @@
+prog: scalar_nocancel
+vgopts: -q --error-limit=no
+args: < scalar_nocancel.c