Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0
0003 # description: trace_marker trigger - test snapshot trigger
0004 # requires: set_event snapshot events/ftrace/print/trigger
0005 # flags: instance
0006 
0007 fail() { #msg
0008     echo $1
0009     exit_fail
0010 }
0011 
0012 test_trace() {
0013     file=$1
0014     x=$2
0015 
0016     cat $file | while read line; do
0017         comment=`echo $line | sed -e 's/^#//'`
0018         if [ "$line" != "$comment" ]; then
0019             continue
0020         fi
0021         echo "testing $line for >$x<"
0022         match=`echo $line | sed -e "s/>$x<//"`
0023         if [ "$line" = "$match" ]; then
0024             fail "$line does not have >$x< in it"
0025         fi
0026         x=$((x+2))
0027     done
0028 }
0029 
0030 echo "Test snapshot trace_marker trigger"
0031 
0032 echo 'snapshot' > events/ftrace/print/trigger
0033 
0034 # make sure the snapshot is allocated
0035 
0036 grep -q 'Snapshot is allocated' snapshot
0037 
0038 for i in `seq 1 10` ; do echo "hello >$i<" > trace_marker; done
0039 
0040 test_trace trace 1
0041 test_trace snapshot 2
0042 
0043 exit 0