70 lines · plain
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03# description: Test ftrace direct functions against tracers4 5rmmod ftrace-direct ||:6if ! modprobe ftrace-direct ; then7 echo "No ftrace-direct sample module - please make CONFIG_SAMPLE_FTRACE_DIRECT=m"8 exit_unresolved;9fi10 11echo "Let the module run a little"12sleep 113 14grep -q "my_direct_func: waking up" trace15 16rmmod ftrace-direct17 18test_tracer() {19 tracer=$120 21 # tracer -> direct -> no direct > no tracer22 echo $tracer > current_tracer23 modprobe ftrace-direct24 rmmod ftrace-direct25 echo nop > current_tracer26 27 # tracer -> direct -> no tracer > no direct28 echo $tracer > current_tracer29 modprobe ftrace-direct30 echo nop > current_tracer31 rmmod ftrace-direct32 33 # direct -> tracer -> no tracer > no direct34 modprobe ftrace-direct35 echo $tracer > current_tracer36 echo nop > current_tracer37 rmmod ftrace-direct38 39 # direct -> tracer -> no direct > no notracer40 modprobe ftrace-direct41 echo $tracer > current_tracer42 rmmod ftrace-direct43 echo nop > current_tracer44}45 46for t in `cat available_tracers`; do47 if [ "$t" != "nop" ]; then48 test_tracer $t49 fi50done51 52echo nop > current_tracer53rmmod ftrace-direct ||:54 55# Now do the same thing with another direct function registered56echo "Running with another ftrace direct function"57 58rmmod ftrace-direct-too ||:59modprobe ftrace-direct-too60 61for t in `cat available_tracers`; do62 if [ "$t" != "nop" ]; then63 test_tracer $t64 fi65done66 67echo nop > current_tracer68rmmod ftrace-direct ||:69rmmod ftrace-direct-too ||:70