public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] unshare01.sh: Setup parent mount flag before unshare testing
Date: Mon, 7 Jun 2021 11:42:49 +0200	[thread overview]
Message-ID: <YL3qGZasDuppV3LH@pevik> (raw)
In-Reply-To: <6035DD9C.4080308@cn.fujitsu.com>

Hi Yang, Zhongyi,

> Hi Zhongyi, Petr

> I don't like the approach which enforces mountpoint to be shared in parent
> mount namespace.
> I think we can tune expected value by checking propagation flag in parent
> mount namespace because of two reasons:
> 1) Make test cover more cases.
> 2) Don't depend on the fixed tmpfs.

> Zhongyi,  could you test the following patch on your enviorment?
> -------------------------------------------------------------------------------------------------
> diff --git a/testcases/commands/unshare/unshare01.sh
> b/testcases/commands/unshare/unshare01.sh
> index bf163a7f4..78ea83fc0 100755
> --- a/testcases/commands/unshare/unshare01.sh
> +++ b/testcases/commands/unshare/unshare01.sh
> @@ -40,6 +40,17 @@ max_mntns_path="/proc/sys/user/max_mnt_namespaces"
>  default_max_userns=-1
>  default_max_mntns=-1

> +parse_propagation_flag()
> +{
> +       mount --bind dir_A dir_B
> +       if grep -w 'dir_B' /proc/self/mountinfo | grep -qw 'shared'; then
> +               echo "mounted"
> +       else
> +               echo "unmounted"
> +       fi
> +       umount dir_B
> +}
> +
>  setup()
>  {
>         # On some distributions(e.g RHEL7.4), the default value of
> @@ -149,7 +160,8 @@ do_test()
>         4) unshare_test "--user --map-root-user" "id -g" "0";;
>         5) unshare_test "--mount" "mount --bind dir_A dir_B" "unmounted";;
>         6) unshare_test "--mount --propagation shared" \
> -                       "mount --bind dir_A dir_B" "mounted";;
> +                       "mount --bind dir_A dir_B" \
> +                       "$(parse_propagation_flag)";;
>         7) unshare_test "--user --map-root-user --mount" \
>                         "mount --bind dir_A dir_B" "unmounted";;
>         8) unshare_test "--user --map-root-user --mount --propagation
> shared" \

Sorry for a big delay in this.
Your changes makes sense to me, ack.

Kind regards,
Petr

  reply	other threads:[~2021-06-07  9:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 14:03 [LTP] [PATCH] unshare01.sh: Setup parent mount flag before unshare testing Zhao Gongyi
2021-02-24  1:40 ` Petr Vorel
2021-02-24  5:01   ` Xiao Yang
2021-06-07  9:42     ` Petr Vorel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-25  9:38 zhaogongyi
2021-02-25 10:02 zhaogongyi
2021-02-25 10:57 ` Xiao Yang
2021-02-27  9:46 zhaogongyi
2021-02-28 12:22 ` Xiao Yang
2021-03-01  1:13 zhaogongyi

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=YL3qGZasDuppV3LH@pevik \
    --to=pvorel@suse.cz \
    --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