Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: rpalethorpe@suse.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 8/8] Rewrite userns08.c using new LTP API
Date: Fri, 25 Mar 2022 08:18:49 +0100	[thread overview]
Message-ID: <Yj1s2cKWf7oNwSVR@pevik> (raw)
In-Reply-To: <20220315122351.8556-9-andrea.cervesato@suse.de>

Hi Andrea,

[Cc Richie]

This subject: "Rewrite userns08.c using new LTP API" is misleading,
userns08.c was already using new API.

You're:
* s/tst_res/tst_brk/ (that would deserve explanation why)
* removing tst_reap_children()
* changing formatting (some of them create too long lines)

...
>  static pid_t clone_newuser(void)
>  {
> -	const struct tst_clone_args cargs = {
> -		CLONE_NEWUSER,
> -		SIGCHLD
> -	};
> +	const struct tst_clone_args cargs = { CLONE_NEWUSER, SIGCHLD };

>  	return SAFE_CLONE(&cargs);
>  }

> -static void write_mapping(const pid_t proc_in_ns,
> -			  const char *const id_mapping)
> +static void write_mapping(const pid_t proc_in_ns, const char *const id_mapping)
>  {
>  	char proc_path[PATH_MAX];
>  	int proc_dir;
> @@ -61,11 +58,11 @@ static void write_mapping(const pid_t proc_in_ns,
>  static void ns_level2(void)
>  {
>  	if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0))
> -		tst_res(TINFO | TERRNO, "Failed to set dumpable flag");
> +		tst_brk(TBROK | TTERRNO, "Failed to set dumpable flag");
Not sure which one is correct (whether tst_res or tst_brk).
But TTERRNO is obviously wrong, that's for using TEST(). Here should remain
TERRNO.

> +
>  	TST_CHECKPOINT_WAKE_AND_WAIT(1);

> -	TST_EXP_FAIL(open("restricted", O_WRONLY), EACCES,
> -		     "Denied write access to ./restricted");
> +	TST_EXP_FAIL(open("restricted", O_WRONLY), EACCES, "Denied write access to ./restricted");

I'd keep this one.

>  	exit(0);
>  }
> @@ -89,7 +86,6 @@ static void ns_level1(void)
>  	write_mapping(level2_proc, map_over_5);

>  	TST_CHECKPOINT_WAKE(1);
> -	tst_reap_children();
Well, test works without it, but not really sure if it can be removed.

Kind regards,
Petr

>  	exit(0);
>  }
> @@ -111,7 +107,6 @@ static void run(void)
>  	write_mapping(level1_proc, "0 100000 1000");

>  	TST_CHECKPOINT_WAKE(0);
> -	tst_reap_children();

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

  parent reply	other threads:[~2022-03-25  7:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 12:23 [LTP] [PATCH v2 0/8] Rewrite userns testing suite using new LTP API Andrea Cervesato
2022-03-15 12:23 ` [LTP] [PATCH v2 1/8] Rewrite userns01.c " Andrea Cervesato
2022-03-15 13:29   ` [LTP] [PATCH v2 1/2] Remove libclone from userns test suite Andrea Cervesato
2022-03-15 13:30   ` [LTP] [PATCH v2 2/2] Remove obsolete userns_helper.h from userns Andrea Cervesato
2022-03-23 10:17   ` [LTP] [PATCH v2 1/8] Rewrite userns01.c using new LTP API Petr Vorel
2022-03-24 20:31   ` Petr Vorel
2022-03-24 20:50   ` Petr Vorel
2022-03-25  9:18     ` Andrea Cervesato via ltp
2022-03-25 10:06       ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 2/8] Rewrite userns02.c " Andrea Cervesato
2022-03-24 19:46   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 3/8] Rewrite userns03.c " Andrea Cervesato
2022-03-24 20:40   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 4/8] Rewrite userns04.c " Andrea Cervesato
2022-03-24 20:55   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 5/8] Rewrite userns05.c " Andrea Cervesato
2022-03-24 21:08   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 6/8] Rewrite userns06.c " Andrea Cervesato
2022-03-25  7:08   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 7/8] Rewrite userns07.c " Andrea Cervesato
2022-03-25  7:11   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 8/8] Rewrite userns08.c " Andrea Cervesato
2022-03-23  9:36   ` Petr Vorel
2022-03-23  9:46     ` Andrea Cervesato via ltp
2022-03-23  9:58     ` Cyril Hrubis
2022-03-23 12:54       ` Petr Vorel
2022-03-23 15:41         ` Andrea Cervesato via ltp
2022-03-24 14:18           ` Petr Vorel
2022-03-25  7:18   ` Petr Vorel [this message]
2022-03-25  8:58     ` Andrea Cervesato via ltp

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=Yj1s2cKWf7oNwSVR@pevik \
    --to=pvorel@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.com \
    /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