diff options
| author | Cao Ruichuang <create0818@163.com> | 2026-04-08 12:32:12 +0800 |
|---|---|---|
| committer | Shuah Khan <skhan@linuxfoundation.org> | 2026-04-13 11:05:39 -0600 |
| commit | f8e0a5a174d7d3bc3547c15bc1647c35427f5c34 (patch) | |
| tree | 80815fe4fc781f434fd19e91b720320bc221efc7 /tools | |
| parent | 7e47389142b8ada66280be71e01a3238751086f0 (diff) | |
selftests/ftrace: Quote check_requires comparisons
check_requires() compares requirement strings that can contain shell
pattern characters such as '[' and ']'. Under /bin/sh, the unquoted
test expressions can emit 'unexpected operator' warnings while parsing
README-backed requirements.
Quote the relevant comparisons and path checks so the helper handles
those patterns without spurious shell warnings.
Validated by rerunning fprobe_syntax_errors.tc and confirming the
previous '/bin/sh: unexpected operator' lines disappear from the
detailed ftracetest log.
Signed-off-by: Cao Ruichuang <create0818@163.com>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20260408043212.8063-1-create0818@163.com
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/testing/selftests/ftrace/test.d/functions | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions index 41325f387ee7..826141e299e5 100644 --- a/tools/testing/selftests/ftrace/test.d/functions +++ b/tools/testing/selftests/ftrace/test.d/functions @@ -145,13 +145,13 @@ check_requires() { # Check required files and tracers p=${i%:program} r=${i%:README} t=${i%:tracer} - if [ $p != $i ]; then - if ! which $p ; then + if [ "$p" != "$i" ]; then + if ! which "$p" ; then echo "Required program $p is not found." exit_unresolved fi - elif [ $t != $i ]; then - if ! grep -wq $t available_tracers ; then + elif [ "$t" != "$i" ]; then + if ! grep -wq "$t" available_tracers ; then echo "Required tracer $t is not configured." exit_unsupported fi @@ -162,11 +162,11 @@ check_requires() { # Check required files and tracers else test=$TRACING_DIR fi - if ! grep -Fq "$r" $test/README ; then + if ! grep -Fq "$r" "$test"/README ; then echo "Required feature pattern \"$r\" is not in README." exit_unsupported fi - elif [ ! -e $i ]; then + elif [ ! -e "$i" ]; then echo "Required feature interface $i doesn't exist." exit_unsupported fi @@ -227,4 +227,4 @@ get_mnt_options() { local opts=$(mount | grep -m1 "$mnt_point" | sed -e 's/.*(\(.*\)).*/\1/') echo "$opts" -}
\ No newline at end of file +} |
