public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Xiao Yang <yangx.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] vma05.sh: Fix check for core file presence
Date: Tue, 28 Nov 2023 14:35:33 +0100	[thread overview]
Message-ID: <20231128133533.GA400459@pevik> (raw)
In-Reply-To: <ab0157cc-f7c5-29e0-f79d-14220d402370@fujitsu.com>

Hi,

> Hi Yang

> On 2023/11/10 11:56, Yang Xu wrote:
> >   	rm -rf core*
> >   	{ vma05_vdso; } > /dev/null 2>&1
> > -	[ -f core ] || tst_brk TBROK "missing core file"
> > +	[ -f core* ] || tst_brk TBROK "missing core file"
This will not work in case of more files:

$ touch core.foo core.bar; [ -f core* ]
bash: [: core.bar: binary operator expected

> The root cause seems that the name of core file contains the pid number by
> default. I think the better solution is set /proc/sys/kernel/core_uses_pid
> to 0 before running vma05_vdso. Like this:

> diff --git a/testcases/kernel/mem/vma/vma05.sh
> b/testcases/kernel/mem/vma/vma05.sh
> index a09951462..e1ef1014e 100755
> --- a/testcases/kernel/mem/vma/vma05.sh
> +++ b/testcases/kernel/mem/vma/vma05.sh
> @@ -25,11 +25,13 @@ TST_NEEDS_CMDS="gdb"

>  CORE_LIMIT=$(ulimit -c)
>  CORE_PATTERN=$(cat /proc/sys/kernel/core_pattern)
> +CORE_USES_PID=$(cat /proc/sys/kernel/core_uses_pid)

>  setup()
>  {
>         ulimit -c unlimited
>         echo "core" > /proc/sys/kernel/core_pattern
> +       echo 0 > /proc/sys/kernel/core_uses_pid
>         unset DEBUGINFOD_URLS
>  }

> @@ -37,6 +39,7 @@ cleanup()
>  {
>         ulimit -c "$CORE_LIMIT"
>         echo "$CORE_PATTERN" > /proc/sys/kernel/core_pattern
> +       echo $CORE_USES_PID > /proc/sys/kernel/core_uses_pid
>  }

This patch looks better to me. Feel free to merge it with my RBT
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

> Best Regards,
> Xiao Yang

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

      reply	other threads:[~2023-11-28 13:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10  3:56 [LTP] [PATCH] vma05.sh: Fix check for core file presence Yang Xu
2023-11-16  2:02 ` Yang Xu (Fujitsu)
2023-11-28  3:02 ` Xiao Yang
2023-11-28 13:35   ` 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=20231128133533.GA400459@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=yangx.jy@fujitsu.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