[CRIU] [PATCH] zdtm: add more logging messages

Andrew Vagin avagin at openvz.org
Wed Jan 29 21:24:52 PST 2014


Tests fail sometimes, but logs don't contain enough information:
Execute zdtm/live/static/umask00
./umask00 --pidfile=umask00.pid --outfile=umask00.out --mask=0345
make[3]: *** [umask00.pid] Error 1
ERROR: fail to start zdtm/live/static/umask00

Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 test/zdtm/lib/ns.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index 3550caf..eca3736 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -216,7 +216,8 @@ int ns_init(int argc, char **argv)
 	}
 	ret = 1;
 	waitpid(pid, &ret, 0);
-
+	if (ret)
+		fprintf(stderr, "The test returned non-zero code %d\n", ret);
 
 	pid = fork();
 	if (pid == 0) {
@@ -293,11 +294,15 @@ void ns_create(int argc, char **argv)
 
 	status = 1;
 	ret = read(args.status_pipe[0], &status, sizeof(status));
-	if (ret != sizeof(status) || status)
+	if (ret != sizeof(status) || status) {
+		fprintf(stderr, "The test failed (%d, %d)\n", ret, status);
 		exit(1);
+	}
 	ret = read(args.status_pipe[0], &status, sizeof(status));
-	if (ret != 0)
+	if (ret != 0) {
+		fprintf(stderr, "Unexpected message from test\n");
 		exit(1);
+	}
 
 	pidfile = getenv("ZDTM_PIDFILE");
 	if (pidfile == NULL)
-- 
1.8.5.3



More information about the CRIU mailing list