WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / ftrace / test.d / event / event-pid.tc
blob7f5f97dffdc3dda37a81cdba70dc18bdf656a0d8
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: event tracing - restricts events based on pid
4 # requires: set_event set_event_pid events/sched
5 # flags: instance
7 do_reset() {
8 echo > set_event
9 echo > set_event_pid
10 echo 0 > options/event-fork
11 clear_trace
14 fail() { #msg
15 do_reset
16 echo $1
17 exit_fail
20 echo 0 > options/event-fork
22 echo 1 > events/sched/sched_switch/enable
24 yield
26 count=`cat trace | grep sched_switch | wc -l`
27 if [ $count -eq 0 ]; then
28 fail "sched_switch events are not recorded"
31 do_reset
33 read mypid rest < /proc/self/stat
35 echo $mypid > set_event_pid
36 grep -q $mypid set_event_pid
37 echo 'sched:sched_switch' > set_event
39 yield
41 count=`cat trace | grep sched_switch | grep -v "pid=$mypid" | wc -l`
42 if [ $count -ne 0 ]; then
43 fail "sched_switch events from other task are recorded"
46 do_reset
48 echo $mypid > set_event_pid
49 echo 1 > options/event-fork
50 echo 1 > events/sched/sched_switch/enable
52 yield
54 count=`cat trace | grep sched_switch | grep -v "pid=$mypid" | wc -l`
55 if [ $count -eq 0 ]; then
56 fail "sched_switch events from other task are not recorded"
59 do_reset
61 exit 0