Refactor mqns testing suite
v5 cover Refactor mqns testing suite
Refactoring mqns testing suite and removing libclone dependency.
Andrea Cervesato (6):
Refactor mqns_01 using new LTP API
Refactor mqns_02 using new LTP API
Refactor mqns_03 using new LTP API
Refactor mqns_04 using new LTP API
Remove deprecated header files from mqns suite
Remove libclone dependency from mqns suite
runtest/containers | 13 +- testcases/kernel/containers/mqns/Makefile | 27 +- testcases/kernel/containers/mqns/mqns.h | 11 - testcases/kernel/containers/mqns/mqns_01.c | 180 +++------- testcases/kernel/containers/mqns/mqns_02.c | 241 +++++-------- testcases/kernel/containers/mqns/mqns_03.c | 318 ++++++++---------- testcases/kernel/containers/mqns/mqns_04.c | 286 ++++++++-------- .../kernel/containers/mqns/mqns_helper.h | 53 --- 8 files changed, 426 insertions(+), 703 deletions(-) delete mode 100644 testcases/kernel/containers/mqns/mqns.h delete mode 100644 testcases/kernel/containers/mqns/mqns_helper.h
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 1/6 Refactor mqns_01 using new LTP API
--- runtest/containers | 3 +- testcases/kernel/containers/mqns/mqns_01.c | 180 +++++++-------------- 2 files changed, 57 insertions(+), 126 deletions(-)
runtest/containers +2 -1
@@ -16,7 +16,8 @@ pidns31 pidns31 pidns32 pidns32 mqns_01 mqns_01 -mqns_01_clone mqns_01 -clone +mqns_01_clone mqns_01 -m clone +mqns_01_unshare mqns_01 -m unshare mqns_02 mqns_02 mqns_02_clone mqns_02 -clone mqns_03 mqns_03
testcases/kernel/containers/mqns/mqns_01.c +55 -125
203 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 2/6 Refactor mqns_02 using new LTP API
In reply to Andrea Cervesato via ltp--- runtest/containers | 3 +- testcases/kernel/containers/mqns/mqns_02.c | 241 +++++++-------------- 2 files changed, 86 insertions(+), 158 deletions(-)
runtest/containers +2 -1
@@ -19,7 +19,8 @@ mqns_01 mqns_01 mqns_01_clone mqns_01 -m clone mqns_01_unshare mqns_01 -m unshare mqns_02 mqns_02 -mqns_02_clone mqns_02 -clone +mqns_02_clone mqns_02 -m clone +mqns_02_unshare mqns_02 -m unshare mqns_03 mqns_03 mqns_03_clone mqns_03 -clone mqns_04 mqns_04
testcases/kernel/containers/mqns/mqns_02.c +84 -157
264 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 3/6 Refactor mqns_03 using new LTP API
In reply to Andrea Cervesato via ltp---
split mq_freed for MQ1 and MQ2
more TINFO messages for debugging
runtest/containers | 3 +- testcases/kernel/containers/mqns/mqns_03.c | 318 +++++++++------------ 2 files changed, 143 insertions(+), 178 deletions(-)
runtest/containers +2 -1
@@ -22,7 +22,8 @@ mqns_02 mqns_02 mqns_02_clone mqns_02 -m clone mqns_02_unshare mqns_02 -m unshare mqns_03 mqns_03 -mqns_03_clone mqns_03 -clone +mqns_03_clone mqns_03 -m clone +mqns_03_unshare mqns_03 -m unshare mqns_04 mqns_04 mqns_04_clone mqns_04 -clone
testcases/kernel/containers/mqns/mqns_03.c +141 -177
348 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 3/6] Refactor mqns_03 using new LTP API
Hi Andrea,
...
runtest/containers mqns_02 mqns_02 · line 26
Quoted 8 lines
+++ b/runtest/containers
runtest/containers +2
-1@@ -22,7 +22,8 @@ mqns_02 mqns_02 mqns_02_clone mqns_02 -m clone mqns_02_unshare mqns_02 -m unshare mqns_03 mqns_03 -mqns_03_clone mqns_03 -clone +mqns_03_clone mqns_03 -m clone +mqns_03_unshare mqns_03 -m unshare
Interesting, it was not run with unshare. +1 for adding it.
Quoted 4 lines
runtest/containers +0
-0mqns_04 mqns_04 mqns_04_clone mqns_04 -clonetestcases/kernel/containers/mqns/mqns_03.c +0
-0
...
Quoted 4 lines
+/*\
+ * [Description]
+ *
+ * Test mqueuefs from an isolated/forked process namespace.
Again, I'd mention supported modes here.
Quoted 6 lines
+ *
+ * [Algorithm]
+ *
+ * - create /MQ1
+ * - mount mqueue inside the temporary folder
+ * - check for /MQ1 existance
Quoted 8 lines
+ * - create /MQ2 inside the temporary folder
+ * - umount
+ * - mount mqueue inside the temporary folder
+ * - check /MQ1 existance
+ * - check /MQ2 existance
+ * - umount
+ */
#define_GNU_SOURCE
I wonder why _GNU_SOURCE was used here and in mqns_04.c. I don't see anything in man mq_open(3), both tests are working without it.
...
testcases/kernel/containers/mqns/mqns_03.c line 149
Quoted 2 lines
testcases/kernel/containers/mqns/mqns_03.c +2
-0+static void cleanup (void ) +{
mqns_04.c checks here:
if (!devdir) return;
Although it's unlikely that SAFE_ASPRINTF(&devdir, "%s/mqueue", tmpdir); in setup() would fail, I'd add it also here.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 3/6] Refactor mqns_03 using new LTP API
Hi Petr,
Quoted 36 lines · Petr Vorel
Hi Andrea,
...
runtest/containers mqns_02 mqns_02 · line 26
Quoted 8 lines
+++ b/runtest/containers
runtest/containers +2
-1@@ -22,7 +22,8 @@ mqns_02 mqns_02 mqns_02_clone mqns_02 -m clone mqns_02_unshare mqns_02 -m unshare mqns_03 mqns_03 -mqns_03_clone mqns_03 -clone +mqns_03_clone mqns_03 -m clone +mqns_03_unshare mqns_03 -m unshareInteresting, it was not run with unshare. +1 for adding it.
Quoted 3 lines
runtest/containers +0
-0mqns_04 mqns_04 mqns_04_clone mqns_04 -clonetestcases/kernel/containers/mqns/mqns_03.c +0
-0...
Quoted 4 lines
+/*\
+ * [Description]
+ *
+ * Test mqueuefs from an isolated/forked process namespace.Again, I'd mention supported modes here.
Quoted 6 lines
+ *
+ * [Algorithm]
+ *
+ * - create /MQ1
+ * - mount mqueue inside the temporary folder
+ * - check for /MQ1 existanceQuoted 8 lines
+ * - create /MQ2 inside the temporary folder
+ * - umount
+ * - mount mqueue inside the temporary folder
+ * - check /MQ1 existance
+ * - check /MQ2 existance
+ * - umount
+ */
#define_GNU_SOURCE
Quoted 2 lines
I wonder why
_GNU_SOURCEwas used here and inmqns_04.c. I don't see anything in manmq_open(3), both tests are working without it.
Because of MAP_ANONYMOUS for mmap
Quoted 4 lines
...
testcases/kernel/containers/mqns/mqns_03.c line 149
Quoted 2 lines
testcases/kernel/containers/mqns/mqns_03.c +2
-0+static void cleanup (void ) +{
mqns_04.cchecks here:
Quoted 8 lines
if (!devdir) return;Although it's unlikely that
SAFE_ASPRINTF(&devdir, "%s/mqueue", tmpdir); insetup()would fail, I'd add it also here.Kind regards,
Petr
Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 3/6] Refactor mqns_03 using new LTP API
Hi Andrea,
...
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
#define _GNU_SOURCEI wonder why
_GNU_SOURCEwas used here and inmqns_04.c. I don't see anything in manmq_open(3), both tests are working without it.Because of
MAP_ANONYMOUSfor mmap
Hm, I see MAP_ANONYMOUS and MAP_ANON not being guarded in glibc nor in musl.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 4/6 Refactor mqns_04 using new LTP API
In reply to Andrea Cervesato via ltp---
split mq_freed for MQ1 and MQ2
more TINFO messages for debugging
runtest/containers | 4 +- testcases/kernel/containers/mqns/mqns_04.c | 286 ++++++++++----------- 2 files changed, 135 insertions(+), 155 deletions(-)
runtest/containers +2 -2
@@ -24,8 +24,8 @@ mqns_02_unshare mqns_02 -m unshare mqns_03 mqns_03 mqns_03_clone mqns_03 -m clone mqns_03_unshare mqns_03 -m unshare -mqns_04 mqns_04 -mqns_04_clone mqns_04 -clone +mqns_04_clone mqns_04 -m clone +mqns_04_unshare mqns_04 -m unshare netns_netlink netns_netlink netns_breakns_ip_ipv4_netlink netns_breakns.sh
testcases/kernel/containers/mqns/mqns_04.c +133 -153
320 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 4/6] Refactor mqns_04 using new LTP API
Hi Andrea,
+++ b/testcases/kernel/containers/mqns/mqns_04.c
...
testcases/kernel/containers/mqns/mqns_04.c line 105
Quoted 4 lines
testcases/kernel/containers/mqns/mqns_04.c +2
-1+tst_res (TINFO ,"Try to create %s from parent" , mqueue2); -mkdir (DEV_MQUEUE2 ,0755 ); +TST_EXP_FAIL (creat (mqueue2,0755 ),EACCES );
OK, you created MQNAME2 (asked by Richie in v4).
testcases/kernel/containers/mqns/mqns_04.c line 110
Quoted 6 lines
testcases/kernel/containers/mqns/mqns_04.c +4
-1+if (!TST_PASS ) +tst_atomic_inc (mq_freed2); -tst_resm (TINFO ,"Checking mqueue filesystem lifetime" ); +SAFE_UMOUNT (devdir); +}
I suppose it does not make sense to spawn plain process as it's done in mqns_03.c, right?
Maybe it'd be worth to mention clone and unshare modes in [Description].
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 4/6] Refactor mqns_04 using new LTP API
Hi Petr,
Quoted 9 lines · Petr Vorel
Hi Andrea,
+++
b/testcases/kernel/containers/mqns/mqns_04.c
...testcases/kernel/containers/mqns/mqns_04.c line 105
Quoted 3 lines
testcases/kernel/containers/mqns/mqns_04.c +2
-1+tst_res (TINFO ,"Try to create %s from parent" , mqueue2); -mkdir (DEV_MQUEUE2 ,0755 ); +TST_EXP_FAIL (creat (mqueue2,0755 ),EACCES );OK, you created MQNAME2 (asked by Richie in v4).
Quoted 7 lines
testcases/kernel/containers/mqns/mqns_04.c line 110
Quoted 5 lines
testcases/kernel/containers/mqns/mqns_04.c +4
-1+if (!TST_PASS ) +tst_atomic_inc (mq_freed2); -tst_resm (TINFO ,"Checking mqueue filesystem lifetime" ); +SAFE_UMOUNT (devdir); +}I suppose it does not make sense to spawn plain process as it's done in
mqns_03.c, right?
Indeed, we don't need plain process and we could just use unshare/clone
Quoted 6 lines
Maybe it'd be worth to mention clone and unshare modes in [Description].
Reviewed-by Petr Vorel <[email protected]>Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 5/6 Remove deprecated header files from mqns suite
In reply to Andrea Cervesato via ltp--- testcases/kernel/containers/mqns/mqns.h | 11 ---- .../kernel/containers/mqns/mqns_helper.h | 53 ------------------- 2 files changed, 64 deletions(-) delete mode 100644 testcases/kernel/containers/mqns/mqns.h delete mode 100644 testcases/kernel/containers/mqns/mqns_helper.h
testcases/kernel/containers/mqns/mqns.h deleted +0 -11
@@ -1,11 +0,0 @@ -#ifndef __MQNS_H -#define __MQNS_H - -#define DEV_MQUEUE "/dev/mqueue" -#define DEV_MQUEUE2 "/dev/mqueue2" -#define SLASH_MQ1 "/MQ1" -#define NOSLASH_MQ1 "MQ1" -#define SLASH_MQ2 "/MQ2" -#define NOSLASH_MQ2 "MQ2" - -#endif /* __MQNS_H */
testcases/kernel/containers/mqns/mqns_helper.h deleted +0 -53
53 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 6/6 Remove libclone dependency from mqns suite
In reply to Andrea Cervesato via ltp--- testcases/kernel/containers/mqns/Makefile | 27 +++++------------------ 1 file changed, 5 insertions(+), 22 deletions(-)
testcases/kernel/containers/mqns/Makefile +5 -22
@@ -1,29 +1,12 @@ -################################################################################ -## ## -## Copyright (c) International Business Machines Corp., 2009 ## -## Copyright (c) Nadia Derbey, 2009 ## -## ## -## This program is free software; you can redistribute it and#or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## This program is distributed in the hope that it will be useful, but ## -## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## -## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## -## for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## -## ## -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) International Business Machines Corp., 2009 +# Copyright (c) Nadia Derbey, 2009 +# Copyright (C) 2021 SUSE LLC Andrea Cervesato <[email protected]> top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc -LDLIBS := -lpthread -lrt -lclone $(LDLIBS) +LDLIBS := -lpthread -lrt $(LDLIBS) include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp