2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

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: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
Pavel Emelyanov
2012-01-19 19:26:28 +04:00
committed by Cyrill Gorcunov
parent 11b7e14a6b
commit cf74b78bdc
3 changed files with 58 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ $ZP/static/file_shared
$ZP/streaming/pipe_loop00
$ZP/streaming/pipe_shared00
$ZP/transition/file_read
$ZP/transition/fork
$ZP/static/socket_listen"
CRTOOLS=`pwd`/`dirname $0`/../crtools

View File

@@ -8,6 +8,7 @@ TST_NOFILE = \
ipc \
ptrace \
epoll \
fork \
TST_FILE = \

View File

@@ -0,0 +1,56 @@
#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;
}