diff options
Diffstat (limited to 'tools/testing/selftests/ftrace/test.d/functions')
| -rw-r--r-- | tools/testing/selftests/ftrace/test.d/functions | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions index 84d6a9c7ad67..826141e299e5 100644 --- a/tools/testing/selftests/ftrace/test.d/functions +++ b/tools/testing/selftests/ftrace/test.d/functions @@ -104,7 +104,7 @@ clear_dynamic_events() { # reset all current dynamic events done } -initialize_ftrace() { # Reset ftrace to initial-state +initialize_system() { # Reset ftrace to initial-state # As the initial state, ftrace will be set to nop tracer, # no events, no triggers, no filters, no function filters, # no probes, and tracing on. @@ -134,8 +134,8 @@ initialize_ftrace() { # Reset ftrace to initial-state enable_tracing } -finish_ftrace() { - initialize_ftrace +finish_system() { + initialize_system # And recover it to default. [ -f options/pause-on-trace ] && echo 0 > options/pause-on-trace } @@ -145,28 +145,38 @@ 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 elif [ "$r" != "$i" ]; then - if ! grep -Fq "$r" README ; then + # If this is an instance, check the top directory + if echo $TRACING_DIR | grep -q "/instances/"; then + test="$TRACING_DIR/../.." + else + test=$TRACING_DIR + fi + 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 done } +check_awk_strtonum() { # strtonum is GNU awk extension + awk 'BEGIN{strtonum("0x1")}' +} + LOCALHOST=127.0.0.1 yield() { @@ -217,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 +} |
