xref: /openbmc/linux/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc (revision c845428b7a9157523103100806bc8130d64769c8)
1815b18eaSNamhyung Kim#!/bin/sh
2b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
3815b18eaSNamhyung Kim# description: event tracing - enable/disable with subsystem level files
43591e90fSMasami Hiramatsu# requires: set_event events/sched/enable
535df6a89SSteven Rostedt (VMware)# flags: instance
6815b18eaSNamhyung Kim
7815b18eaSNamhyung Kimdo_reset() {
8815b18eaSNamhyung Kim    echo > set_event
9815b18eaSNamhyung Kim    clear_trace
10815b18eaSNamhyung Kim}
11815b18eaSNamhyung Kim
12815b18eaSNamhyung Kimfail() { #msg
13815b18eaSNamhyung Kim    echo $1
1442534b1fSMasami Hiramatsu    exit_fail
15815b18eaSNamhyung Kim}
16815b18eaSNamhyung Kim
17815b18eaSNamhyung Kimecho 'sched:*' > set_event
182bfd4d1fSNamhyung Kim
192bfd4d1fSNamhyung Kimyield
20815b18eaSNamhyung Kim
21*9f39e9e3SYuanhe Shucount=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
22815b18eaSNamhyung Kimif [ $count -lt 3 ]; then
23815b18eaSNamhyung Kim    fail "at least fork, exec and exit events should be recorded"
24815b18eaSNamhyung Kimfi
25815b18eaSNamhyung Kim
26815b18eaSNamhyung Kimdo_reset
27815b18eaSNamhyung Kim
28815b18eaSNamhyung Kimecho 1 > events/sched/enable
292bfd4d1fSNamhyung Kim
302bfd4d1fSNamhyung Kimyield
31815b18eaSNamhyung Kim
32*9f39e9e3SYuanhe Shucount=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
33815b18eaSNamhyung Kimif [ $count -lt 3 ]; then
34815b18eaSNamhyung Kim    fail "at least fork, exec and exit events should be recorded"
35815b18eaSNamhyung Kimfi
36815b18eaSNamhyung Kim
37815b18eaSNamhyung Kimdo_reset
38815b18eaSNamhyung Kim
39815b18eaSNamhyung Kimecho 0 > events/sched/enable
402bfd4d1fSNamhyung Kim
412bfd4d1fSNamhyung Kimyield
42815b18eaSNamhyung Kim
43*9f39e9e3SYuanhe Shucount=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
44815b18eaSNamhyung Kimif [ $count -ne 0 ]; then
45815b18eaSNamhyung Kim    fail "any of scheduler events should not be recorded"
46815b18eaSNamhyung Kimfi
47815b18eaSNamhyung Kim
48815b18eaSNamhyung Kimexit 0
49