xref: /linux/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc (revision 24168c5e6dfbdd5b414f048f47f75d64533296ca)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event tracing - enable/disable with top level files
4# requires: available_events set_event events/enable
5
6do_reset() {
7    echo > set_event
8    clear_trace
9}
10
11fail() { #msg
12    echo $1
13    exit_fail
14}
15
16echo '*:*' > set_event
17
18yield
19
20echo 0 > tracing_on
21
22count=`head -n 128 trace | grep -v ^# | wc -l`
23if [ $count -eq 0 ]; then
24    fail "none of events are recorded"
25fi
26
27do_reset
28
29echo 1 > events/enable
30echo 1 > tracing_on
31
32yield
33
34echo 0 > tracing_on
35count=`head -n 128 trace | grep -v ^# | wc -l`
36if [ $count -eq 0 ]; then
37    fail "none of events are recorded"
38fi
39
40do_reset
41
42echo 0 > events/enable
43
44yield
45
46count=`cat trace | grep -v ^# | wc -l`
47if [ $count -ne 0 ]; then
48    fail "any of events should not be recorded"
49fi
50
51exit 0
52