Linux 4.8-rc8
[linux/fpc-iii.git] / tools / testing / selftests / ftrace / test.d / trigger / trigger-eventonoff.tc
blob1a9445021bf1e7a9016e71d2b3fc4deb7986f769
1 #!/bin/sh
2 # description: event trigger - test event enable/disable trigger
4 do_reset() {
5 reset_trigger
6 echo > set_event
7 clear_trace
10 fail() { #msg
11 do_reset
12 echo $1
13 exit $FAIL
16 if [ ! -f set_event -o ! -d events/sched ]; then
17 echo "event tracing is not supported"
18 exit_unsupported
21 if [ ! -f events/sched/sched_process_fork/trigger ]; then
22 echo "event trigger is not supported"
23 exit_unsupported
26 reset_tracer
27 do_reset
29 FEATURE=`grep enable_event events/sched/sched_process_fork/trigger`
30 if [ -z "$FEATURE" ]; then
31 echo "event enable/disable trigger is not supported"
32 exit_unsupported
35 echo "Test enable_event trigger"
36 echo 0 > events/sched/sched_switch/enable
37 echo 'enable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger
38 ( echo "forked")
39 if [ `cat events/sched/sched_switch/enable` != '1*' ]; then
40 fail "enable_event trigger on sched_process_fork did not work"
43 reset_trigger
45 echo "Test disable_event trigger"
46 echo 1 > events/sched/sched_switch/enable
47 echo 'disable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger
48 ( echo "forked")
49 if [ `cat events/sched/sched_switch/enable` != '0*' ]; then
50 fail "disable_event trigger on sched_process_fork did not work"
53 reset_trigger
55 echo "Test semantic error for event enable/disable trigger"
56 ! echo 'enable_event:nogroup:noevent' > events/sched/sched_process_fork/trigger
57 ! echo 'disable_event+1' > events/sched/sched_process_fork/trigger
58 echo 'enable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger
59 ! echo 'enable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger
60 ! echo 'disable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger
62 do_reset
64 exit 0