Commit cf74b78b authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

zdtm: Add simple forking test (it fails now)

I haven't found anything similar in there.

It currently just fails most of the launches because seize doesn't work
with zombies, but I'm working on it...

However, when it manages to miss the zombie it triggers the problem with
freezer (fixed by previous patch).
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 11b7e14a
...@@ -22,6 +22,7 @@ $ZP/static/file_shared ...@@ -22,6 +22,7 @@ $ZP/static/file_shared
$ZP/streaming/pipe_loop00 $ZP/streaming/pipe_loop00
$ZP/streaming/pipe_shared00 $ZP/streaming/pipe_shared00
$ZP/transition/file_read $ZP/transition/file_read
$ZP/transition/fork
$ZP/static/socket_listen" $ZP/static/socket_listen"
CRTOOLS=`pwd`/`dirname $0`/../crtools CRTOOLS=`pwd`/`dirname $0`/../crtools
......
...@@ -8,6 +8,7 @@ TST_NOFILE = \ ...@@ -8,6 +8,7 @@ TST_NOFILE = \
ipc \ ipc \
ptrace \ ptrace \
epoll \ epoll \
fork \
TST_FILE = \ TST_FILE = \
......
#include <stdio.h>
#include <sys/ptrace.h>
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <sys/user.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include "zdtmtst.h"
const char *test_doc = "Tests that forking tasks are handled properly";
const char *test_author = "Pavel Emelyanov <xemul@parallels.com>";
int main(int argc, char **argv)
{
int pid, wpid, status;
test_init(argc, argv);
test_daemon();
while (test_go()) {
pid = fork();
if (pid < 0) {
fail("Can't fork");
goto out;
}
if (pid == 0)
exit(0);
wpid = wait(&status);
if (wpid != pid) {
fail("Pids do not match");
goto out;
}
if (!WIFEXITED(status)) {
fail("Task didn't exit");
goto out;
}
if (WEXITSTATUS(status) != 0) {
fail("Task exited with wrong code");
goto out;
}
}
test_waitsig();
pass();
out:
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment