mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Swapnil Sapkal <swapnil.sapkal@amd.com>
To: Ian Rogers <irogers@google.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	<linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/2] perf tests sched stats: Write output to temp file
Date: Mon, 23 Mar 2026 16:11:03 +0530	[thread overview]
Message-ID: <d6891df0-25a1-4bb1-a7e3-364af9282d68@amd.com> (raw)
In-Reply-To: <20260321061448.810525-2-irogers@google.com>

Hi Ian,

On 21-03-2026 11:44, Ian Rogers wrote:
> Writing to the perf.data file can fail in various contexts such as
> continual test. Other tests write to a mktemp-ed file, make the "perf
> sched stats tests" follow this convention.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>   tools/perf/tests/shell/perf_sched_stats.sh | 37 ++++++++++++++++------
>   1 file changed, 27 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/perf_sched_stats.sh b/tools/perf/tests/shell/perf_sched_stats.sh
> index 2b1410b050d0..bef7714ef37a 100755
> --- a/tools/perf/tests/shell/perf_sched_stats.sh
> +++ b/tools/perf/tests/shell/perf_sched_stats.sh
> @@ -4,10 +4,29 @@
>   
>   set -e
>   
> +perfdata=$(mktemp /tmp/__perf_test_sched_stats.perf.data.XXXXX)
> +perfdata2=$(mktemp /tmp/__perf_test_sched_stats.perf.data.XXXXX)
> +
> +cleanup() {
> +  rm -f "${perfdata}"
> +  rm -f "${perfdata}".old
> +  rm -f "${perfdata2}"
> +  rm -f "${perfdata2}".old
> +
> +  trap - EXIT TERM INT
> +}
> +
> +trap_cleanup() {
> +  echo "Unexpected signal in ${FUNCNAME[1]}"
> +  cleanup
> +  exit 1
> +}
> +trap trap_cleanup EXIT TERM INT
> +
>   err=0
>   test_perf_sched_stats_record() {
>     echo "Basic perf sched stats record test"
> -  if ! perf sched stats record true 2>&1 | \
> +  if ! perf sched stats record -o "${perfdata}" true 2>&1 | \
>       grep -E -q "[ perf sched stats: Wrote samples to perf.data ]"
>     then
>       echo "Basic perf sched stats record test [Failed]"
> @@ -19,15 +38,13 @@ test_perf_sched_stats_record() {
>   
>   test_perf_sched_stats_report() {
>     echo "Basic perf sched stats report test"
> -  perf sched stats record true > /dev/null
> -  if ! perf sched stats report 2>&1 | grep -E -q "Description"
> +  perf sched stats record -o "${perfdata}" true > /dev/null
> +  if ! perf sched stats report -i "${perfdata}" 2>&1 | grep -E -q "Description"
>     then
>       echo "Basic perf sched stats report test [Failed]"
>       err=1
> -    rm perf.data
>       return
>     fi
> -  rm perf.data
>     echo "Basic perf sched stats report test [Success]"
>   }
>   
> @@ -44,16 +61,14 @@ test_perf_sched_stats_live() {
>   
>   test_perf_sched_stats_diff() {
>     echo "Basic perf sched stats diff test"
> -  perf sched stats record true > /dev/null
> -  perf sched stats record true > /dev/null
> -  if ! perf sched stats diff > /dev/null
> +  perf sched stats record -o "${perfdata}" true > /dev/null
> +  perf sched stats record -o "${perfdata2}" true > /dev/null
> +  if ! perf sched stats diff "${perfdata}" "${perfdata2}" > /dev/null
>     then
>       echo "Basic perf sched stats diff test [Failed]"
>       err=1
> -    rm perf.data.old perf.data
>       return
>     fi
> -  rm perf.data.old perf.data
>     echo "Basic perf sched stats diff test [Success]"
>   }
>   
> @@ -61,4 +76,6 @@ test_perf_sched_stats_record
>   test_perf_sched_stats_report
>   test_perf_sched_stats_live
>   test_perf_sched_stats_diff
> +
> +cleanup
>   exit $err

Tested-by: Swapnil Sapkal <swapnil.sapkal@amd.com>

--
Thanks and Regards,
Swapnil

  reply	other threads:[~2026-03-23 10:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21  6:14 [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set Ian Rogers
2026-03-21  6:14 ` [PATCH v1 2/2] perf tests sched stats: Write output to temp file Ian Rogers
2026-03-23 10:41   ` Swapnil Sapkal [this message]
2026-03-23 10:39 ` [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set Swapnil Sapkal
2026-03-26 23:20 ` Namhyung Kim
2026-04-01  5:59   ` Ian Rogers
2026-04-03  2:42     ` Namhyung Kim
2026-04-03 15:29       ` Ian Rogers
2026-04-06 17:53         ` Namhyung Kim
2026-05-05 21:56           ` Ian Rogers
2026-05-06 13:10             ` Arnaldo Carvalho de Melo
2026-05-06 16:17               ` Namhyung Kim
2026-05-06 17:12                 ` Ian Rogers
2026-05-06 18:54                   ` Namhyung Kim

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=d6891df0-25a1-4bb1-a7e3-364af9282d68@amd.com \
    --to=swapnil.sapkal@amd.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®