1 #!/bin/sh 2 # SPDX-License-Identifier: GPL-2.0 3 # description: trace_marker trigger - test snapshot trigger 4 # flags: instance 5 6 fail() { #msg 7 echo $1 8 exit_fail 9 } 10 11 if [ ! -f set_event ]; then 12 echo "event tracing is not supported" 13 exit_unsupported 14 fi 15 16 if [ ! -f snapshot ]; then 17 echo "snapshot is not supported" 18 exit_unsupported 19 fi 20 21 if [ ! -d events/ftrace/print ]; then 22 echo "event trace_marker is not supported" 23 exit_unsupported 24 fi 25 26 if [ ! -f events/ftrace/print/trigger ]; then 27 echo "event trigger is not supported" 28 exit_unsupported 29 fi 30 31 test_trace() { 32 file=$1 33 x=$2 34 35 cat $file | while read line; do 36 comment=`echo $line | sed -e 's/^#//'` 37 if [ "$line" != "$comment" ]; then 38 continue 39 fi 40 echo "testing $line for >$x<" 41 match=`echo $line | sed -e "s/>$x<//"` 42 if [ "$line" = "$match" ]; then 43 fail "$line does not have >$x< in it" 44 fi 45 x=$((x+2)) 46 done 47 } 48 49 echo "Test snapshot trace_marker tigger" 50 51 echo 'snapshot' > events/ftrace/print/trigger 52 53 # make sure the snapshot is allocated 54 55 grep -q 'Snapshot is allocated' snapshot 56 57 for i in `seq 1 10` ; do echo "hello >$i<" > trace_marker; done 58 59 test_trace trace 1 60 test_trace snapshot 2 61 62 exit 0 63