perf test: Fix shellcheck issues in the record test
Basically there are 3 issues: 1. quote shell expansion 2. do not use egrep 3. use upper case letters for signal names Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20221020172643.3458767-3-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
439dbef2a9
commit
9e455f4f29
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue