[CRIU] [PATCH] zdtm: allow to execute shm and msgque in userns

Andrey Vagin avagin at openvz.org
Fri Oct 23 07:56:12 PDT 2015


From: Andrew Vagin <avagin at openvz.org>

Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 test/zdtm.sh                      |  4 ++--
 test/zdtm/live/static/msgque.c    | 15 +++------------
 test/zdtm/live/static/msgque.desc |  2 +-
 test/zdtm/live/static/shm.c       | 16 +++-------------
 test/zdtm/live/static/shm.desc    |  2 +-
 5 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index eced1a9..c938295 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -198,8 +198,8 @@ generate_test_list()
 		ns/static/bind-mount
 		ns/static/utsname
 		ns/static/ipc_namespace
-		static/shm
-		static/msgque
+		ns/static/shm
+		ns/static/msgque
 		ns/static/sem
 		transition/ipc
 		static/netns-nf
diff --git a/test/zdtm/live/static/msgque.c b/test/zdtm/live/static/msgque.c
index f90b7d8..a855bec 100644
--- a/test/zdtm/live/static/msgque.c
+++ b/test/zdtm/live/static/msgque.c
@@ -28,13 +28,15 @@ struct msg1 {
 #define ANOTHER_TEST_STRING "Yet another test sysv5 msg"
 #define ANOTHER_MSG_TYPE 26538
 
-static int test_fn(int argc, char **argv)
+int main(int argc, char **argv)
 {
 	key_t key;
 	int msg, pid;
 	struct msg1 msgbuf;
 	int chret;
 
+	test_init(argc, argv);
+
 	key = ftok(argv[0], 822155650);
 	if (key == -1) {
 		pr_perror("Can't make key");
@@ -134,14 +136,3 @@ err:
 	chret = -errno;
 	goto out;
 }
-
-int main(int argc, char **argv)
-{
-#ifdef NEW_IPC_NS
-	test_init_ns(argc, argv, CLONE_NEWIPC, test_fn);
-#else
-	test_init(argc, argv);
-	test_fn(argc, argv);
-#endif
-	return 0;
-}
diff --git a/test/zdtm/live/static/msgque.desc b/test/zdtm/live/static/msgque.desc
index 63df42a..6c4afe5 100644
--- a/test/zdtm/live/static/msgque.desc
+++ b/test/zdtm/live/static/msgque.desc
@@ -1 +1 @@
-{'flavor': 'h'}
+{'flavor': 'ns uns'}
diff --git a/test/zdtm/live/static/shm.c b/test/zdtm/live/static/shm.c
index 05b2c33..fc90a99 100644
--- a/test/zdtm/live/static/shm.c
+++ b/test/zdtm/live/static/shm.c
@@ -100,7 +100,7 @@ static int check_shm_key(int key, size_t size)
 	return check_shm_id(id, size);
 }
 
-static int test_fn(int argc, char **argv)
+int main(int argc, char **argv)
 {
 	key_t key;
 	int shm;
@@ -110,6 +110,8 @@ static int test_fn(int argc, char **argv)
 	void *mem;
 	uint32_t crc = INIT_CRC;
 
+	test_init(argc, argv);
+
 	key = ftok(argv[0], 822155666);
 	if (key == -1) {
 		pr_perror("Can't make key");
@@ -190,15 +192,3 @@ out_shm:
 out:
 	return ret;
 }
-
-
-int main(int argc, char **argv)
-{
-#ifdef NEW_IPC_NS
-	test_init_ns(argc, argv, CLONE_NEWIPC, test_fn);
-#else
-	test_init(argc, argv);
-	test_fn(argc, argv);
-#endif
-	return 0;
-}
diff --git a/test/zdtm/live/static/shm.desc b/test/zdtm/live/static/shm.desc
index 63df42a..6c4afe5 100644
--- a/test/zdtm/live/static/shm.desc
+++ b/test/zdtm/live/static/shm.desc
@@ -1 +1 @@
-{'flavor': 'h'}
+{'flavor': 'ns uns'}
-- 
2.4.3



More information about the CRIU mailing list