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