Commit d9287469 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: check, that stopped tasks are restored correctly

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 79d47a93
...@@ -94,6 +94,7 @@ static/sk-netlink ...@@ -94,6 +94,7 @@ static/sk-netlink
static/proc-self static/proc-self
static/grow_map static/grow_map
static/grow_map02 static/grow_map02
static/stopped
static/chroot static/chroot
static/chroot-file static/chroot-file
" "
......
...@@ -102,6 +102,7 @@ TST_NOFILE = \ ...@@ -102,6 +102,7 @@ TST_NOFILE = \
grow_map \ grow_map \
grow_map02 \ grow_map02 \
tun \ tun \
stopped \
# jobctl00 \ # jobctl00 \
TST_FILE = \ TST_FILE = \
......
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include "zdtmtst.h"
const char *test_doc = "Check, that stopped tasts are restored correctly";
const char *test_author = "Andrew Vagin <avagin@parallels.com>";
int main(int argc, char **argv)
{
pid_t pid;
int p[2], ret, status;
test_init(argc, argv);
if (pipe(p)) {
err("Unable to create pipe");
return 1;
}
pid = test_fork();
if (pid < 0)
return -1;
else if (pid == 0) {
char c;
close(p[1]);
ret = read(p[0], &c, 1);
if (ret != 1) {
err("Unable to read: %d", ret);
return 1;
}
ret = read(p[0], &c, 1);
if (ret != 0) {
err("Unable to read: %d", ret);
return 1;
}
return 0;
}
close(p[0]);
kill(pid, SIGSTOP);
write(p[1], "0", 1);
test_daemon();
test_waitsig();
kill(pid, SIGCONT);
if (waitpid(pid, &status, WCONTINUED) == -1) {
err("Unable to wait child");
goto out;
}
if (WIFCONTINUED(status))
pass();
else
fail("The process doesn't continue");
out:
close(p[1]);
waitpid(pid, &status, 0);
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