staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / ftrace / test.d / instances / instance-event.tc
blob4fa0f79144f4abbf96ea294443a4c726d6296ee1
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: Test creation and deletion of trace instances while setting an event
5 if [ ! -d instances ] ; then
6 echo "no instance directory with this kernel"
7 exit_unsupported;
8 fi
10 fail() { # mesg
11 rmdir foo 2>/dev/null
12 echo $1
13 set -e
14 exit_fail
17 cd instances
19 # we don't want to fail on error
20 set +e
22 mkdir x
23 rmdir x
24 result=$?
26 if [ $result -ne 0 ]; then
27 echo "instance rmdir not supported"
28 exit_unsupported
31 instance_slam() {
32 while :; do
33 mkdir foo 2> /dev/null
34 rmdir foo 2> /dev/null
35 done
38 instance_read() {
39 while :; do
40 cat foo/trace 1> /dev/null 2>&1
41 done
44 instance_set() {
45 while :; do
46 echo 1 > foo/events/sched/sched_switch
47 done 2> /dev/null
50 instance_slam &
51 p1=$!
52 echo $p1
54 instance_set &
55 p2=$!
56 echo $p2
58 instance_read &
59 p3=$!
60 echo $p3
62 sleep 1
64 kill -1 $p3
65 kill -1 $p2
66 kill -1 $p1
68 echo "Wait for processes to finish"
69 wait $p1 $p2 $p3
70 echo "all processes finished, wait for cleanup"
71 sleep 1
73 mkdir foo
74 ls foo > /dev/null
75 rmdir foo
76 if [ -d foo ]; then
77 fail "foo still exists"
80 mkdir foo
81 echo "schedule:enable_event:sched:sched_switch" > foo/set_ftrace_filter
82 rmdir foo
83 if [ -d foo ]; then
84 fail "foo still exists"
86 if grep -q "schedule:enable_event:sched:sched_switch" ../set_ftrace_filter; then
87 echo "Older kernel detected. Cleanup filter"
88 echo '!schedule:enable_event:sched:sched_switch' > ../set_ftrace_filter
91 instance_slam() {
92 while :; do
93 mkdir x
94 mkdir y
95 mkdir z
96 rmdir x
97 rmdir y
98 rmdir z
99 done 2>/dev/null
102 instance_slam &
103 p1=$!
104 echo $p1
106 instance_slam &
107 p2=$!
108 echo $p2
110 instance_slam &
111 p3=$!
112 echo $p3
114 instance_slam &
115 p4=$!
116 echo $p4
118 instance_slam &
119 p5=$!
120 echo $p5
122 ls -lR >/dev/null
123 sleep 1
125 kill -1 $p1
126 kill -1 $p2
127 kill -1 $p3
128 kill -1 $p4
129 kill -1 $p5
131 echo "Wait for processes to finish"
132 wait $p1 $p2 $p3 $p4 $p5
133 echo "all processes finished, wait for cleanup"
135 mkdir x y z
136 ls x y z
137 rmdir x y z
138 for d in x y z; do
139 if [ -d $d ]; then
140 fail "instance $d still exists"
142 done
144 set -e
146 exit 0