[CRIU] [PATCH] zdtm/socket_close_data01: wait a child before c/r

Andrey Vagin avagin at openvz.org
Tue Dec 22 03:34:18 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

A static test should not change its state during C/R.

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 test/zdtm/live/static/socket_close_data01.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/test/zdtm/live/static/socket_close_data01.c b/test/zdtm/live/static/socket_close_data01.c
index 4ca5a08..53b5f7a 100644
--- a/test/zdtm/live/static/socket_close_data01.c
+++ b/test/zdtm/live/static/socket_close_data01.c
@@ -70,6 +70,15 @@ int main(int argc, char **argv)
 		client("(iter1)");
 		exit(0);
 	}
+	ret = 1;
+	if (wait(&status) == -1) {
+		fail("wait failed");
+		goto unlink;
+	}
+	if (status) {
+		pr_err("A child exited with 0x%x\n", status);
+		goto unlink;
+	}
 
 	test_daemon();
 	test_waitsig();
@@ -83,12 +92,6 @@ int main(int argc, char **argv)
 		goto unlink;
 	}
 
-	ret = 1;
-	if (wait(NULL) == -1) {
-		fail("wait failed");
-		goto unlink;
-	}
-
 	/* Test2: check it's still possible to connect to the bound socket */
 	if (fork() == 0) {
 		exit(client("(iter2)"));
-- 
2.4.3



More information about the CRIU mailing list