1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: trace_marker trigger - test snapshot trigger 4# flags: instance 5 6fail() { #msg 7 echo $1 8 exit_fail 9} 10 11if [ ! -f set_event ]; then 12 echo "event tracing is not supported" 13 exit_unsupported 14fi 15 16if [ ! -f snapshot ]; then 17 echo "snapshot is not supported" 18 exit_unsupported 19fi 20 21if [ ! -d events/ftrace/print ]; then 22 echo "event trace_marker is not supported" 23 exit_unsupported 24fi 25 26if [ ! -f events/ftrace/print/trigger ]; then 27 echo "event trigger is not supported" 28 exit_unsupported 29fi 30 31test_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 49echo "Test snapshot trace_marker tigger" 50 51echo 'snapshot' > events/ftrace/print/trigger 52 53# make sure the snapshot is allocated 54 55grep -q 'Snapshot is allocated' snapshot 56 57for i in `seq 1 10` ; do echo "hello >$i<" > trace_marker; done 58 59test_trace trace 1 60test_trace snapshot 2 61 62exit 0 63