forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
....@@ -3,18 +3,14 @@
33 # description: ftrace - test for function event triggers
44 # flags: instance
55 #
6
+# The triggers are set within the set_ftrace_filter file
7
+# requires: set_ftrace_filter
8
+#
69 # Ftrace allows to add triggers to functions, such as enabling or disabling
710 # tracing, enabling or disabling trace events, or recording a stack trace
811 # within the ring buffer.
912 #
1013 # This test is designed to test event triggers
11
-#
12
-
13
-# The triggers are set within the set_ftrace_filter file
14
-if [ ! -f set_ftrace_filter ]; then
15
- echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
16
- exit_unsupported
17
-fi
1814
1915 do_reset() {
2016 reset_ftrace_filter
....@@ -25,14 +21,11 @@
2521 }
2622
2723 fail() { # mesg
28
- do_reset
2924 echo $1
3025 exit_fail
3126 }
3227
3328 SLEEP_TIME=".1"
34
-
35
-do_reset
3629
3730 echo "Testing function probes with events:"
3831
....@@ -45,11 +38,18 @@
4538
4639 test_event_enabled() {
4740 val=$1
41
+ check_times=10 # wait for 10 * SLEEP_TIME at most
4842
49
- e=`cat $EVENT_ENABLE`
50
- if [ "$e" != $val ]; then
51
- fail "Expected $val but found $e"
52
- fi
43
+ while [ $check_times -ne 0 ]; do
44
+ e=`cat $EVENT_ENABLE`
45
+ if [ "$e" = $val ]; then
46
+ return 0
47
+ fi
48
+ sleep $SLEEP_TIME
49
+ check_times=$((check_times - 1))
50
+ done
51
+
52
+ fail "Expected $val but found $e"
5353 }
5454
5555 run_enable_disable() {