[CRIU] [PATCH 3/4] zdtm: add a test with a lot of file descriptors

Andrey Vagin avagin at openvz.org
Thu Mar 31 22:53:27 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 test/zdtm/static/Makefile |  1 +
 test/zdtm/static/fds.c    | 32 ++++++++++++++++++++++++++++++++
 test/zdtm/static/fds.desc |  1 +
 3 files changed, 34 insertions(+)
 create mode 100644 test/zdtm/static/fds.c
 create mode 100644 test/zdtm/static/fds.desc

diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 8706e59..02dbdf1 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -149,6 +149,7 @@ TST_NOFILE	=				\
 		oom_score_adj			\
 		loginuid			\
 		cgroupns			\
+		fds				\
 #		jobctl00			\
 
 TST_FILE	=				\
diff --git a/test/zdtm/static/fds.c b/test/zdtm/static/fds.c
new file mode 100644
index 0000000..f35d106
--- /dev/null
+++ b/test/zdtm/static/fds.c
@@ -0,0 +1,32 @@
+#include <sys/time.h>
+#include <sys/resource.h>
+
+
+#include "zdtmtst.h"
+
+const char *test_doc	= "Use non-default limit for file descriptors";
+const char *test_author	= "Andrew Vagin <avagin at parallels.com>";
+
+int main(int argc, char **argv)
+{
+	struct rlimit rlim = {102400, 102400};
+	int i;
+
+	test_init(argc, argv);
+
+	setrlimit(RLIMIT_NOFILE, &rlim);
+
+	for (i = 0; i < 2048; i++)
+		if (dup(0) == -1) {
+			pr_perror("dup");
+			return 1;
+		}
+
+	test_daemon();
+	test_waitsig();
+
+
+	pass();
+
+	return 0;
+}
diff --git a/test/zdtm/static/fds.desc b/test/zdtm/static/fds.desc
new file mode 100644
index 0000000..2eac7e6
--- /dev/null
+++ b/test/zdtm/static/fds.desc
@@ -0,0 +1 @@
+{'flags': 'suid'}
-- 
2.5.0



More information about the CRIU mailing list