[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <132e3bcd-c64a-5c55-bb52-efe013e55157@intel.com>
Date: Fri, 21 Oct 2022 11:45:24 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: Namhyung Kim <namhyung@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Ian Rogers <irogers@...gle.com>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 2/8] perf test: Fix shellcheck issues in the record test
On 20/10/22 20:26, Namhyung Kim wrote:
> Basically there are 3 issues:
>
> 1. quote shell expansion
> 2. do not use egrep
> 3. use upper case letters for signal names
>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Reviewed-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> tools/perf/tests/shell/record.sh | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
> index 747c33a1ec45..464071462809 100755
> --- a/tools/perf/tests/shell/record.sh
> +++ b/tools/perf/tests/shell/record.sh
> @@ -8,16 +8,16 @@ err=0
> perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
>
> cleanup() {
> - rm -f ${perfdata}
> - rm -f ${perfdata}.old
> - trap - exit term int
> + rm -f "${perfdata}"
> + rm -f "${perfdata}".old
> + trap - EXIT TERM INT
> }
>
> trap_cleanup() {
> cleanup
> exit 1
> }
> -trap trap_cleanup exit term int
> +trap trap_cleanup EXIT TERM INT
>
> test_per_thread() {
> echo "Basic --per-thread mode test"
> @@ -30,13 +30,13 @@ test_per_thread() {
> fi
> return
> fi
> - if ! perf record --per-thread -o ${perfdata} true 2> /dev/null
> + if ! perf record --per-thread -o "${perfdata}" true 2> /dev/null
> then
> echo "Per-thread record [Failed record]"
> err=1
> return
> fi
> - if ! perf report -i ${perfdata} -q | egrep -q true
> + if ! perf report -i "${perfdata}" -q | grep -q true
> then
> echo "Per-thread record [Failed missing output]"
> err=1
> @@ -47,7 +47,7 @@ test_per_thread() {
>
> test_register_capture() {
> echo "Register capture test"
> - if ! perf list | egrep -q 'br_inst_retired.near_call'
> + if ! perf list | grep -q 'br_inst_retired.near_call'
> then
> echo "Register capture test [Skipped missing event]"
> if [ $err -ne 1 ]
> @@ -56,7 +56,7 @@ test_register_capture() {
> 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'
> + if ! perf record --intr-regs=\? 2>&1 | grep -q 'available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15'
> then
> echo "Register capture test [Skipped missing registers]"
> return
> @@ -64,7 +64,7 @@ test_register_capture() {
> if ! perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p \
> -c 1000 --per-thread true 2> /dev/null \
> | perf script -F ip,sym,iregs -i - 2> /dev/null \
> - | egrep -q "DI:"
> + | grep -q "DI:"
> then
> echo "Register capture test [Failed missing output]"
> err=1
Powered by blists - more mailing lists