[LTP] [PATCH v2] Remove ltp_clone_quick usage from pidns suite
Cyril Hrubis
chrubis@suse.cz
Fri Apr 28 15:07:21 CEST 2023
Hi!
> diff --git a/testcases/kernel/containers/pidns/pidns02.c b/testcases/kernel/containers/pidns/pidns02.c
> index b8913d3f6..5372aeef9 100644
> --- a/testcases/kernel/containers/pidns/pidns02.c
> +++ b/testcases/kernel/containers/pidns/pidns02.c
> @@ -7,7 +7,7 @@
> /*\
> * [Description]
> *
> - * Clone a process with CLONE_NEWNS flag and check:
> + * Clone a process with CLONE_NEWPID flag and check:
> *
> * - child session ID must be 1
> * - parent process group ID must be 1
> @@ -16,29 +16,35 @@
> #include "tst_test.h"
> #include "lapi/sched.h"
>
> -static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
> +static void child_func(void)
> {
> pid_t sid, pgid;
>
> + SAFE_SETSID();
Can we please avoid the setsid() here? Once we do that we do not
actually test that the sid and pgid are initialized to something
meaningful. It makes much more sense to check if sid and pgid are 0,
since init process has no parent and ppid is 0 then also the sid and
pgid may make sense to be initialized to 0 since they are "inherited"
from nonexistent parent.
Or we can as well do:
TST_EXP_EQ_LI(getsid(0), 0);
TST_EXP_EQ_LI(getpgid(0), 0);
tst_res(TINFO, "setsid()");
SAFE_SETSID();
TST_EXP_EQ_LI(getsid(0), 1);
TST_EXP_EQ_LI(getpgid(0), 1);
That way we check both the initial values and that setsid works as
expected.
The rest looks good. With the pidns02.c fixed:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list