public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	svens@linux.ibm.com, gor@linux.ibm.com, sumanthk@linux.ibm.com,
	hca@linux.ibm.com
Subject: Re: [PATCH v2] perf test: Add skip to --per-thread test
Date: Thu, 5 May 2022 14:44:40 -0300	[thread overview]
Message-ID: <YnQNCN2qbCBvkyqr@kernel.org> (raw)
In-Reply-To: <20220503043400.2374052-1-irogers@google.com>

Em Mon, May 02, 2022 at 09:34:00PM -0700, Ian Rogers escreveu:
> As reported in:
> https://lore.kernel.org/linux-perf-users/20220428122821.3652015-1-tmricht@linux.ibm.com/
> the 'instructions:u' event may not be supported. Add a skip using 'perf
> record'.
> 
> Switch some code away from pipe to make the failures clearer.

Can you please resubmit this on top of my perf/core branch? I had
already applied Thomas fix and published perf/core publicly, so I rather
not rebase at this point.

Basically get your current tools/perf/tests/shell/record.sh file, with
this fix, copy it, clone my perf/core branch, copy
tools/perf/tests/shell/record.sh there and commit, then please resubmit
:-)

- Arnaldo
 
> Reported-by: Thomas Richter <tmricht@linux.ibm.com>
> Tested-by: Thomas Richter <tmricht@linux.ibm.com>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/tests/shell/record.sh | 44 +++++++++++++++++++++++++++++---
>  1 file changed, 41 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
> index cd1cf14259b8..00c7285ce1ac 100755
> --- a/tools/perf/tests/shell/record.sh
> +++ b/tools/perf/tests/shell/record.sh
> @@ -5,11 +5,43 @@
>  set -e
>  
>  err=0
> +perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> +
> +cleanup() {
> +  rm -f ${perfdata}
> +  rm -f ${perfdata}.old
> +  trap - exit term int
> +}
> +
> +trap_cleanup() {
> +  cleanup
> +  exit 1
> +}
> +trap trap_cleanup exit term int
> +
>  test_per_thread() {
>    echo "Basic --per-thread mode test"
> -  perf record -e instructions:u --per-thread -o- true 2> /dev/null \
> -    | perf report -i- -q \
> -    | egrep -q true
> +  if ! perf record -e instructions:u -o ${perfdata} --quiet true 2> /dev/null
> +  then
> +    echo "Per-thread record [Skipped instructions:u not supported]"
> +    if [ $err -ne 1 ]
> +    then
> +      err=2
> +    fi
> +    return
> +  fi
> +  if ! perf record -e instructions:u --per-thread -o ${perfdata} true 2> /dev/null
> +  then
> +    echo "Per-thread record of instructions:u [Failed]"
> +    err=1
> +    return
> +  fi
> +  if ! perf report -i ${perfdata} -q | egrep -q true
> +  then
> +    echo "Per-thread record [Failed missing output]"
> +    err=1
> +    return
> +  fi
>    echo "Basic --per-thread mode test [Success]"
>  }
>  
> @@ -18,6 +50,10 @@ test_register_capture() {
>    if ! perf list | egrep -q 'br_inst_retired.near_call'
>    then
>      echo "Register capture test [Skipped missing instruction]"
> +    if [ $err -ne 1 ]
> +    then
> +      err=2
> +    fi
>      return
>    fi
>    if ! perf record --intr-regs=\? 2>&1 | egrep -q 'available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15'
> @@ -39,4 +75,6 @@ test_register_capture() {
>  
>  test_per_thread
>  test_register_capture
> +
> +cleanup
>  exit $err
> -- 
> 2.36.0.464.gb9c8b46e94-goog

-- 

- Arnaldo

      reply	other threads:[~2022-05-05 17:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03  4:34 [PATCH v2] perf test: Add skip to --per-thread test Ian Rogers
2022-05-05 17:44 ` Arnaldo Carvalho de Melo [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=YnQNCN2qbCBvkyqr@kernel.org \
    --to=acme@kernel.org \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    --cc=tmricht@linux.ibm.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