]> git.baikalelectronics.ru Git - kernel.git/commitdiff
selftests/ftrace: event_triggers: wait longer for test_event_enable
authorYipeng Zou <zouyipeng@huawei.com>
Fri, 4 Nov 2022 02:09:31 +0000 (10:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:40:53 +0000 (11:40 +0100)
[ Upstream commit a1d6cd88c8973cfb08ee85722488b1d6d5d16327 ]

In some platform, the schedule event may came slowly, delay 100ms can't
cover it.

I was notice that on my board which running in low cpu_freq,and this
selftests allways gose fail.

So maybe we can check more times here to wait longer.

Fixes: 301f8c0f655c ("selftests: ftrace: Add a selftest to test event enable/disable func trigger")
Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc

index ca2ffd7957f9e7e8feaa2d32f18a8f13376a7fd6..f261eeccfaf6d3a127b448b26b4d991e0c944ee5 100644 (file)
@@ -42,11 +42,18 @@ cnt_trace() {
 
 test_event_enabled() {
     val=$1
+    check_times=10             # wait for 10 * SLEEP_TIME at most
 
-    e=`cat $EVENT_ENABLE`
-    if [ "$e" != $val ]; then
-       fail "Expected $val but found $e"
-    fi
+    while [ $check_times -ne 0 ]; do
+       e=`cat $EVENT_ENABLE`
+       if [ "$e" == $val ]; then
+           return 0
+       fi
+       sleep $SLEEP_TIME
+       check_times=$((check_times - 1))
+    done
+
+    fail "Expected $val but found $e"
 }
 
 run_enable_disable() {