Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0
0003 # description: Test ftrace direct functions against tracers
0004 
0005 rmmod ftrace-direct ||:
0006 if ! modprobe ftrace-direct ; then
0007   echo "No ftrace-direct sample module - please make CONFIG_SAMPLE_FTRACE_DIRECT=m"
0008   exit_unresolved;
0009 fi
0010 
0011 echo "Let the module run a little"
0012 sleep 1
0013 
0014 grep -q "my_direct_func: waking up" trace
0015 
0016 rmmod ftrace-direct
0017 
0018 test_tracer() {
0019         tracer=$1
0020 
0021         # tracer -> direct -> no direct > no tracer
0022         echo $tracer > current_tracer
0023         modprobe ftrace-direct
0024         rmmod ftrace-direct
0025         echo nop > current_tracer
0026 
0027         # tracer -> direct -> no tracer > no direct
0028         echo $tracer > current_tracer
0029         modprobe ftrace-direct
0030         echo nop > current_tracer
0031         rmmod ftrace-direct
0032 
0033         # direct -> tracer -> no tracer > no direct
0034         modprobe ftrace-direct
0035         echo $tracer > current_tracer
0036         echo nop > current_tracer
0037         rmmod ftrace-direct
0038 
0039         # direct -> tracer -> no direct > no notracer
0040         modprobe ftrace-direct
0041         echo $tracer > current_tracer
0042         rmmod ftrace-direct
0043         echo nop > current_tracer
0044 }
0045 
0046 for t in `cat available_tracers`; do
0047         if [ "$t" != "nop" ]; then
0048                 test_tracer $t
0049         fi
0050 done
0051 
0052 echo nop > current_tracer
0053 rmmod ftrace-direct ||:
0054 
0055 # Now do the same thing with another direct function registered
0056 echo "Running with another ftrace direct function"
0057 
0058 rmmod ftrace-direct-too ||:
0059 modprobe ftrace-direct-too
0060 
0061 for t in `cat available_tracers`; do
0062         if [ "$t" != "nop" ]; then
0063                 test_tracer $t
0064         fi
0065 done
0066 
0067 echo nop > current_tracer
0068 rmmod ftrace-direct ||:
0069 rmmod ftrace-direct-too ||: