Skip to contentSkip to conversation

perf tests: Fix test_arm_callgraph_fp variable expansion

PATCH Applied James Clark 3 participants 5 messages Jun 22, 2023 – Jun 26, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tests: Fix test_arm_callgraph_fp variable expansion

$TEST_PROGRAM is a command with spaces so it's supposed to be word split. The referenced fix to fix the shellcheck warnings incorrectly quoted this string so unquote it to fix the test.

At the same time silence the shellcheck warning for that line and fix two more shellcheck errors at the end of the script.

Fixes 1bb17b4c6c91 ("perf tests arm_callgraph_fp: Address shellcheck warnings about signal names and adding double quotes for expression")
---
 tools/perf/tests/shell/test_arm_callgraph_fp.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/perf/tests/shell/test_arm_callgraph_fp.sh +4 -3
index 1380e0d12dce..66dfdfdad553 100755
@@ -15,7 +15,8 @@ cleanup_files()
 trap cleanup_files EXIT TERM INT
 
 # Add a 1 second delay to skip samples that are not in the leaf() function
-perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- "$TEST_PROGRAM" 2> /dev/null &
+# shellcheck disable=SC2086
+perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null &
 PID=$!
 
 echo " + Recording (PID=$PID)..."
@@ -33,8 +34,8 @@ wait $PID
 # 	76c leafloop
 # ...
 
-perf script -i $PERF_DATA -F comm,ip,sym | head -n4
-perf script -i $PERF_DATA -F comm,ip,sym | head -n4 | \
+perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4
+perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 | \
 	awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" ||
 						       sym[1] != "parent" ||
 						       sym[2] != "leafloop") exit 1 }'
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw

Hi James,

Quoted 10 lines · James Clark

$TEST_PROGRAM is a command with spaces so it's supposed to be word split. The referenced fix to fix the shellcheck warnings incorrectly quoted this string so unquote it to fix the test.

At the same time silence the shellcheck warning for that line and fix two more shellcheck errors at the end of the script.

Fixes 1bb17b4c6c91 ("perf tests arm_callgraph_fp: Address shellcheck warnings about signal names and adding double quotes for expression")

Thanks,
Namhyung

Quoted 32 lines
---
 tools/perf/tests/shell/test_arm_callgraph_fp.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/perf/tests/shell/test_arm_callgraph_fp.sh +4 -4
index 1380e0d12dce..66dfdfdad553 100755
@@ -15,7 +15,8 @@ cleanup_files()
 trap cleanup_files EXIT TERM INT
 
 # Add a 1 second delay to skip samples that are not in the leaf() function
-perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- "$TEST_PROGRAM" 2> /dev/null &
+# shellcheck disable=SC2086
+perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null &
 PID=$!
 
 echo " + Recording (PID=$PID)..."
@@ -33,8 +34,8 @@ wait $PID
 #      76c leafloop
 # ...
 
-perf script -i $PERF_DATA -F comm,ip,sym | head -n4
-perf script -i $PERF_DATA -F comm,ip,sym | head -n4 | \
+perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4
+perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 | \
        awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" ||
                                                       sym[1] != "parent" ||
                                                       sym[2] != "leafloop") exit 1 }'
--

2.34.1

maintainer Applied
#3 lore raw
Quoted 6 lines · Markus Elfring

…

Quoted 2 lines

At the same time silence the shellcheck warning for that line and fix two more shellcheck errors at the end of the script.

Does such a wording really fit to the known requirement “Solve only one problem per patch.”?

Maybe not, but I think it still falls into the shellcheck category. I don't mind having those trivial fixes together.

Applied to perf-tools-next, thanks!

Quoted 3 lines

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4-rc7#n81

#4 lore raw
In reply to Markus Elfring
Quoted 4 lines · Markus Elfring

…

Quoted 2 lines

At the same time silence the shellcheck warning for that line and fix two more shellcheck errors at the end of the script.

Quoted 8 lines

Does such a wording really fit to the known requirement “Solve only one problem per patch.”?

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4-rc7#n81

Regards,
Markus

I think so, it fixes all the shellcheck errors that were claimed to be fixed and introduced by the referenced fix.

To be honest I would have rather just reverted the original change completely because it was obviously never tested.