Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tests record+zstd_comp_decomp: Fix the shellcheck warnings about word splitting/quoting

Running shellcheck on record+zstd_comp_decomp.sh testcases
throws below warning:

In tests/shell/record+zstd_comp_decomp.sh line 16:
$perf_tool record -o $trace_file $gflag -z -F 5000 -- \
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
$perf_tool record -o "$trace_file" $gflag -z -F 5000 -- \

In tests/shell/record+zstd_comp_decomp.sh line 22:
$perf_tool report -i $trace_file --header --stats | \
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Added double quote around file names to fix these
shellcheck reported issues.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230709182800.53002-23-atrajeev@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Athira Rajeev and committed by
Arnaldo Carvalho de Melo
3a4367c1 84caba70

+7 -7
+7 -7
tools/perf/tests/shell/record+zstd_comp_decomp.sh
··· 13 13 collect_z_record() { 14 14 echo "Collecting compressed record file:" 15 15 [ "$(uname -m)" != s390x ] && gflag='-g' 16 - $perf_tool record -o $trace_file $gflag -z -F 5000 -- \ 16 + $perf_tool record -o "$trace_file" $gflag -z -F 5000 -- \ 17 17 dd count=500 if=/dev/urandom of=/dev/null 18 18 } 19 19 20 20 check_compressed_stats() { 21 21 echo "Checking compressed events stats:" 22 - $perf_tool report -i $trace_file --header --stats | \ 22 + $perf_tool report -i "$trace_file" --header --stats | \ 23 23 grep -E "(# compressed : Zstd,)|(COMPRESSED events:)" 24 24 } 25 25 26 26 check_compressed_output() { 27 - $perf_tool inject -i $trace_file -o $trace_file.decomp && 28 - $perf_tool report -i $trace_file --stdio -F comm,dso,sym | head -n -3 > $trace_file.comp.output && 29 - $perf_tool report -i $trace_file.decomp --stdio -F comm,dso,sym | head -n -3 > $trace_file.decomp.output && 30 - diff $trace_file.comp.output $trace_file.decomp.output 27 + $perf_tool inject -i "$trace_file" -o "$trace_file.decomp" && 28 + $perf_tool report -i "$trace_file" --stdio -F comm,dso,sym | head -n -3 > "$trace_file.comp.output" && 29 + $perf_tool report -i "$trace_file.decomp" --stdio -F comm,dso,sym | head -n -3 > "$trace_file.decomp.output" && 30 + diff "$trace_file.comp.output" "$trace_file.decomp.output" 31 31 } 32 32 33 33 skip_if_no_z_record || exit 2 34 34 collect_z_record && check_compressed_stats && check_compressed_output 35 35 err=$? 36 - rm -f $trace_file* 36 + rm -f "$trace_file*" 37 37 exit $err