Skip to contentSkip to conversation

selftests/ftrace: event_triggers: wait longer for test_event_enable

PATCH In review Yipeng Zou 4 participants 4 messages Nov 4, 2022 – Nov 14, 2022

Subsystems (2)
lore
Share & tools
lore

Yipeng Zou

author
#0 lore raw

PATCH 1/1 selftests/ftrace: event_triggers: wait longer for test_event_enable

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 43bb45da82f9 ("selftests: ftrace: Add a selftest to test event enable/disable func trigger")
---
 .../ftrace/test.d/ftrace/func_event_triggers.tc   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +11 -4
index 8d26d5505808..3eea2abf68f9 100644
@@ -38,11 +38,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() {
Signature · 1 line
2.17.1
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Yipeng,

Quoted 5 lines · On Fri, 4 Nov 2022 10:09:31 +0800 Yipeng Zou <[email protected]> wrote:

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.

This looks good to me, since this can just extend the waiting time to 1 sec. (and most of the platforms have no effect)

Thank you!

Quoted 39 lines

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

Fixes 43bb45da82f9 ("selftests: ftrace: Add a selftest to test event enable/disable func trigger")
---
 .../ftrace/test.d/ftrace/func_event_triggers.tc   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +11 -4
index 8d26d5505808..3eea2abf68f9 100644
@@ -38,11 +38,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() {
Signature · 1 line
2.17.1
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
maintainer Acked-by
#2 lore raw
Quoted 8 lines · On Sat, 5 Nov 2022 17:52:41 +0900 Masami Hiramatsu (Google)…

Hi Yipeng,

Quoted 3 lines · On Fri, 4 Nov 2022 10:09:31 +0800 Yipeng Zou <[email protected]> wrote:

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

Quoted 8 lines
Quoted 2 lines

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

This looks good to me, since this can just extend the waiting time to 1 sec. (and most of the platforms have no effect)

Shuah,

Care to take this through your tree?

Thanks,

-- Steve

Quoted 43 lines

Thank you!

Quoted 39 lines

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

Fixes 43bb45da82f9 ("selftests: ftrace: Add a selftest to test event enable/disable func trigger")
---
 .../ftrace/test.d/ftrace/func_event_triggers.tc   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +11 -4
index 8d26d5505808..3eea2abf68f9 100644
@@ -38,11 +38,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() {
Signature · 1 line
2.17.1
maintainer
#3 lore raw
Quoted 17 lines · Steven Rostedt
Quoted 14 lines · On Sat, 5 Nov 2022 17:52:41 +0900 Masami Hiramatsu (Google)…

Hi Yipeng,

Quoted 5 lines · On Fri, 4 Nov 2022 10:09:31 +0800 Yipeng Zou <[email protected]> wrote:

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.

This looks good to me, since this can just extend the waiting time to 1 sec. (and most of the platforms have no effect)

Quoted 9 lines
Quoted 2 lines

Shuah,

Care to take this through your tree?

Yup. I will get this in.

thanks,
-- Shuah