aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-06-10 23:09:40 +0000
committernjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-06-10 23:09:40 +0000
commit2c7e5ca3d43afda2060c4f3a1ad43d945c05ff71 (patch)
treeaa2685221a078ca14476a075b45d515f48de6fc0
parenta8f0629dd975d23637ea43f78e7a01a4220788bd (diff)
downloadvalgrind-2c7e5ca3d43afda2060c4f3a1ad43d945c05ff71.tar.gz
Move the Darwin _nocancel tests to a different file so they can be tested
properly. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10296 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r--memcheck/tests/darwin/Makefile.am6
-rw-r--r--memcheck/tests/darwin/scalar.c38
-rw-r--r--memcheck/tests/darwin/scalar.stderr.exp3
-rw-r--r--memcheck/tests/darwin/scalar_nocancel.c61
-rw-r--r--memcheck/tests/darwin/scalar_nocancel.stderr.exp5
-rw-r--r--memcheck/tests/darwin/scalar_nocancel.vgtest3
6 files changed, 78 insertions, 38 deletions
diff --git a/memcheck/tests/darwin/Makefile.am b/memcheck/tests/darwin/Makefile.am
index 9d41756e3..54270213e 100644
--- a/memcheck/tests/darwin/Makefile.am
+++ b/memcheck/tests/darwin/Makefile.am
@@ -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)
diff --git a/memcheck/tests/darwin/scalar.c b/memcheck/tests/darwin/scalar.c
index 7da328205..5d65820c2 100644
--- a/memcheck/tests/darwin/scalar.c
+++ b/memcheck/tests/darwin/scalar.c
@@ -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");
diff --git a/memcheck/tests/darwin/scalar.stderr.exp b/memcheck/tests/darwin/scalar.stderr.exp
index 1307bc8d2..4d62fca77 100644
--- a/memcheck/tests/darwin/scalar.stderr.exp
+++ b/memcheck/tests/darwin/scalar.stderr.exp
@@ -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
index 000000000..6c468cc04
--- /dev/null
+++ b/memcheck/tests/darwin/scalar_nocancel.c
@@ -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
index 000000000..63c732517
--- /dev/null
+++ b/memcheck/tests/darwin/scalar_nocancel.stderr.exp
@@ -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
index 000000000..788757263
--- /dev/null
+++ b/memcheck/tests/darwin/scalar_nocancel.vgtest
@@ -0,0 +1,3 @@
+prog: scalar_nocancel
+vgopts: -q --error-limit=no
+args: < scalar_nocancel.c