xref: /linux/tools/testing/selftests/ftrace/test.d/event/event-enable.tc (revision e0bf6c5ca2d3281f231c5f0c9bf145e9513644de)
1#!/bin/sh
2# description: event tracing - enable/disable with event level files
3
4do_reset() {
5    echo > set_event
6    clear_trace
7}
8
9fail() { #msg
10    do_reset
11    echo $1
12    exit -1
13}
14
15if [ ! -f set_event -o ! -d events/sched ]; then
16    echo "event tracing is not supported"
17    exit_unsupported
18fi
19
20reset_tracer
21do_reset
22
23echo 'sched:sched_switch' > set_event
24usleep 1
25
26count=`cat trace | grep sched_switch | wc -l`
27if [ $count -eq 0 ]; then
28    fail "sched_switch events are not recorded"
29fi
30
31do_reset
32
33echo 1 > events/sched/sched_switch/enable
34usleep 1
35
36count=`cat trace | grep sched_switch | wc -l`
37if [ $count -eq 0 ]; then
38    fail "sched_switch events are not recorded"
39fi
40
41do_reset
42
43echo 0 > events/sched/sched_switch/enable
44usleep 1
45
46count=`cat trace | grep sched_switch | wc -l`
47if [ $count -ne 0 ]; then
48    fail "sched_switch events should not be recorded"
49fi
50
51do_reset
52
53exit 0
54