All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@linaro.org>
To: James Clark <james.clark@arm.com>
Cc: acme@kernel.org, leo.yan@linaro.com,
	linux-perf-users@vger.kernel.org,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] perf tests: Improve temp file cleanup in test_arm_coresight.sh
Date: Wed, 22 Sep 2021 22:08:32 +0800	[thread overview]
Message-ID: <20210922140832.GB400258@leoy-ThinkPad-X240s> (raw)
In-Reply-To: <5a1c5eab-d9b7-5623-2d7d-c6b1921b3628@arm.com>

Hi James,

On Wed, Sep 22, 2021 at 02:40:54PM +0100, James Clark wrote:

[...]

> >>  cleanup_files()
> >>  {
> >>  	rm -f ${perfdata}
> >>  	rm -f ${file}
> >> +	rm -f "${perfdata}.old"
> >> +	trap - exit term int
> >> +	kill -2 $$
> > 
> > Here it always sends signal SIGINT to current PID with $$, another
> > choice is to send signal based on the incoming signal type, like below:
> > 
> >   [[ "$1" = "int" ]] || kill -SIGINT $$
> >   [[ "$1" = "term" ]] || kill -SIGTERM $$
> 
> Yes I thought that this might be an issue, but I tested it in a few different
> scenarios. Especially when running it under the normal ./perf test command and
> it didn't seem to cause an issue whether it passed or failed. So I'm not sure
> if it's worth changing or not. Maybe it is in case it gets copy pasted into
> another shell test?

I think it's not very necessary to send signal again with command
"kill -2 $$" at here.

"kill -2 $$" sends the signal to the shell process itself rather than
propagating signal to its parent process.  And the up level's script
should can detect an error with the returned exit code.

So below change should be sufficient?

cleanup_files()
{
	rm -f ${perfdata}
	rm -f ${file}
+       rm -f "${perfdata}.old"
+       exit $glb_err
}

Sorry if I miss anything at here and cause noise.

Thanks,
Leo

  reply	other threads:[~2021-09-22 14:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 13:10 [PATCH 1/3] perf tests: Fix record+script_probe_vfs_getname.sh /tmp cleanup James Clark
2021-09-21 13:10 ` [PATCH 2/3] perf tests: Fix trace+probe_vfs_getname.sh " James Clark
2021-09-21 13:10 ` [PATCH 3/3] perf tests: Improve temp file cleanup in test_arm_coresight.sh James Clark
2021-09-22  6:10   ` Ian Rogers
2021-09-22 11:00   ` Leo Yan
2021-09-22 13:40     ` James Clark
2021-09-22 14:08       ` Leo Yan [this message]
2021-09-22 16:49         ` James Clark
2021-09-23  1:18           ` Leo Yan
     [not found] ` <CAP-5=fU_CSPv2Kry6ObbfYG4rNJpprhBrFUOJsNugM-AqQ3xoA@mail.gmail.com>
2021-10-26 14:18   ` [PATCH 1/3] perf tests: Fix record+script_probe_vfs_getname.sh /tmp cleanup Arnaldo Carvalho de Melo

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=20210922140832.GB400258@leoy-ThinkPad-X240s \
    --to=leo.yan@linaro.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.