[LTP] [PATCH v1] Refactor pidns32 test using new LTP API

Cyril Hrubis chrubis@suse.cz
Mon Aug 15 16:49:41 CEST 2022


Hi!
Pushed with one fix, thanks.

I moved the *nested = 1 from setup to the run() function, otherwise the
test would be no-op on second and subsequent iterations with -i option.

Diff:

diff --git a/testcases/kernel/containers/pidns/pidns32.c b/testcases/kernel/cont
index cbc91df68..333e1fcad 100644
--- a/testcases/kernel/containers/pidns/pidns32.c
+++ b/testcases/kernel/containers/pidns/pidns32.c
@@ -43,13 +43,14 @@ static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
 static void setup(void)
 {
        level = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED
-       *level = 1;
 }

 static void run(void)
 {
        int ret, status;

+       *level = 1;
+
        ret = ltp_clone_quick(CLONE_NEWPID | SIGCHLD, child_func, 0);
        if (ret < 0)
                tst_brk(TBROK | TERRNO, "clone failed");


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list