linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/ftrace: event_triggers: wait longer for test_event_enable
@ 2022-11-04  2:09 Yipeng Zou
  2022-11-05  8:52 ` Masami Hiramatsu
  0 siblings, 1 reply; 4+ messages in thread
From: Yipeng Zou @ 2022-11-04  2:09 UTC (permalink / raw)
  To: rostedt, mhiramat, shuah, rdunlap, linux-kselftest, linux-kernel
  Cc: zouyipeng

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")
Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
---
 .../ftrace/test.d/ftrace/func_event_triggers.tc   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
index 8d26d5505808..3eea2abf68f9 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
@@ -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() {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/ftrace: event_triggers: wait longer for test_event_enable
  2022-11-04  2:09 [PATCH] selftests/ftrace: event_triggers: wait longer for test_event_enable Yipeng Zou
@ 2022-11-05  8:52 ` Masami Hiramatsu
  2022-11-14 18:10   ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2022-11-05  8:52 UTC (permalink / raw)
  To: Yipeng Zou; +Cc: rostedt, shuah, rdunlap, linux-kselftest, linux-kernel

Hi Yipeng,

On Fri, 4 Nov 2022 10:09:31 +0800
Yipeng Zou <zouyipeng@huawei.com> 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)

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thank you!

> 
> 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")
> Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
> ---
>  .../ftrace/test.d/ftrace/func_event_triggers.tc   | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
> index 8d26d5505808..3eea2abf68f9 100644
> --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
> @@ -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() {
> -- 
> 2.17.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/ftrace: event_triggers: wait longer for test_event_enable
  2022-11-05  8:52 ` Masami Hiramatsu
@ 2022-11-14 18:10   ` Steven Rostedt
  2022-11-14 18:25     ` Shuah Khan
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2022-11-14 18:10 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: Yipeng Zou, shuah, rdunlap, linux-kselftest, linux-kernel, Shuah Khan

On Sat, 5 Nov 2022 17:52:41 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> Hi Yipeng,
> 
> On Fri, 4 Nov 2022 10:09:31 +0800
> Yipeng Zou <zouyipeng@huawei.com> 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)
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 

Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Shuah,

Care to take this through your tree?

Thanks,

-- Steve


> Thank you!
> 
> > 
> > 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")
> > Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
> > ---
> >  .../ftrace/test.d/ftrace/func_event_triggers.tc   | 15 +++++++++++----
> >  1 file changed, 11 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
> > index 8d26d5505808..3eea2abf68f9 100644
> > --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc
> > @@ -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() {
> > -- 
> > 2.17.1
> >   
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/ftrace: event_triggers: wait longer for test_event_enable
  2022-11-14 18:10   ` Steven Rostedt
@ 2022-11-14 18:25     ` Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2022-11-14 18:25 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu (Google)
  Cc: Yipeng Zou, shuah, rdunlap, linux-kselftest, linux-kernel, Shuah Khan

On 11/14/22 11:10, Steven Rostedt wrote:
> On Sat, 5 Nov 2022 17:52:41 +0900
> Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> 
>> Hi Yipeng,
>>
>> On Fri, 4 Nov 2022 10:09:31 +0800
>> Yipeng Zou <zouyipeng@huawei.com> 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)
>>
>> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>>
> 
> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> 
> Shuah,
> 
> Care to take this through your tree?
> 

Yup. I will get this in.

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-14 18:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04  2:09 [PATCH] selftests/ftrace: event_triggers: wait longer for test_event_enable Yipeng Zou
2022-11-05  8:52 ` Masami Hiramatsu
2022-11-14 18:10   ` Steven Rostedt
2022-11-14 18:25     ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).