From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] Remove ltp_clone_quick usage from pidns suite
Date: Fri, 28 Apr 2023 15:07:21 +0200 [thread overview]
Message-ID: <ZEvFCTEO1mAxN5tB@yuki> (raw)
In-Reply-To: <20230314134242.9203-1-andrea.cervesato@suse.de>
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2023-04-28 13:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 13:42 [LTP] [PATCH v2] Remove ltp_clone_quick usage from pidns suite Andrea Cervesato
2023-03-29 5:39 ` Petr Vorel
2023-04-28 13:07 ` Cyril Hrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZEvFCTEO1mAxN5tB@yuki \
--to=chrubis@suse.cz \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox