selftests/ftrace: Add check for ping command for trigger tests

All these tests depend on the ping command and will fail if it is not
found. Allow tests to specify dependencies on programs through the
'requires' field. Add dependency on 'ping' for some of the trigger
tests.

Link: https://lore.kernel.org/all/20221017104312.16af5467@gandalf.local.home/
Reported-by: Akanksha J N <akanksha@linux.vnet.ibm.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Suggested-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Naveen N. Rao 2022-10-28 12:46:09 +05:30 committed by Shuah Khan
parent ecc7d67af4
commit 4aa4d4def2
10 changed files with 16 additions and 10 deletions

View File

@ -142,9 +142,15 @@ finish_ftrace() {
check_requires() { # Check required files and tracers
for i in "$@" ; do
p=${i%:program}
r=${i%:README}
t=${i%:tracer}
if [ $t != $i ]; 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
echo "Required tracer $t is not configured."
exit_unsupported

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test field variable support
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program
fail() { #msg
echo $1

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event combined histogram trigger
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program
fail() { #msg
echo $1

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger onchange action
# requires: set_event "onchange(var)":README
# requires: set_event "onchange(var)":README ping:program
fail() { #msg
echo $1

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger onmatch action
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program
fail() { #msg
echo $1

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger onmatch-onmax action
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program
fail() { #msg
echo $1

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger onmax action
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program
fail() { #msg
echo $1

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger snapshot action
# requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README
# requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README ping:program
fail() { #msg
echo $1

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger trace action with dynamic string param
# requires: set_event synthetic_events events/sched/sched_process_exec/hist "char name[]' >> synthetic_events":README
# requires: set_event synthetic_events events/sched/sched_process_exec/hist "char name[]' >> synthetic_events":README ping:program
fail() { #msg
echo $1

View File

@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger trace action
# requires: set_event synthetic_events events/sched/sched_process_fork/hist "trace(<synthetic_event>":README
# requires: set_event synthetic_events events/sched/sched_process_fork/hist "trace(<synthetic_event>":README ping:program
fail() { #msg
echo $1