1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: event trigger - test traceon/off trigger 4 5do_reset() { 6 reset_trigger 7 echo > set_event 8 clear_trace 9} 10 11fail() { #msg 12 do_reset 13 echo $1 14 exit_fail 15} 16 17if [ ! -f set_event -o ! -d events/sched ]; then 18 echo "event tracing is not supported" 19 exit_unsupported 20fi 21 22if [ ! -f events/sched/sched_process_fork/trigger ]; then 23 echo "event trigger is not supported" 24 exit_unsupported 25fi 26 27reset_tracer 28do_reset 29 30echo "Test traceoff trigger" 31echo 1 > tracing_on 32echo 'traceoff' > events/sched/sched_process_fork/trigger 33( echo "forked") 34if [ `cat tracing_on` -ne 0 ]; then 35 fail "traceoff trigger on sched_process_fork did not work" 36fi 37 38reset_trigger 39 40echo "Test traceon trigger" 41echo 0 > tracing_on 42echo 'traceon' > events/sched/sched_process_fork/trigger 43( echo "forked") 44if [ `cat tracing_on` -ne 1 ]; then 45 fail "traceoff trigger on sched_process_fork did not work" 46fi 47 48reset_trigger 49 50echo "Test semantic error for traceoff/on trigger" 51! echo 'traceoff:badparam' > events/sched/sched_process_fork/trigger 52! echo 'traceoff+0' > events/sched/sched_process_fork/trigger 53echo 'traceon' > events/sched/sched_process_fork/trigger 54! echo 'traceon' > events/sched/sched_process_fork/trigger 55! echo 'traceoff' > events/sched/sched_process_fork/trigger 56 57do_reset 58 59exit 0 60