mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 07:15:31 +00:00
zdtm: check, that stopped tasks are restored correctly
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
79d47a939d
commit
d92874697b
@@ -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 = \
|
|||||||
grow_map \
|
grow_map \
|
||||||
grow_map02 \
|
grow_map02 \
|
||||||
tun \
|
tun \
|
||||||
|
stopped \
|
||||||
# jobctl00 \
|
# jobctl00 \
|
||||||
|
|
||||||
TST_FILE = \
|
TST_FILE = \
|
||||||
|
67
test/zdtm/live/static/stopped.c
Normal file
67
test/zdtm/live/static/stopped.c
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#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;
|
||||||
|
}
|
Reference in New Issue
Block a user