xref: /linux/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc (revision e0bf6c5ca2d3281f231c5f0c9bf145e9513644de)
1#!/bin/sh
2# description: event tracing - enable/disable with top 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 available_events -o ! -f set_event -o ! -d events ]; then
16    echo "event tracing is not supported"
17    exit_unsupported
18fi
19
20reset_tracer
21do_reset
22
23echo '*:*' > set_event
24count=`cat trace | grep -v ^# | wc -l`
25if [ $count -eq 0 ]; then
26    fail "none of events are recorded"
27fi
28
29do_reset
30
31echo 1 > events/enable
32count=`cat trace | grep -v ^# | wc -l`
33if [ $count -eq 0 ]; then
34    fail "none of events are recorded"
35fi
36
37do_reset
38
39echo 0 > events/enable
40count=`cat trace | grep -v ^# | wc -l`
41if [ $count -ne 0 ]; then
42    fail "any of events should not be recorded"
43fi
44
45do_reset
46
47exit 0
48