public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] Remove libclone dependency from pidns05 test
Date: Wed, 12 Jul 2023 11:08:05 +0200	[thread overview]
Message-ID: <20230712090805.GC756025@pevik> (raw)
In-Reply-To: <20230705115400.31041-1-andrea.cervesato@suse.de>

Hi Andrea,

> From: Andrea Cervesato <andrea.cervesato@suse.com>

> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
nit: with so many inputs you get from Cyril, it'd really help reviewers if you
wrote changelog (nice example: https://lore.kernel.org/ltp/20230711170335.13142-1-rick.p.edgecombe@intel.com/).

I agree it's tedious and boring but not only it'd help reviewers, but it'd help
you to check if you changed everything you had been asked to.

>  testcases/kernel/containers/pidns/pidns05.c | 285 ++++++--------------
>  1 file changed, 77 insertions(+), 208 deletions(-)

> diff --git a/testcases/kernel/containers/pidns/pidns05.c b/testcases/kernel/containers/pidns/pidns05.c
> index 79e146e36..d3be4be11 100644
> --- a/testcases/kernel/containers/pidns/pidns05.c
> +++ b/testcases/kernel/containers/pidns/pidns05.c
> @@ -1,256 +1,125 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
>  /*
> -* Copyright (c) International Business Machines Corp., 2007
> -* 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
> -*
> -***************************************************************************
> -*
> -* Assertion:
> -*   a) Create a  container.
> -*   b) Create many levels of child containers inside this container.
> -*   c) Now do kill -9 init , outside of the container.
> -*   d) This should kill all the child containers.
> -*      (containers created at the level below)
> -*
> -* Description:
> -* 1. Parent process clone a process with flag CLONE_NEWPID
> -* 2. The container will recursively loop and creates 4 more containers.
> -* 3. All the container init's  goes into sleep(), waiting to be terminated.
> -* 4. The parent process will kill child[3] by passing SIGKILL
> -* 5. Now parent process, verifies the child containers 4 & 5 are destroyed.
> -* 6. If they are killed then
> -*	Test passed
> -*  else Test failed.
> -*
> -* Test Name: pidns05
> -*
> -* History:
> -*
> -* FLAG DATE		NAME				DESCRIPTION
> -* 31/10/08  Veerendra C <vechandr@in.ibm.com>	Verifies killing of NestedCont's
> -*
> -*******************************************************************************/
> -#define _GNU_SOURCE 1
> + * Copyright (c) International Business Machines Corp., 2007
> + *		08/10/08 Veerendra C <vechandr@in.ibm.com>
very nit: 31/10/08 => 08/10/08. IMHO wrong date. Or what am I missing here?
Also why tab in the front? Maybe I'm a bit aggressive when deleting from my POV
useless info and ugly formatting, but I'd just add:

* Copyright (c) Veerendra C <vechandr@in.ibm.com>, 2008

> + * Copyright (C) 2023 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> + */
...

+static int find_cinit_pids(pid_t *pids)
+{
+	int i;
+    int next = 0;
+    pid_t parentpid, pgid, pgid2;
+
+    parentpid = getpid();
+    pgid = getpgid(parentpid);
Maybe SAFE_GETPGID() ?

...

> +static void run(void)
...
> +	SAFE_KILL(pid, SIGKILL);
> +	SAFE_WAITPID(0, &status, NULL);

In file included from ../../../../include/tst_test.h:110,
                 from pidns05.c:17:
pidns05.c: In function ‘run’:
../../../../include/tst_safe_macros.h:211:65: warning: passing argument 6 of ‘safe_waitpid’ makes integer from pointer without a cast [-Wint-conversion]
  211 |         safe_waitpid(__FILE__, __LINE__, NULL, (pid), (status), (opts))
      |                                                                 ^~~~~~
      |                                                                 |
      |                                                                 void *
pidns05.c:101:9: note: in expansion of macro ‘SAFE_WAITPID’
  101 |         SAFE_WAITPID(0, &status, NULL);
      |         ^~~~~~~~~~~~
In file included from ../../../../include/tst_safe_macros.h:24:
../../../../include/safe_macros_fn.h:158:48: note: expected ‘int’ but argument is of type ‘void *’
  158 |                    pid_t pid, int *status, int opts);
      |                                            ~~~~^~~~

make check-pidns05
CHECK testcases/kernel/containers/pidns/pidns05.c
pidns05.c:101:9: warning: incorrect type in argument 6 (different base types)
pidns05.c:101:9:    expected int opts
pidns05.c:101:9:    got void *

The old test called setpgid(0, 0) and SAFE_PIPE(), are these related to
do_clone_unshare_test() or why it's not necessary in the rewrite?
Maybe it's obvious, but I'd appreciate to explain these changes in the commit
message, instead of simple "Remove libclone dependency".

The rest LGTM.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2023-07-12  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 11:54 [LTP] [PATCH v2] Remove libclone dependency from pidns05 test Andrea Cervesato
2023-07-12  9:08 ` Petr Vorel [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=20230712090805.GC756025@pevik \
    --to=pvorel@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