1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event tracing - enable/disable with event level files
4# flags: instance
5
6do_reset() {
7    echo > set_event
8    clear_trace
9}
10
11fail() { #msg
12    echo $1
13    exit_fail
14}
15
16if [ ! -f set_event -o ! -d events/sched ]; then
17    echo "event tracing is not supported"
18    exit_unsupported
19fi
20
21echo 'sched:sched_switch' > set_event
22
23yield
24
25count=`cat trace | grep sched_switch | wc -l`
26if [ $count -eq 0 ]; then
27    fail "sched_switch events are not recorded"
28fi
29
30do_reset
31
32echo 1 > events/sched/sched_switch/enable
33
34yield
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
44
45yield
46
47count=`cat trace | grep sched_switch | wc -l`
48if [ $count -ne 0 ]; then
49    fail "sched_switch events should not be recorded"
50fi
51
52exit 0
53