[CRIU] [PATCH 1/3] zdtm: call test_init() before doing anything

Andrei Vagin avagin at openvz.org
Thu Dec 29 17:28:36 PST 2016


From: Andrei Vagin <avagin at virtuozzo.com>

test_init() has to be executed first, because it prepares a container.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 test/zdtm/static/cow01.c         | 4 ++--
 test/zdtm/static/mntns_ghost.c   | 2 +-
 test/zdtm/static/mntns_ro_root.c | 3 ++-
 test/zdtm/static/socket-ext.c    | 4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/test/zdtm/static/cow01.c b/test/zdtm/static/cow01.c
index 9ccd650..ce57458 100644
--- a/test/zdtm/static/cow01.c
+++ b/test/zdtm/static/cow01.c
@@ -452,14 +452,14 @@ int main(int argc, char ** argv)
 	task_waiter_t child_waiter;
 	int pfd[2], fd;
 
+	test_init(argc, argv);
+
 	task_waiter_init(&child_waiter);
 
 	memset(zero_page, 0, sizeof(zero_page));
 
 	datasum(zero_page, sizeof(zero_page), &zero_crc);
 
-	test_init(argc, argv);
-
 	if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, pfd)) {
 		pr_perror("pipe");
 		return 1;
diff --git a/test/zdtm/static/mntns_ghost.c b/test/zdtm/static/mntns_ghost.c
index 4635e77..dca0c34 100644
--- a/test/zdtm/static/mntns_ghost.c
+++ b/test/zdtm/static/mntns_ghost.c
@@ -29,8 +29,8 @@ int main(int argc, char **argv)
 	pid_t pid = -1;
 	int status = 1;
 
-	task_waiter_init(&lock);
 	test_init(argc, argv);
+	task_waiter_init(&lock);
 
 	pid = fork();
 	if (pid < 0) {
diff --git a/test/zdtm/static/mntns_ro_root.c b/test/zdtm/static/mntns_ro_root.c
index 613c25a..365be50 100644
--- a/test/zdtm/static/mntns_ro_root.c
+++ b/test/zdtm/static/mntns_ro_root.c
@@ -29,9 +29,10 @@ int main(int argc, char **argv)
 	pid_t pid = -1;
 	int status = 1;
 
-	task_waiter_init(&lock);
 	test_init(argc, argv);
 
+	task_waiter_init(&lock);
+
 	pid = fork();
 	if (pid < 0) {
 		pr_perror("fork");
diff --git a/test/zdtm/static/socket-ext.c b/test/zdtm/static/socket-ext.c
index bfc2925..219eeec 100644
--- a/test/zdtm/static/socket-ext.c
+++ b/test/zdtm/static/socket-ext.c
@@ -66,11 +66,11 @@ int main(int argc, char *argv[])
 		return 0;
 	}
 
-	test_init(argc, argv);
-
 	task_waiter_wait4(&lock, 1);
 	task_waiter_fini(&lock);
 
+	test_init(argc, argv);
+
 	sk = socket(AF_UNIX, SOCK_DGRAM, 0);
 	if (sk < 0) {
 		pr_perror("Can't create socket");
-- 
2.7.4



More information about the CRIU mailing list