[CRIU] [PATCH 2/2] zdtm: Pre-check flock before daemonize in file_locks04 test

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jun 28 10:49:53 PDT 2016


On some kernel (on travis.org, for example) either child
or parent fdinfo do not contain flock information, on the
configuration the test setups.

Pre-check if lock contains in child's fdinfo before the
daemonization, and simply pass if not so.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 test/zdtm/static/file_locks04.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/zdtm/static/file_locks04.c b/test/zdtm/static/file_locks04.c
index dfb7c53..6feb27b 100644
--- a/test/zdtm/static/file_locks04.c
+++ b/test/zdtm/static/file_locks04.c
@@ -105,6 +105,20 @@ int main(int argc, char **argv)
 		return -1;
 	}
 
+	ret = check_file_locks(pid, fd, child_fd);
+	if (ret < 0) {
+		fail("Pre-check failed\n");
+		goto out_kill;
+	} else if (ret == 0) {
+		test_msg("Old kernel?\n");
+		test_daemon();
+		test_waitsig();
+		pass();
+		goto out_kill;
+	}
+
+	test_msg("Daemonize\n");
+
 	test_daemon();
 	test_waitsig();
 



More information about the CRIU mailing list