Refactor mqns testing suite
v3 cover Refactor mqns testing suite
mqns testing suite has been refactored using new LTP API
Andrea Cervesato (7):
Add more safe macros for mqueue API
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
Delete deprecated mqns header files
Rename common.h into mqns.h for mqns suite
include/tst_safe_posix_ipc.h | 45 +++ runtest/containers | 12 +- testcases/kernel/containers/mqns/Makefile | 27 +- testcases/kernel/containers/mqns/mqns.h | 108 ++++++- testcases/kernel/containers/mqns/mqns_01.c | 185 ++++-------- testcases/kernel/containers/mqns/mqns_02.c | 217 ++++---------- testcases/kernel/containers/mqns/mqns_03.c | 269 +++++++----------- testcases/kernel/containers/mqns/mqns_04.c | 263 ++++++++--------- .../kernel/containers/mqns/mqns_helper.h | 56 ---- 9 files changed, 485 insertions(+), 697 deletions(-) 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 v3 1/7 Add more safe macros for mqueue API
Added SAFE_MQ_UNLINK and SAFE_MQ_CLOSE in tst_safe_posix_ipc.h
--- include/tst_safe_posix_ipc.h | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
include/tst_safe_posix_ipc.h +45 -0
@@ -12,6 +12,12 @@#define SAFE_MQ_OPEN (pathname, oflags, ...) \ safe_mq_open(__FILE__, __LINE__, (pathname), (oflags), ##__VA_ARGS__) +#define SAFE_MQ_CLOSE (__mqdes) \ + safe_mq_close(__FILE__, __LINE__, (__mqdes)) + +#define SAFE_MQ_UNLINK (name) \ + safe_mq_unlink(__FILE__, __LINE__, (name)) +static inline int safe_mq_open (const char *file,const int lineno,const char *pathname,int oflags, ...) {
@@ -41,6 +47,45 @@ static inline int safe_mq_open(const char *file, const int lineno,tst_brk_ (file, lineno,TBROK |TERRNO ,"mq_open(%s,%d,%04o,%p) failed" , pathname, oflags, mode, attr); + }else if (rval <0 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"Invalid mq_open(%s) return value %d" , pathname, rval); + } + +return rval; +} + +static inline int safe_mq_close (const char *file,const int lineno, +mqd_t __mqdes) +{ +int rval; + + rval =mq_close (__mqdes); + +if (rval ==-1 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"mq_close(%d) failed" , __mqdes); + }else if (rval <0 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"Invalid mq_close(%d) return value %d" , __mqdes, rval); + } + +return rval; +} + +static inline int safe_mq_unlink (const char *file,const int lineno, +const char * name) +{ +int rval; + + rval =mq_unlink (name); + +if (rval ==-1 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"mq_unlink(%s) failed" , name); + }else if (rval <0 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"Invalid mq_unlink(%s) return value %d" , name, rval); }return rval;
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v3 1/7] Add more safe macros for mqueue API
Hi Andrea,
Quoted 1 line
Added
SAFE_MQ_UNLINKandSAFE_MQ_CLOSEintst_safe_posix_ipc.h
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Richard Palethorpe
AppliedRe: [LTP] [PATCH v3 1/7] Add more safe macros for mqueue API
In reply to Andrea Cervesato via ltpHello,
Merged, thanks!
Quoted 72 lines · Andrea Cervesato via ltp
Added
SAFE_MQ_UNLINKandSAFE_MQ_CLOSEintst_safe_posix_ipc.hSigned-off-by Andrea Cervesato <[email protected]>--- include/tst_safe_posix_ipc.h | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)include/tst_safe_posix_ipc.h +45
-0@@ -12,6 +12,12 @@#define SAFE_MQ_OPEN (pathname, oflags, ...) \ safe_mq_open(__FILE__, __LINE__, (pathname), (oflags), ##__VA_ARGS__) +#define SAFE_MQ_CLOSE (__mqdes) \ + safe_mq_close(__FILE__, __LINE__, (__mqdes)) + +#define SAFE_MQ_UNLINK (name) \ + safe_mq_unlink(__FILE__, __LINE__, (name)) +static inline int safe_mq_open (const char *file,const int lineno,const char *pathname,int oflags, ...) {@@ -41,6 +47,45 @@ static inline int safe_mq_open(const char *file, const int lineno,tst_brk_ (file, lineno,TBROK |TERRNO ,"mq_open(%s,%d,%04o,%p) failed" , pathname, oflags, mode, attr); + }else if (rval <0 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"Invalid mq_open(%s) return value %d" , pathname, rval); + } + +return rval; +} + +static inline int safe_mq_close (const char *file,const int lineno, +mqd_t __mqdes) +{ +int rval; + + rval =mq_close (__mqdes); + +if (rval ==-1 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"mq_close(%d) failed" , __mqdes); + }else if (rval <0 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"Invalid mq_close(%d) return value %d" , __mqdes, rval); + } + +return rval; +} + +static inline int safe_mq_unlink (const char *file,const int lineno, +const char * name) +{ +int rval; + + rval =mq_unlink (name); + +if (rval ==-1 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"mq_unlink(%s) failed" , name); + }else if (rval <0 ) { +tst_brk_ (file, lineno,TBROK |TERRNO , +"Invalid mq_unlink(%s) return value %d" , name, rval); }return rval;Signature · 1 line
2.35.3
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 2/7 Refactor mqns_01 using new LTP API
In reply to Andrea Cervesato via ltp--- runtest/containers | 3 +- testcases/kernel/containers/mqns/common.h | 101 +++++++++++ testcases/kernel/containers/mqns/mqns_01.c | 193 +++++++-------------- 3 files changed, 166 insertions(+), 131 deletions(-) create mode 100644 testcases/kernel/containers/mqns/common.h
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/common.h new file +101 -0
101 lines not on this page · raw message
testcases/kernel/containers/mqns/mqns_01.c +63 -130
211 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 v3 2/7] Refactor mqns_01 using new LTP API
Hello,
Quoted 49 lines · Andrea Cervesato via ltp
Signed-off-by Andrea Cervesato <[email protected]>--- runtest/containers | 3 +- testcases/kernel/containers/mqns/common.h | 101 +++++++++++ testcases/kernel/containers/mqns/mqns_01.c | 193 +++++++-------------- 3 files changed, 166 insertions(+), 131 deletions(-) create mode 100644 testcases/kernel/containers/mqns/common.hruntest/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_03testcases/kernel/containers/mqns/common.h new file +21
-0@@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2022 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +#ifndef MQNS_H +#define MQNS_H + +#include <stdlib.h> +#include "lapi/namespaces_constants.h" +#include "tst_test.h" +#include "tst_safe_posix_ipc.h" + +enum { +T_CLONE , +T_UNSHARE , +T_NONE , +}; + +static int dummy_child1 (void *v) +{
testcases/kernel/containers/mqns/common.h
Quoted 10 lines
testcases/kernel/containers/mqns/common.h new file +9
-0+ (void )v; +return 0 ; +} + +static inline void check_newipc (void ) +{ +int pid, status; + + pid =ltp_clone_quick (CLONE_NEWIPC |SIGCHLD , dummy_child1,NULL );
ltp_clone_quick is still part of the old API and only uses clone2. I think it should be replaced with tst_clone. This may require extending tst_clone. In fact we probably need a test variant to switch between the clone2 and clone3 syscalls when using tst_clone.
I'll leave it to you whether you want to try that and rebase this patch set on it.
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v3 2/7] Refactor mqns_01 using new LTP API
Hi!
Quoted 68 lines · Richard Palethorpe
Hello,
Quoted 49 lines · Andrea Cervesato via ltp
Signed-off-by Andrea Cervesato <[email protected]>--- runtest/containers | 3 +- testcases/kernel/containers/mqns/common.h | 101 +++++++++++ testcases/kernel/containers/mqns/mqns_01.c | 193 +++++++-------------- 3 files changed, 166 insertions(+), 131 deletions(-)create mode 100644
testcases/kernel/containers/mqns/common.hruntest/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_03testcases/kernel/containers/mqns/common.h new file +21
-0@@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2022 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +#ifndef MQNS_H +#define MQNS_H + +#include <stdlib.h> +#include "lapi/namespaces_constants.h" +#include "tst_test.h" +#include "tst_safe_posix_ipc.h" + +enum { +T_CLONE , +T_UNSHARE , +T_NONE , +}; + +static int dummy_child1 (void *v) +{testcases/kernel/containers/mqns/common.h
Quoted 10 lines
testcases/kernel/containers/mqns/common.h new file +9
-0+ (void )v; +return 0 ; +} + +static inline void check_newipc (void ) +{ +int pid, status; + + pid =ltp_clone_quick (CLONE_NEWIPC |SIGCHLD , dummy_child1,NULL );
ltp_clone_quickis still part of the old API and only uses clone2. I think it should be replaced withtst_clone. This may require extendingtst_clone. In fact we probably need a test variant to switch between the clone2 and clone3 syscalls when usingtst_clone.
Quoted 3 lines
I'll leave it to you whether you want to try that and rebase this patch set on it.
I see ltp_clone_quick as wrapper of ltp_clone, since it's using ltp_alloc_stack without calling it explicitly all the times before ltp_clone.
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v3 2/7] Refactor mqns_01 using new LTP API
Hello,
Quoted 70 lines · Andrea Cervesato
Hi!
Quoted 67 lines · Richard Palethorpe
Hello,
Quoted 48 lines · Andrea Cervesato via ltp
Signed-off-by Andrea Cervesato <[email protected]>--- runtest/containers | 3 +- testcases/kernel/containers/mqns/common.h | 101 +++++++++++ testcases/kernel/containers/mqns/mqns_01.c | 193 +++++++-------------- 3 files changed, 166 insertions(+), 131 deletions(-)create mode 100644
testcases/kernel/containers/mqns/common.hruntest/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_03testcases/kernel/containers/mqns/common.h new file +21
-0@@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2022 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +#ifndef MQNS_H +#define MQNS_H + +#include <stdlib.h> +#include "lapi/namespaces_constants.h" +#include "tst_test.h" +#include "tst_safe_posix_ipc.h" + +enum { +T_CLONE , +T_UNSHARE , +T_NONE , +}; + +static int dummy_child1 (void *v) +{testcases/kernel/containers/mqns/common.h
Quoted 10 lines
testcases/kernel/containers/mqns/common.h new file +9
-0+ (void )v; +return 0 ; +} + +static inline void check_newipc (void ) +{ +int pid, status; + + pid =ltp_clone_quick (CLONE_NEWIPC |SIGCHLD , dummy_child1,NULL );
ltp_clone_quickis still part of the old API and only uses clone2. I think it should be replaced withtst_clone. This may require extendingtst_clone. In fact we probably need a test variant to switch between the clone2 and clone3 syscalls when usingtst_clone.
Quoted 6 lines
Quoted 3 lines
I'll leave it to you whether you want to try that and rebase this patch set on it.
I see
ltp_clone_quickas wrapper ofltp_clone, since it's usingltp_alloc_stackwithout calling it explicitly all the times beforeltp_clone.
ltp_clone is also part of the old API. At some point we should remove that.
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v3 2/7] Refactor mqns_01 using new LTP API
Hello,
Quoted 77 lines · Richard Palethorpe
Hello,
Quoted 73 lines · Andrea Cervesato
Hi!
Quoted 70 lines · Richard Palethorpe
Hello,
Quoted 48 lines · Andrea Cervesato via ltp
Signed-off-by Andrea Cervesato <[email protected]>--- runtest/containers | 3 +- testcases/kernel/containers/mqns/common.h | 101 +++++++++++ testcases/kernel/containers/mqns/mqns_01.c | 193 +++++++-------------- 3 files changed, 166 insertions(+), 131 deletions(-)create mode 100644
testcases/kernel/containers/mqns/common.hruntest/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_03testcases/kernel/containers/mqns/common.h new file +21
-0@@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2022 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +#ifndef MQNS_H +#define MQNS_H + +#include <stdlib.h> +#include "lapi/namespaces_constants.h" +#include "tst_test.h" +#include "tst_safe_posix_ipc.h" + +enum { +T_CLONE , +T_UNSHARE , +T_NONE , +}; + +static int dummy_child1 (void *v) +{testcases/kernel/containers/mqns/common.h
Quoted 10 lines
testcases/kernel/containers/mqns/common.h new file +9
-0+ (void )v; +return 0 ; +} + +static inline void check_newipc (void ) +{ +int pid, status; + + pid =ltp_clone_quick (CLONE_NEWIPC |SIGCHLD , dummy_child1,NULL );
ltp_clone_quickis still part of the old API and only uses clone2. I think it should be replaced withtst_clone. This may require extendingtst_clone. In fact we probably need a test variant to switch between the clone2 and clone3 syscalls when usingtst_clone.I'll leave it to you whether you want to try that and rebase this patch set on it.
Quoted 6 lines
Quoted 3 lines
I see
ltp_clone_quickas wrapper ofltp_clone, since it's usingltp_alloc_stackwithout calling it explicitly all the times beforeltp_clone.
ltp_cloneis also part of the old API. At some point we should remove that.
I'm marking this as changes requested. tst_clone should be made to support this scenario.
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v3 2/7] Refactor mqns_01 using new LTP API
Hi
Are we sure that we don't need this modification before adding tst_clone? We can add the patch and then starting to think how to replace tst_clone_quick with tst_clone in all tests.
Andrea
Quoted 89 lines · Richard Palethorpe
Hello,
Quoted 74 lines · Richard Palethorpe
Hello,
Quoted 70 lines · Andrea Cervesato
Hi!
Quoted 67 lines · Richard Palethorpe
Hello,
Quoted 48 lines · Andrea Cervesato via ltp
Signed-off-by Andrea Cervesato <[email protected]>--- runtest/containers | 3 +- testcases/kernel/containers/mqns/common.h | 101 +++++++++++ testcases/kernel/containers/mqns/mqns_01.c | 193 +++++++-------------- 3 files changed, 166 insertions(+), 131 deletions(-)create mode 100644
testcases/kernel/containers/mqns/common.hruntest/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_03testcases/kernel/containers/mqns/common.h new file +21
-0@@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2022 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +#ifndef MQNS_H +#define MQNS_H + +#include <stdlib.h> +#include "lapi/namespaces_constants.h" +#include "tst_test.h" +#include "tst_safe_posix_ipc.h" + +enum { +T_CLONE , +T_UNSHARE , +T_NONE , +}; + +static int dummy_child1 (void *v) +{testcases/kernel/containers/mqns/common.h
Quoted 10 lines
testcases/kernel/containers/mqns/common.h new file +9
-0+ (void )v; +return 0 ; +} + +static inline void check_newipc (void ) +{ +int pid, status; + + pid =ltp_clone_quick (CLONE_NEWIPC |SIGCHLD , dummy_child1,NULL );
ltp_clone_quickis still part of the old API and only uses clone2. I think it should be replaced withtst_clone. This may require extendingtst_clone. In fact we probably need a test variant to switch between the clone2 and clone3 syscalls when usingtst_clone.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I'll leave it to you whether you want to try that and rebase this patch set on it.
I see
ltp_clone_quickas wrapper ofltp_clone, since it's usingltp_alloc_stackwithout calling it explicitly all the times beforeltp_clone.
ltp_cloneis also part of the old API. At some point we should remove that.I'm marking this as changes requested.
tst_cloneshould be made to support this scenario.
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v3 2/7] Refactor mqns_01 using new LTP API
Hello,
Quoted 5 lines · Andrea Cervesato
Hi
Are we sure that we don't need this modification before adding
tst_clone? We can add the patch and then starting to think how to replacetst_clone_quickwithtst_clonein all tests.
You're not the first person to use this argument. So it's actually important for precisely the reason you don't want to do it. The next person wont' want to do it either and we'll sleep walk into never replacing it.
Meanwhile there are solid reasons why clone3 exists and why we should test it. That's possibly more important than the API conversion.
BTW I could take over one of these patches and do the work on tst_clone? I'm pretty familiar with it.
Quoted 93 lines
Andrea
Quoted 89 lines · Richard Palethorpe
Hello,
Quoted 74 lines · Richard Palethorpe
Hello,
Quoted 70 lines · Andrea Cervesato
Hi!
Quoted 67 lines · Richard Palethorpe
Hello,
Quoted 48 lines · Andrea Cervesato via ltp
Signed-off-by Andrea Cervesato <[email protected]>--- runtest/containers | 3 +- testcases/kernel/containers/mqns/common.h | 101 +++++++++++ testcases/kernel/containers/mqns/mqns_01.c | 193 +++++++-------------- 3 files changed, 166 insertions(+), 131 deletions(-)create mode 100644
testcases/kernel/containers/mqns/common.hruntest/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_03testcases/kernel/containers/mqns/common.h new file +21
-0@@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2022 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +#ifndef MQNS_H +#define MQNS_H + +#include <stdlib.h> +#include "lapi/namespaces_constants.h" +#include "tst_test.h" +#include "tst_safe_posix_ipc.h" + +enum { +T_CLONE , +T_UNSHARE , +T_NONE , +}; + +static int dummy_child1 (void *v) +{testcases/kernel/containers/mqns/common.h
Quoted 10 lines
testcases/kernel/containers/mqns/common.h new file +9
-0+ (void )v; +return 0 ; +} + +static inline void check_newipc (void ) +{ +int pid, status; + + pid =ltp_clone_quick (CLONE_NEWIPC |SIGCHLD , dummy_child1,NULL );
ltp_clone_quickis still part of the old API and only uses clone2. I think it should be replaced withtst_clone. This may require extendingtst_clone. In fact we probably need a test variant to switch between the clone2 and clone3 syscalls when usingtst_clone.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I'll leave it to you whether you want to try that and rebase this patch set on it.
I see
ltp_clone_quickas wrapper ofltp_clone, since it's usingltp_alloc_stackwithout calling it explicitly all the times beforeltp_clone.
ltp_cloneis also part of the old API. At some point we should remove that.I'm marking this as changes requested.
tst_cloneshould be made to support this scenario.
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v3 2/7] Refactor mqns_01 using new LTP API
Hi
Quoted 14 lines · Richard Palethorpe
Hello,
Quoted 5 lines · Andrea Cervesato
Hi
Are we sure that we don't need this modification before adding
tst_clone? We can add the patch and then starting to think how to replacetst_clone_quickwithtst_clonein all tests.You're not the first person to use this argument. So it's actually important for precisely the reason you don't want to do it. The next person wont' want to do it either and we'll sleep walk into never replacing it.
Quoted 5 lines
Meanwhile there are solid reasons why clone3 exists and why we should test it. That's possibly more important than the API conversion.
BTW I could take over one of these patches and do the work on
tst_clone? I'm pretty familiar with it.
I can take care to change all tst_quick_clone after pushing these patches, no problem.
If you have an example how to use tst_clone, please do so. I will repeat the same patter to all remaining tests. Thanks!
Andrea
Quoted 93 lines
Quoted 92 lines
Andrea
Quoted 89 lines · Richard Palethorpe
Hello,
Quoted 74 lines · Richard Palethorpe
Hello,
Quoted 70 lines · Andrea Cervesato
Hi!
Quoted 67 lines · Richard Palethorpe
Hello,
Quoted 48 lines · Andrea Cervesato via ltp
Signed-off-by Andrea Cervesato <[email protected]>--- runtest/containers | 3 +- testcases/kernel/containers/mqns/common.h | 101 +++++++++++ testcases/kernel/containers/mqns/mqns_01.c | 193 +++++++-------------- 3 files changed, 166 insertions(+), 131 deletions(-)create mode 100644
testcases/kernel/containers/mqns/common.hruntest/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_03testcases/kernel/containers/mqns/common.h new file +21
-0@@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2022 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +#ifndef MQNS_H +#define MQNS_H + +#include <stdlib.h> +#include "lapi/namespaces_constants.h" +#include "tst_test.h" +#include "tst_safe_posix_ipc.h" + +enum { +T_CLONE , +T_UNSHARE , +T_NONE , +}; + +static int dummy_child1 (void *v) +{testcases/kernel/containers/mqns/common.h
Quoted 10 lines
testcases/kernel/containers/mqns/common.h new file +9
-0+ (void )v; +return 0 ; +} + +static inline void check_newipc (void ) +{ +int pid, status; + + pid =ltp_clone_quick (CLONE_NEWIPC |SIGCHLD , dummy_child1,NULL );
ltp_clone_quickis still part of the old API and only uses clone2. I think it should be replaced withtst_clone. This may require extendingtst_clone. In fact we probably need a test variant to switch between the clone2 and clone3 syscalls when usingtst_clone.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I'll leave it to you whether you want to try that and rebase this patch set on it.
I see
ltp_clone_quickas wrapper ofltp_clone, since it's usingltp_alloc_stackwithout calling it explicitly all the times beforeltp_clone.
ltp_cloneis also part of the old API. At some point we should remove that.I'm marking this as changes requested.
tst_cloneshould be made to support this scenario.
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 3/7 Refactor mqns_02 using new LTP API
In reply to Andrea Cervesato via ltp--- runtest/containers | 3 +- testcases/kernel/containers/mqns/mqns_02.c | 225 ++++++--------------- 2 files changed, 67 insertions(+), 161 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 +65 -160
245 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 4/7 Refactor mqns_03 using new LTP API
In reply to Andrea Cervesato via ltp--- runtest/containers | 3 +- testcases/kernel/containers/mqns/mqns_03.c | 271 ++++++++------------- 2 files changed, 100 insertions(+), 174 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 +98 -173
305 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 5/7 Refactor mqns_04 using new LTP API
In reply to Andrea Cervesato via ltp--- runtest/containers | 3 +- testcases/kernel/containers/mqns/mqns_04.c | 265 +++++++++------------ 2 files changed, 114 insertions(+), 154 deletions(-)
runtest/containers +2 -1
@@ -25,7 +25,8 @@ 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 +112 -153
299 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 6/7 Delete deprecated mqns header files
In reply to Andrea Cervesato via ltp--- testcases/kernel/containers/mqns/Makefile | 27 ++------- testcases/kernel/containers/mqns/mqns.h | 11 ---- .../kernel/containers/mqns/mqns_helper.h | 56 ------------------- 3 files changed, 5 insertions(+), 89 deletions(-) delete mode 100644 testcases/kernel/containers/mqns/mqns.h delete mode 100644 testcases/kernel/containers/mqns/mqns_helper.h
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
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 -56
56 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 7/7 Rename common.h into mqns.h for mqns suite
In reply to Andrea Cervesato via ltp---
testcases/kernel/containers/mqns/{common.h => mqns.h} | 0
testcases/kernel/containers/mqns/mqns_01.c | 2 +-
testcases/kernel/containers/mqns/mqns_02.c | 2 +-
testcases/kernel/containers/mqns/mqns_03.c | 2 +-
testcases/kernel/containers/mqns/mqns_04.c | 2 +-
5 files changed, 4 insertions(+), 4 deletions(-)
rename testcases/kernel/containers/mqns/{common.h => mqns.h} (100%)testcases/kernel/containers/mqns/mqns.h renamed from testcases/kernel/containers/mqns/common.h +0 -0
testcases/kernel/containers/mqns/mqns_01.c +1 -1
@@ -12,7 +12,7 @@* the isolated/forked child namespace. */ -#include "common.h" +#include "mqns.h" #define MQNAME "/MQ1"
testcases/kernel/containers/mqns/mqns_02.c +1 -1
@@ -12,7 +12,7 @@* then check namespace isolation. */ -#include "common.h" +#include "mqns.h" #define MQNAME "/MQ1"
testcases/kernel/containers/mqns/mqns_03.c +1 -1
@@ -25,7 +25,7 @@#define _GNU_SOURCE#include <stdio.h> -#include "common.h" +#include "mqns.h" #include "tst_safe_stdio.h" #define MQNAME1 "/MQ1"
testcases/kernel/containers/mqns/mqns_04.c +1 -1
@@ -24,7 +24,7 @@#define _GNU_SOURCE#include <stdio.h> -#include "common.h" +#include "mqns.h" #include "tst_safe_stdio.h" #define CHECK_MQ_OPEN_RET (x) ((x) >= 0 || ((x) == -1 && errno != EMFILE))
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v3 7/7] Rename common.h into mqns.h for mqns suite
Hi Andrea,
Quoted 3 lines
Signed-off-by Andrea Cervesato <[email protected]>--- testcases/kernel/containers/mqns/{common.h => mqns.h} | 0
could you please also fix this checkpatch error (preferably as a separate patch):
mqns.h:37: ERROR: "foo* bar" should be "foo *bar"
mqns.h:96: WARNING: __func__ should be used instead of gcc specific __FUNCTION__
Checkpatch also reports wrong comment style, but I'd ignore it (complains for *.h, it's ok for *.c):
mqns.h:1: WARNING: Improper SPDX comment style for 'mqns.h', please use '/*' instead
@Richie: not sure I might have asked before: it'd be great to have make target also for header files, so that they are checked with make check. Now we have to run checkpatch manually to check them.
Kind regards,
Petr
Quoted 6 lines
testcases/kernel/containers/mqns/mqns_01.c | 2 +-
testcases/kernel/containers/mqns/mqns_02.c | 2 +-
testcases/kernel/containers/mqns/mqns_03.c | 2 +-
testcases/kernel/containers/mqns/mqns_04.c | 2 +-
5 files changed, 4 insertions(+), 4 deletions(-)
rename testcases/kernel/containers/mqns/{common.h => mqns.h} (100%)...
Patch itself it's obviously correct.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/1 tools: Check headers with checkpatch.pl
checkpatch.pl doesn't load included headers so they must be passed to it specifically. This change automatically includes headers from the current directory. Manual intervention is still required if a test author changes a header located elsewhere. However you can now write 'make check-header.h', once in the correct directory.
Note that our Sparse based tool (amongst others) loads headers and checks at least some of the content.
--- include/mk/env_post.mk | 1 + include/mk/generic_leaf_target.inc | 2 +- include/mk/rules.mk | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-)
include/mk/env_post.mk +1 -0
@@ -92,6 +92,7 @@ endif CHECK_TARGETS ?= $(addprefix check-,$(notdir $(patsubst %.c,%,$(sort $(wildcard $(abs_srcdir)/*.c))))) CHECK_TARGETS := $(filter-out $(addprefix check-, $(FILTER_OUT_MAKE_TARGETS)), $(CHECK_TARGETS)) +CHECK_HEADER_TARGETS ?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.h)))) CHECK ?= $(abs_top_srcdir)/tools/sparse/sparse-ltp CHECK_NOFLAGS ?= $(abs_top_srcdir)/scripts/checkpatch.pl -f --no-tree --terse --no-summary --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING SHELL_CHECK ?= $(abs_top_srcdir)/scripts/checkbashisms.pl --force --extra
include/mk/generic_leaf_target.inc +1 -1
@@ -110,6 +110,6 @@ $(INSTALL_FILES): | $(INSTALL_DEPS) install: $(INSTALL_FILES) $(CHECK_TARGETS): | $(CHECK_DEPS) -check: $(CHECK_TARGETS) $(SHELL_CHECK_TARGETS) +check: $(CHECK_HEADER_TARGETS) $(CHECK_TARGETS) $(SHELL_CHECK_TARGETS) # vim: syntax=make
include/mk/rules.mk +9 -0
@@ -57,6 +57,15 @@ else @-$(CHECK) $(CHECK_FLAGS) $(CPPFLAGS) $(CFLAGS) $< endif +.PHONY: $(CHECK_HEADER_TARGETS) +$(CHECK_HEADER_TARGETS): check-%.h: %.h +ifdef VERBOSE + -$(CHECK_NOFLAGS) $< +else + @echo CHECK $(target_rel_dir)$< + @-$(CHECK_NOFLAGS) $< +endif + .PHONY: $(SHELL_CHECK_TARGETS) $(SHELL_CHECK_TARGETS): check-%.sh: %.sh ifdef VERBOSE
Signature · 5 lines
2.36.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH] tools: Check headers with checkpatch.pl
Hi Richie,
Quoted 8 lines
checkpatch.pl doesn't load included headers so they must be passed to it specifically. This change automatically includes headers from the current directory. Manual intervention is still required if a test author changes a header located elsewhere. However you can now write 'make
check-header.h', once in the correct directory.Note that our Sparse based tool (amongst others) loads headers and checks at least some of the content.
Thanks a lot for implementing this.
LGTM, just a small nit: target for headers contain .h extension. Shouldn't we add .c for C sources for consistency?
It'đ strange, that make check in testcases/misc/math/float/ does not include tfloat.h, but make check-tfloat.h prints errors. But make check in lib/ works as expected (adds also *.h).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH] tools: Check headers with checkpatch.pl
Hello,
Quoted 11 lines · Petr Vorel
Hi Richie,
Quoted 8 lines
checkpatch.pl doesn't load included headers so they must be passed to it specifically. This change automatically includes headers from the current directory. Manual intervention is still required if a test author changes a header located elsewhere. However you can now write 'make
check-header.h', once in the correct directory.Note that our Sparse based tool (amongst others) loads headers and checks at least some of the content.
Quoted 8 lines
Thanks a lot for implementing this.
LGTM, just a small nit: target for headers contain .h extension. Shouldn't we add .c for C sources for consistency?
It'đ strange, that make check in testcases/misc/math/float/ does not include
tfloat.h, but makecheck-tfloat.hprints errors. But make check inlib/works as expected (adds also *.h).
The Sparse based tool does include headers though. So really we are checking the target which includes more than just a single c file.
Quoted 5 lines
Reviewed-by Petr Vorel <[email protected]>Kind regards,
Petr
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH] tools: Check headers with checkpatch.pl
...
Quoted 9 lines
Quoted 6 lines
LGTM, just a small nit: target for headers contain .h extension. Shouldn't we add .c for C sources for consistency?
It'd strange, that make check in testcases/misc/math/float/ does not include
tfloat.h, but makecheck-tfloat.hprints errors. But make check inlib/works as expected (adds also *.h).The Sparse based tool does include headers though. So really we are checking the target which includes more than just a single c file.
Ah, that makes sense then. Thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hello,
Quoted 1 line · Andrea Cervesato via ltp
mqns testing suite has been refactored using new LTP API
It would be easier to just submit one test for review and iterate on it. This follows the principal of breaking work down into the smallest chunk practically possible.
Sometimes submitting a large patchset is unavoidable, but this is not the case here.
I'm setting all of these to "changes requested".
Quoted 24 lines
Andrea Cervesato (7):
Add more safe macros for mqueue API
Refactormqns_01using new LTP API
Refactormqns_02using new LTP API
Refactormqns_03using new LTP API
Refactormqns_04using new LTP API
Delete deprecated mqns header files
Renamecommon.hintomqns.hfor mqns suiteinclude/tst_safe_posix_ipc.h | 45 +++ runtest/containers | 12 +- testcases/kernel/containers/mqns/Makefile | 27 +- testcases/kernel/containers/mqns/mqns.h | 108 ++++++- testcases/kernel/containers/mqns/mqns_01.c | 185 ++++-------- testcases/kernel/containers/mqns/mqns_02.c | 217 ++++---------- testcases/kernel/containers/mqns/mqns_03.c | 269 +++++++----------- testcases/kernel/containers/mqns/mqns_04.c | 263 ++++++++--------- .../kernel/containers/mqns/mqns_helper.h | 56 ---- 9 files changed, 485 insertions(+), 697 deletions(-) delete mode 100644 testcases/kernel/containers/mqns/mqns_helper.hSignature · 1 line
2.35.3
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp