[CRIU] [PATCH 1/3] test: wait when a prepartion stage will be completed
Andrey Vagin
avagin at openvz.org
Tue Dec 22 06:06:06 PST 2015
From: Andrei Vagin <avagin at openvz.org>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
test/zdtm/live/static/chroot-file.c | 1 +
test/zdtm/live/static/maps01.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/test/zdtm/live/static/chroot-file.c b/test/zdtm/live/static/chroot-file.c
index 70abf52..94f5842 100644
--- a/test/zdtm/live/static/chroot-file.c
+++ b/test/zdtm/live/static/chroot-file.c
@@ -74,6 +74,7 @@ int main(int argc, char **argv)
res = ERR_PIPES;
read(pipe_prep[0], &res, 1);
+ read(pipe_prep[0], &res, 1); /* wait when a descriptor will be closed */
if (res != SUCCESS) {
if (res == ERR_PIPES)
pr_perror("broken pipes");
diff --git a/test/zdtm/live/static/maps01.c b/test/zdtm/live/static/maps01.c
index d25e805..024dff1 100644
--- a/test/zdtm/live/static/maps01.c
+++ b/test/zdtm/live/static/maps01.c
@@ -27,9 +27,12 @@ int main(int argc, char ** argv)
uint32_t crc;
pid_t pid = -1;
int status, fd;
+ task_waiter_t t;
test_init(argc, argv);
+ task_waiter_init(&t);
+
m = mmap(NULL, MEM_SIZE, PROT_WRITE | PROT_READ,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
@@ -70,6 +73,8 @@ int main(int argc, char ** argv)
crc = ~0;
datagen(p3, PAGE_SIZE, &crc);
+ task_waiter_complete(&t, 1);
+
test_waitsig();
crc = ~0;
@@ -98,6 +103,7 @@ int main(int argc, char ** argv)
return 1;
return 0;
}
+ task_waiter_wait4(&t, 1);
munmap(p, MEM_OFFSET);
p2 = mremap(p + MEM_OFFSET, MEM_OFFSET, MEM_OFFSET, MREMAP_FIXED | MREMAP_MAYMOVE, p2);
--
2.4.3
More information about the CRIU
mailing list