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