Refactor mqns testing suite
v6 cover Refactor mqns testing suite
From: Andrea Cervesato <[email protected]>
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 | 14 +- testcases/kernel/containers/mqns/Makefile | 27 +- testcases/kernel/containers/mqns/mqns.h | 11 - testcases/kernel/containers/mqns/mqns_01.c | 184 ++++------ testcases/kernel/containers/mqns/mqns_02.c | 245 +++++--------- testcases/kernel/containers/mqns/mqns_03.c | 320 ++++++++---------- testcases/kernel/containers/mqns/mqns_04.c | 291 ++++++++-------- .../kernel/containers/mqns/mqns_helper.h | 53 --- 8 files changed, 440 insertions(+), 705 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 v6 1/6 Refactor mqns_01 using new LTP API
From: Andrea Cervesato <[email protected]>
--- runtest/containers | 3 +- testcases/kernel/containers/mqns/mqns_01.c | 184 +++++++-------------- 2 files changed, 61 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 +59 -125
207 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 v6 1/6] Refactor mqns_01 using new LTP API
Hi Andrea,
runtest/containers pidns31 pidns31 · line 19
Quoted 10 lines
runtest/containers +1
-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
I'd be for renaming these testcases to rename the underscore (e.g. from mqns_01.c to mqns01.c). But this can be done any time later.
testcases/kernel/containers/mqns/mqns_01.c line 1
Quoted 11 lines
runtest/containers +1
-0+mqns_01_unshare mqns_01 -m unshare mqns_02 mqns_02 mqns_02_clone mqns_02 -clone mqns_03 mqns_03testcases/kernel/containers/mqns/mqns_01.c +1
-0@@ -1,148 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0
It should be GPL-2.0-or-later
I'm going to fix it before merge.
Quoted 16 lines
testcases/kernel/containers/mqns/mqns_01.c +0
-15/* -* 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. -* -* Check mqns isolation: father mqns cannot be accessed from newinstance -* -* Mount mqueue fs -* Create a posix mq -->mq1 -* unshare -* In unshared process: -* Mount newinstance mqueuefs -* Check that mq1 is not readable from new ns
testcases/kernel/containers/mqns/mqns_01.c line 11
Quoted 10 lines
testcases/kernel/containers/mqns/mqns_01.c +8
-1+* Copyright (c) International Business Machines Corp., 2009 +* Copyright (c) Nadia Derbey, 2009 <[email protected]> +* Copyright (C) 2023 SUSE LLC Andrea Cervesato <[email protected]> +*/ -***************************************************************************/ +/*\ +* [Description] +* +* Create a mqueue inside the parent and check if it can be accessed from
maybe:
Create a mqueue inside the parent and verify it cannot be accessed from the child namespace.
Quoted 124 lines
testcases/kernel/containers/mqns/mqns_01.c +34
-70+* the child namespace. +*/ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include <sys/wait.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include "mqns.h" -#include "mqns_helper.h" +#include "tst_test.h" +#include "lapi/sched.h" +#include "tst_safe_posix_ipc.h" -char *TCID ="posixmq_namespace_01" ; -int TST_TOTAL =1 ; +#define MQNAME "/MQ1" -int p1[2 ]; -int p2[2 ]; +static mqd_t mqd; +static char *str_op; -int check_mqueue (void *vtest) +static void run (void ) { -char buf[30 ]; -mqd_t mqd; +const struct tst_clone_args clone_args = {CLONE_NEWIPC ,SIGCHLD }; - (void ) vtest; +tst_res (TINFO ,"Checking namespaces isolation from parent to child" ); -close (p1[1 ]); -close (p2[0 ]); +if (str_op && !strcmp (str_op,"clone" )) { +tst_res (TINFO ,"Spawning isolated process" ); -if (read (p1[0 ], buf,strlen ("go" ) +1 ) <0 ) { -printf ("read(p1[0], ...) failed: %s\n" ,strerror (errno)); -exit (1 ); - } - mqd =tst_syscall (__NR_mq_open,NOSLASH_MQ1 ,O_RDONLY ); -if (mqd ==-1 ) { -if (write (p2[1 ],"notfnd" ,strlen ("notfnd" ) +1 ) <0 ) { -perror ("write(p2[1], ...) failed" ); -exit (1 ); +if (!SAFE_CLONE (&clone_args)) { +TST_EXP_FAIL (mq_open (MQNAME ,O_RDONLY ),ENOENT ); +return ; + } + }else if (str_op && !strcmp (str_op,"unshare" )) { +tst_res (TINFO ,"Spawning unshared process" ); + +if (!SAFE_FORK ()) { +SAFE_UNSHARE (CLONE_NEWIPC ); +TST_EXP_FAIL (mq_open (MQNAME ,O_RDONLY ),ENOENT ); +return ; } }else { -if (write (p2[1 ],"exists" ,strlen ("exists" ) +1 ) <0 ) { -perror ("write(p2[1], \"exists\", 7) failed" ); -exit (1 ); - }else if (mq_close (mqd) <0 ) { -perror ("mq_close(mqd) failed" ); -exit (1 ); +tst_res (TINFO ,"Spawning plain process" ); + +if (!SAFE_FORK ()) { +TST_EXP_POSITIVE (mq_open (MQNAME ,O_RDONLY )); +return ; } } - -exit (0 ); }static void setup (void ) { -tst_require_root (); -check_mqns (); + mqd =SAFE_MQ_OPEN (MQNAME ,O_RDWR |O_CREAT |O_EXCL ,0777 ,NULL ); } -int main (int argc,char *argv[]) +static void cleanup (void ) { -int r; -mqd_t mqd; -char buf[30 ]; -int use_clone =T_UNSHARE ; - -setup (); - -if (argc ==2 &&strcmp (argv[1 ],"-clone" ) ==0 ) { -tst_resm (TINFO , -"Testing posix mq namespaces through clone(2)." ); - use_clone =T_CLONE ; - }else -tst_resm (TINFO , -"Testing posix mq namespaces through unshare(2)." ); - -if (pipe (p1) ==-1 ||pipe (p2) ==-1 ) { -tst_brkm (TBROK |TERRNO ,NULL ,"pipe failed" ); - } - - mqd =tst_syscall (__NR_mq_open,NOSLASH_MQ1 ,O_RDWR |O_CREAT |O_EXCL , -0777 ,NULL ); -if (mqd ==-1 ) { -perror ("mq_open" ); -tst_brkm (TFAIL ,NULL ,"mq_open failed" ); +if (mqd !=-1 ) { +SAFE_MQ_CLOSE (mqd); +SAFE_MQ_UNLINK (MQNAME ); } - -tst_resm (TINFO ,"Checking namespaces isolation from parent to child" ); -/* fire off the test */ - r =do_clone_unshare_test (use_clone,CLONE_NEWIPC , check_mqueue,NULL ); -if (r <0 ) {
testcases/kernel/containers/mqns/mqns_01.c line 128
Quoted 10 lines
testcases/kernel/containers/mqns/mqns_01.c +0
-10-tst_resm (TFAIL ,"failed clone/unshare" ); -mq_close (mqd); -tst_syscall (__NR_mq_unlink,NOSLASH_MQ1 ); -tst_exit (); - } - -close (p1[0 ]); -close (p2[1 ]); -if (write (p1[1 ],"go" ,strlen ("go" ) +1 ) <0 ) -tst_resm (TBROK |TERRNO ,"write(p1[1], \"go\", ...) failed" );
The old version actually communicate between parent and child proces over pipe (p1, p2 arrays). Is it all of these useless? I wonder myself what have POSIX message queues together with pipes.
I'm sorry if I overlook discussion about it in the past (looked at various versions; it'd be worth to mention changes like this in the commit message).
Kind regards,
Petr
Quoted 36 lines
testcases/kernel/containers/mqns/mqns_01.c +16
-19-else if (read (p2[0 ], buf,7 ) <0 ) -tst_resm (TBROK |TERRNO ,"read(p2[0], buf, ...) failed" ); -else { -if (!strcmp (buf,"exists" )) { -tst_resm (TFAIL ,"child process found mqueue" ); - }else if (!strcmp (buf,"notfnd" )) { -tst_resm (TPASS ,"child process didn't find mqueue" ); - }else { -tst_resm (TFAIL ,"UNKNOWN RESULT" ); - } - } - -/* destroy the mqueue */ -if (mq_close (mqd) ==-1 ) { -tst_brkm (TBROK |TERRNO ,NULL ,"mq_close failed" ); - } -tst_syscall (__NR_mq_unlink,NOSLASH_MQ1 ); - -tst_exit (); } + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .cleanup = cleanup, + .needs_root =1 , + .forks_child =1 , + .options = (struct tst_option []) { + {"m:" , &str_op,"Child process isolation <clone|unshare>" }, + {}, + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +NULL + }, +};
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v6 1/6] Refactor mqns_01 using new LTP API
Hi!
Quoted 13 lines · Petr Vorel
Hi Andrea,
runtest/containers pidns31 pidns31 · line 18
Quoted 9 lines
runtest/containers +1
-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 cloneI'd be for renaming these testcases to rename the underscore (e.g. from
mqns_01.ctomqns01.c). But this can be done any time later.
There are so many tests without convention. We should create it before changing this test specifically.
Quoted 164 lines
testcases/kernel/containers/mqns/mqns_01.c line 1
Quoted 11 lines
runtest/containers +1
-0+mqns_01_unshare mqns_01 -m unshare mqns_02 mqns_02 mqns_02_clone mqns_02 -clone mqns_03 mqns_03testcases/kernel/containers/mqns/mqns_01.c +1
-0@@ -1,148 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0 It should be GPL-2.0-or-later
I'm going to fix it before merge.
Quoted 15 lines
testcases/kernel/containers/mqns/mqns_01.c +0
-14/* -* 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. -* -* Check mqns isolation: father mqns cannot be accessed from newinstance -* -* Mount mqueue fs -* Create a posix mq -->mq1 -* unshare -* In unshared process: -* Mount newinstance mqueuefs testcases/kernel/containers/mqns/mqns_01.c line 11
Quoted 10 lines
testcases/kernel/containers/mqns/mqns_01.c +8
-2-* Check that mq1 is not readable from new ns +* Copyright (c) International Business Machines Corp., 2009 +* Copyright (c) Nadia Derbey, 2009 <[email protected]> +* Copyright (C) 2023 SUSE LLC Andrea Cervesato <[email protected]> +*/ -***************************************************************************/ +/*\ +* [Description] +* +* Create a mqueue inside the parent and check if it can be accessed from maybe:
Create a mqueue inside the parent and verify it cannot be accessed from the child namespace.Quoted 120 lines
testcases/kernel/containers/mqns/mqns_01.c +34
-75+* the child namespace. +*/ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include <sys/wait.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include "mqns.h" -#include "mqns_helper.h" +#include "tst_test.h" +#include "lapi/sched.h" +#include "tst_safe_posix_ipc.h" -char *TCID ="posixmq_namespace_01" ; -int TST_TOTAL =1 ; +#define MQNAME "/MQ1" -int p1[2 ]; -int p2[2 ]; +static mqd_t mqd; +static char *str_op; -int check_mqueue (void *vtest) +static void run (void ) { -char buf[30 ]; -mqd_t mqd; +const struct tst_clone_args clone_args = {CLONE_NEWIPC ,SIGCHLD }; - (void ) vtest; +tst_res (TINFO ,"Checking namespaces isolation from parent to child" ); -close (p1[1 ]); -close (p2[0 ]); +if (str_op && !strcmp (str_op,"clone" )) { +tst_res (TINFO ,"Spawning isolated process" ); -if (read (p1[0 ], buf,strlen ("go" ) +1 ) <0 ) { -printf ("read(p1[0], ...) failed: %s\n" ,strerror (errno)); -exit (1 ); - } - mqd =tst_syscall (__NR_mq_open,NOSLASH_MQ1 ,O_RDONLY ); -if (mqd ==-1 ) { -if (write (p2[1 ],"notfnd" ,strlen ("notfnd" ) +1 ) <0 ) { -perror ("write(p2[1], ...) failed" ); -exit (1 ); +if (!SAFE_CLONE (&clone_args)) { +TST_EXP_FAIL (mq_open (MQNAME ,O_RDONLY ),ENOENT ); +return ; + } + }else if (str_op && !strcmp (str_op,"unshare" )) { +tst_res (TINFO ,"Spawning unshared process" ); + +if (!SAFE_FORK ()) { +SAFE_UNSHARE (CLONE_NEWIPC ); +TST_EXP_FAIL (mq_open (MQNAME ,O_RDONLY ),ENOENT ); +return ; } }else { -if (write (p2[1 ],"exists" ,strlen ("exists" ) +1 ) <0 ) { -perror ("write(p2[1], \"exists\", 7) failed" ); -exit (1 ); - }else if (mq_close (mqd) <0 ) { -perror ("mq_close(mqd) failed" ); -exit (1 ); +tst_res (TINFO ,"Spawning plain process" ); + +if (!SAFE_FORK ()) { +TST_EXP_POSITIVE (mq_open (MQNAME ,O_RDONLY )); +return ; } } - -exit (0 ); }static void setup (void ) { -tst_require_root (); -check_mqns (); + mqd =SAFE_MQ_OPEN (MQNAME ,O_RDWR |O_CREAT |O_EXCL ,0777 ,NULL ); } -int main (int argc,char *argv[]) +static void cleanup (void ) { -int r; -mqd_t mqd; -char buf[30 ]; -int use_clone =T_UNSHARE ; - -setup (); - -if (argc ==2 &&strcmp (argv[1 ],"-clone" ) ==0 ) { -tst_resm (TINFO , -"Testing posix mq namespaces through clone(2)." ); - use_clone =T_CLONE ; - }else -tst_resm (TINFO , -"Testing posix mq namespaces through unshare(2)." ); - -if (pipe (p1) ==-1 ||pipe (p2) ==-1 ) { -tst_brkm (TBROK |TERRNO ,NULL ,"pipe failed" ); - } - - mqd =tst_syscall (__NR_mq_open,NOSLASH_MQ1 ,O_RDWR |O_CREAT |O_EXCL , -0777 ,NULL ); -if (mqd ==-1 ) { -perror ("mq_open" ); -tst_brkm (TFAIL ,NULL ,"mq_open failed" ); +if (mqd !=-1 ) { +SAFE_MQ_CLOSE (mqd); +SAFE_MQ_UNLINK (MQNAME ); } - -tst_resm (TINFO ,"Checking namespaces isolation from parent to child" ); -/* fire off the test */ - r =do_clone_unshare_test (use_clone,CLONE_NEWIPC , check_mqueue,NULL ); -if (r <0 ) { -tst_resm (TFAIL ,"failed clone/unshare" ); -mq_close (mqd); -tst_syscall (__NR_mq_unlink,NOSLASH_MQ1 ); -tst_exit (); - }
Quoted 8 lines
testcases/kernel/containers/mqns/mqns_01.c line 128
Quoted 5 lines
testcases/kernel/containers/mqns/mqns_01.c +0
-5- -close (p1[0 ]); -close (p2[1 ]); -if (write (p1[1 ],"go" ,strlen ("go" ) +1 ) <0 ) -tst_resm (TBROK |TERRNO ,"write(p1[1], \"go\", ...) failed" );The old version actually communicate between parent and child proces over pipe (p1, p2 arrays). Is it all of these useless? I wonder myself what have POSIX message queues together with pipes.
pipes were used because LTP didn't support tests result from children.
Quoted 34 lines
I'm sorry if I overlook discussion about it in the past (looked at various versions; it'd be worth to mention changes like this in the commit message).
Kind regards,
PetrQuoted 28 lines
testcases/kernel/containers/mqns/mqns_01.c +8
-19-else if (read (p2[0 ], buf,7 ) <0 ) -tst_resm (TBROK |TERRNO ,"read(p2[0], buf, ...) failed" ); -else { -if (!strcmp (buf,"exists" )) { -tst_resm (TFAIL ,"child process found mqueue" ); - }else if (!strcmp (buf,"notfnd" )) { -tst_resm (TPASS ,"child process didn't find mqueue" ); - }else { -tst_resm (TFAIL ,"UNKNOWN RESULT" ); - } - } - -/* destroy the mqueue */ -if (mq_close (mqd) ==-1 ) { -tst_brkm (TBROK |TERRNO ,NULL ,"mq_close failed" ); - } -tst_syscall (__NR_mq_unlink,NOSLASH_MQ1 ); - -tst_exit (); } + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .cleanup = cleanup, + .needs_root =1 , + .forks_child =1 , + .options = (struct tst_option []) {
Quoted 8 lines
testcases/kernel/containers/mqns/mqns_01.c line 82
Quoted 8 lines
testcases/kernel/containers/mqns/mqns_01.c +8
-0+ { "m:", &str_op, "Child process isolation <clone|unshare>" }, + {}, + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +NULL + }, +};
Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v6 1/6] Refactor mqns_01 using new LTP API
In reply to Andrea CervesatoHi Andrea,
runtest/containers pidns31 pidns31 · line 18
Quoted 5 lines
+++ b/runtest/containers
runtest/containers +0
-0@@ -16,7 +16,8 @@ pidns31 pidns31 pidns32 pidns32 mqns_01 mqns_01
Also, if anybody run this tests without params, it's actually not testing unshade as it was before (i.e. the default case is doing something different, than the main purpose of the test).
runtest/containers pidns31 pidns31 · line 20
Quoted 3 lines
runtest/containers +2
-1-mqns_01_clone mqns_01 -clone +mqns_01_clone mqns_01 -m clone +mqns_01_unshare mqns_01 -m unshare
BTW I'm verbose on changes during rewrite, I'd notice the fact that one extra run, which tests just fork (i.e. case where pass - the opposite is expected).
testcases/kernel/containers/mqns/mqns_01.c line 12
Quoted 6 lines
testcases/kernel/containers/mqns/mqns_01.c +6
-0+++ b/testcases/kernel/containers/mqns/mqns_01.c +/*\ +* [Description] +* +* Create a mqueue inside the parent and check if it can be accessed from +* the child namespace.
Actually my previous note "verify if cannot" is invalid, when -m is not set (fork call). Again, I'd mention it here.
...
Quoted 13 lines
testcases/kernel/containers/mqns/mqns_01.c +11
-0+if (!SAFE_CLONE (&clone_args)) { +TST_EXP_FAIL (mq_open (MQNAME ,O_RDONLY ),ENOENT ); +return ; + } + }else if (str_op && !strcmp (str_op,"unshare" )) { +tst_res (TINFO ,"Spawning unshared process" ); + +if (!SAFE_FORK ()) { +SAFE_UNSHARE (CLONE_NEWIPC ); +TST_EXP_FAIL (mq_open (MQNAME ,O_RDONLY ),ENOENT ); +return ; } }else {
testcases/kernel/containers/mqns/mqns_01.c line 49
Quoted 10 lines
testcases/kernel/containers/mqns/mqns_01.c +4
-6-if (write (p2[1 ],"exists" ,strlen ("exists" ) +1 ) <0 ) { -perror ("write(p2[1], \"exists\", 7) failed" ); -exit (1 ); - }else if (mq_close (mqd) <0 ) { -perror ("mq_close(mqd) failed" ); -exit (1 ); +tst_res (TINFO ,"Spawning plain process" ); + +if (!SAFE_FORK ()) { +TST_EXP_POSITIVE (mq_open (MQNAME ,O_RDONLY ));
nit: shouldn't this be TST_EXP_FD() (no real change, just extra "fd" being printed.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v6 1/6] Refactor mqns_01 using new LTP API
Hi!
Quoted 9 lines · Petr Vorel
Hi Andrea,
runtest/containers pidns31 pidns31 · line 17
Quoted 4 lines
+++ b/runtest/containers
runtest/containers +0
-0@@ -16,7 +16,8 @@ pidns31 pidns31 pidns32 pidns32 mqns_01 mqns_01Also, if anybody run this tests without params, it's actually not testing unshade as it was before (i.e. the default case is doing something different, than the main purpose of the test).
It's now testing also the plain process test case. All namespaces tests which have this testcase, "unshare" variant is set via option. If no options are given, then plain process is created.
Quoted 34 lines
runtest/containers pidns31 pidns31 · line 20
Quoted 4 lines
runtest/containers +2
-1-mqns_01_clone mqns_01 -clone +mqns_01_clone mqns_01 -m clone +mqns_01_unshare mqns_01 -m unshareBTW I'm verbose on changes during rewrite, I'd notice the fact that one extra run, which tests just fork (i.e. case where pass - the opposite is expected).
testcases/kernel/containers/mqns/mqns_01.c line 12
Quoted 6 lines
testcases/kernel/containers/mqns/mqns_01.c +6
-0+++ b/testcases/kernel/containers/mqns/mqns_01.c +/*\ +* [Description] +* +* Create a mqueue inside the parent and check if it can be accessed from +* the child namespace. Actually my previous note "verify if cannot" is invalid, when -m is not set (fork call). Again, I'd mention it here.
...
Quoted 16 lines
testcases/kernel/containers/mqns/mqns_01.c +11
-3+if (!SAFE_CLONE (&clone_args)) { +TST_EXP_FAIL (mq_open (MQNAME ,O_RDONLY ),ENOENT ); +return ; + } + }else if (str_op && !strcmp (str_op,"unshare" )) { +tst_res (TINFO ,"Spawning unshared process" ); + +if (!SAFE_FORK ()) { +SAFE_UNSHARE (CLONE_NEWIPC ); +TST_EXP_FAIL (mq_open (MQNAME ,O_RDONLY ),ENOENT ); +return ; } }else { -if (write (p2[1 ],"exists" ,strlen ("exists" ) +1 ) <0 ) { -perror ("write(p2[1], \"exists\", 7) failed" ); -exit (1 );
Quoted 8 lines
testcases/kernel/containers/mqns/mqns_01.c line 49
Quoted 7 lines
testcases/kernel/containers/mqns/mqns_01.c +4
-3- }else if (mq_close (mqd) <0 ) { -perror ("mq_close(mqd) failed" ); -exit (1 ); +tst_res (TINFO ,"Spawning plain process" ); + +if (!SAFE_FORK ()) { +TST_EXP_POSITIVE (mq_open (MQNAME ,O_RDONLY ));nit: shouldn't this be
TST_EXP_FD()(no real change, just extra "fd" being printed.
mq_open doesn't create a FD, but a queue identifier.
Quoted 2 lines
Kind regards,
Petr
Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v6 2/6 Refactor mqns_02 using new LTP API
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
--- runtest/containers | 3 +- testcases/kernel/containers/mqns/mqns_02.c | 245 ++++++++------------- 2 files changed, 90 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 +88 -157
268 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v6 3/6 Refactor mqns_03 using new LTP API
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
--- runtest/containers | 4 +- testcases/kernel/containers/mqns/mqns_03.c | 320 +++++++++------------ 2 files changed, 145 insertions(+), 179 deletions(-)
runtest/containers +2 -2
@@ -21,8 +21,8 @@ mqns_01_unshare mqns_01 -m unshare 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 +143 -177
350 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v6 4/6 Refactor mqns_04 using new LTP API
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
--- runtest/containers | 4 +- testcases/kernel/containers/mqns/mqns_04.c | 291 ++++++++++----------- 2 files changed, 139 insertions(+), 156 deletions(-)
runtest/containers +2 -2
@@ -23,8 +23,8 @@ mqns_02_clone mqns_02 -m clone mqns_02_unshare mqns_02 -m unshare 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 +137 -154
324 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v6 5/6 Remove deprecated header files from mqns suite
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
--- 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 v6 6/6 Remove libclone dependency from mqns suite
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
--- 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