diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-02-22 14:54:18 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-02-22 14:54:18 +0000 |
commit | e374bfa35bfb833928e8edf686e962d16705abeb (patch) | |
tree | 959b31b0c20935d8b0813b981ca8e424a3e4ed7d /tests | |
parent | b88e4a9a3bf7cdd1528755bbd18ff3dc3cf6def6 (diff) |
shm tests - disabled clone test
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@637 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests')
-rw-r--r-- | tests/linux-test.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/tests/linux-test.c b/tests/linux-test.c index 14cbe1385e..6ca9029650 100644 --- a/tests/linux-test.c +++ b/tests/linux-test.c @@ -38,6 +38,7 @@ #include <sched.h> #include <dirent.h> #include <setjmp.h> +#include <sys/shm.h> #define TESTPATH "/tmp/linux-test.tmp" #define TESTPORT 7654 @@ -314,12 +315,19 @@ const char socket_msg[] = "hello socket\n"; void test_socket(void) { - int server_fd, client_fd, fd, pid, ret; + int server_fd, client_fd, fd, pid, ret, val; struct sockaddr_in sockaddr; socklen_t len; char buf[512]; server_fd = server_socket(); + + /* test a few socket options */ + len = sizeof(val); + chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len)); + if (val != SOCK_STREAM) + error("getsockopt"); + pid = chk_error(fork()); if (pid == 0) { client_fd = client_socket(); @@ -497,13 +505,32 @@ void test_signal(void) chk_error(sigaction(SIGSEGV, &act, NULL)); } +#define SHM_SIZE 32768 + +void test_shm(void) +{ + void *ptr; + int shmid; + + shmid = chk_error(shmget(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | 0777)); + ptr = shmat(shmid, NULL, 0); + if (!ptr) + error("shmat"); + + memset(ptr, 0, SHM_SIZE); + + chk_error(shmctl(shmid, IPC_RMID, 0)); + chk_error(shmdt(ptr)); +} + int main(int argc, char **argv) { test_file(); test_fork(); test_time(); test_socket(); - test_clone(); + // test_clone(); test_signal(); + test_shm(); return 0; } |