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