From 2e0e295b51afb3b178515d7ad75debf8a8be6ebc Mon Sep 17 00:00:00 2001 From: Kinsbursky Stanislav Date: Fri, 10 Feb 2012 15:03:40 +0300 Subject: [PATCH 1/4] zdtm: don't wait in IPC queue on message operations Otherwise test will sleep in kernel in case of queue is emptry on read or queue is full on write. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Andrey Vagin --- test/zdtm/live/static/msgque.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/zdtm/live/static/msgque.c b/test/zdtm/live/static/msgque.c index e56ac8db4..2fe53a36c 100644 --- a/test/zdtm/live/static/msgque.c +++ b/test/zdtm/live/static/msgque.c @@ -59,7 +59,7 @@ static int test_fn(int argc, char **argv) if (pid == 0) { test_waitsig(); - if (msgrcv(msg, &msgbuf, sizeof(TEST_STRING), MSG_TYPE, 0) == -1) { + if (msgrcv(msg, &msgbuf, sizeof(TEST_STRING), MSG_TYPE, IPC_NOWAIT) == -1) { fail("Child: msgrcv failed (%m)"); return -errno; } @@ -72,7 +72,7 @@ static int test_fn(int argc, char **argv) msgbuf.mtype = ANOTHER_MSG_TYPE; memcpy(msgbuf.mtext, ANOTHER_TEST_STRING, sizeof(ANOTHER_TEST_STRING)); - if (msgsnd(msg, &msgbuf, sizeof(ANOTHER_TEST_STRING), 0) != 0) { + if (msgsnd(msg, &msgbuf, sizeof(ANOTHER_TEST_STRING), IPC_NOWAIT) != 0) { fail("Child: msgsnd failed (%m)"); return -errno; }; @@ -81,7 +81,7 @@ static int test_fn(int argc, char **argv) } else { msgbuf.mtype = MSG_TYPE; memcpy(msgbuf.mtext, TEST_STRING, sizeof(TEST_STRING)); - if (msgsnd(msg, &msgbuf, sizeof(TEST_STRING), 0) != 0) { + if (msgsnd(msg, &msgbuf, sizeof(TEST_STRING), IPC_NOWAIT) != 0) { fail("Parent: msgsnd failed (%m)"); goto err_kill; }; @@ -99,7 +99,7 @@ static int test_fn(int argc, char **argv) goto out; } - if (msgrcv(msg, &msgbuf, sizeof(ANOTHER_TEST_STRING), ANOTHER_MSG_TYPE, 0) == -1) { + if (msgrcv(msg, &msgbuf, sizeof(ANOTHER_TEST_STRING), ANOTHER_MSG_TYPE, IPC_NOWAIT) == -1) { fail("Parent: msgrcv failed (%m)"); goto err; } From 6c0b5becf58625e203ffc805456895b1aebc377b Mon Sep 17 00:00:00 2001 From: Kinsbursky Stanislav Date: Fri, 10 Feb 2012 13:02:53 +0300 Subject: [PATCH 2/4] zdtm: add static/shm test to IPC ns tests list Signed-off-by: Stanislav Kinsbursky Signed-off-by: Andrey Vagin --- test/zdtm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/zdtm.sh b/test/zdtm.sh index 22b644639..3b9000500 100644 --- a/test/zdtm.sh +++ b/test/zdtm.sh @@ -39,6 +39,7 @@ static/utsname IPC_TEST_LIST=" static/ipc_namespace +static/shm " CRTOOLS=`pwd`/`dirname $0`/../crtools From a9f130fd82b3b5d2ff1dd50acaaffd26d61f1dbe Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Tue, 14 Feb 2012 16:07:39 +0400 Subject: [PATCH 3/4] zdtm: don't kill test processes in case an error We want to have maximum info about an error. --- test/zdtm.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/zdtm.sh b/test/zdtm.sh index 3b9000500..c2076cb2f 100644 --- a/test/zdtm.sh +++ b/test/zdtm.sh @@ -65,14 +65,7 @@ run_test() echo Dump $pid mkdir -p $ddump - setsid $CRTOOLS dump -D $ddump -o dump.log -t $pid $args - ret=$? - while :; do - killall -9 $tname &> /dev/null || break - echo Waiting... - sleep 1 - done - [ "$ret" -eq 0 ] || return 1 + setsid $CRTOOLS dump -D $ddump -o dump.log -t $pid $args || return 1; if expr "$args" : ' -s'; then killall -CONT $tname From 2109271601d68f5ed52303dd92b195a7e99ed610 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Tue, 14 Feb 2012 16:22:44 +0400 Subject: [PATCH 4/4] zdtm: transmit to crtools dump This functionality is used to check that dump isn't destructive. --- test/zdtm.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/zdtm.sh b/test/zdtm.sh index c2076cb2f..f4229f182 100644 --- a/test/zdtm.sh +++ b/test/zdtm.sh @@ -65,9 +65,9 @@ run_test() echo Dump $pid mkdir -p $ddump - setsid $CRTOOLS dump -D $ddump -o dump.log -t $pid $args || return 1; + setsid $CRTOOLS dump -D $ddump -o dump.log -t $pid $args $ARGS || return 1; - if expr "$args" : ' -s'; then + if expr " $ARGS" : ' -s'; then killall -CONT $tname else while :; do @@ -116,7 +116,6 @@ if [ "$1" == "-d" ]; then fi if [ $# -eq 0 ]; then - ARGS=$1 for t in $TEST_LIST; do run_test $t || case_error $t done