diff mbox series

[2/3] selftests/ftrace: Pick only the first kprobe event to test

Message ID 158834027133.28357.11196486193798517250.stgit@devnote2 (mailing list archive)
State Rejected
Headers show
Series selftests/ftrace: Fix ftracetest testcases for dash, etc. | expand

Commit Message

Masami Hiramatsu (Google) May 1, 2020, 1:37 p.m. UTC
Since the kprobe/kprobe_args_type.tc reads out all event logs
from the trace buffer, the test can fail if there is another
fork event happens.
Use head command to pick only the first kprobe event from
the trace buffer to test the argument types.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 .../ftrace/test.d/kprobe/kprobe_args_type.tc       |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Rostedt May 1, 2020, 2:17 p.m. UTC | #1
On Fri,  1 May 2020 22:37:51 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Since the kprobe/kprobe_args_type.tc reads out all event logs
> from the trace buffer, the test can fail if there is another
> fork event happens.
> Use head command to pick only the first kprobe event from
> the trace buffer to test the argument types.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  .../ftrace/test.d/kprobe/kprobe_args_type.tc       |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> index 1bcb67dcae26..81490ecaaa92 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> @@ -38,7 +38,7 @@ for width in 64 32 16 8; do
>    echo 0 > events/kprobes/testprobe/enable
>  
>    : "Confirm the arguments is recorded in given types correctly"
> -  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
> +  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
>    check_types $ARGS $width
>  
>    : "Clear event for next loop"

I think I've manually added this exact change to my tests to keep it from
failing.

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve
shuah May 1, 2020, 3:38 p.m. UTC | #2
On 5/1/20 8:17 AM, Steven Rostedt wrote:
> On Fri,  1 May 2020 22:37:51 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
>> Since the kprobe/kprobe_args_type.tc reads out all event logs
>> from the trace buffer, the test can fail if there is another
>> fork event happens.
>> Use head command to pick only the first kprobe event from
>> the trace buffer to test the argument types.
>>
>> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
>> ---
>>   .../ftrace/test.d/kprobe/kprobe_args_type.tc       |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
>> index 1bcb67dcae26..81490ecaaa92 100644
>> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
>> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
>> @@ -38,7 +38,7 @@ for width in 64 32 16 8; do
>>     echo 0 > events/kprobes/testprobe/enable
>>   
>>     : "Confirm the arguments is recorded in given types correctly"
>> -  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
>> +  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
>>     check_types $ARGS $width
>>   
>>     : "Clear event for next loop"
> 
> I think I've manually added this exact change to my tests to keep it from
> failing.
> 
> Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> 

Does this conflict with:

Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
Date:   Tue Apr 7 14:34:19 2020 +0800

     selftests/ftrace: Check the first record for kprobe_args_type.tc

https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next&id=f0c0d0cf590f71b2213b29a7ded2cde3d0a1a0ba

I went into mainline yesterday in my rc4 pull request.

Exact change it appears.

diff --git 
a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc 
b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
index 1bcb67dcae26..81490ecaaa92 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
@@ -38,7 +38,7 @@ for width in 64 32 16 8; do
    echo 0 > events/kprobes/testprobe/enable

    : "Confirm the arguments is recorded in given types correctly"
-  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) 
arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
+  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) 
arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
    check_types $ARGS $width

    : "Clear event for next loop"

thanks,
-- Shuah
Steven Rostedt May 1, 2020, 4:20 p.m. UTC | #3
On Fri, 1 May 2020 09:38:59 -0600
shuah <shuah@kernel.org> wrote:

> On 5/1/20 8:17 AM, Steven Rostedt wrote:
> > On Fri,  1 May 2020 22:37:51 +0900
> > Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >   
> >> Since the kprobe/kprobe_args_type.tc reads out all event logs
> >> from the trace buffer, the test can fail if there is another
> >> fork event happens.
> >> Use head command to pick only the first kprobe event from
> >> the trace buffer to test the argument types.
> >>
> >> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> >> ---
> >>   .../ftrace/test.d/kprobe/kprobe_args_type.tc       |    2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> >> index 1bcb67dcae26..81490ecaaa92 100644
> >> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> >> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> >> @@ -38,7 +38,7 @@ for width in 64 32 16 8; do
> >>     echo 0 > events/kprobes/testprobe/enable
> >>   
> >>     : "Confirm the arguments is recorded in given types correctly"
> >> -  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
> >> +  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
> >>     check_types $ARGS $width
> >>   
> >>     : "Clear event for next loop"  
> > 
> > I think I've manually added this exact change to my tests to keep it from
> > failing.
> > 
> > Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> >   
> 
> Does this conflict with:
> 
> Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
> Date:   Tue Apr 7 14:34:19 2020 +0800
> 
>      selftests/ftrace: Check the first record for kprobe_args_type.tc
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next&id=f0c0d0cf590f71b2213b29a7ded2cde3d0a1a0ba
> 
> I went into mainline yesterday in my rc4 pull request.
> 
> Exact change it appears.

Ah, then I guess we don't need this patch ;-)

-- Steve


> 
> diff --git 
> a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc 
> b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> index 1bcb67dcae26..81490ecaaa92 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> @@ -38,7 +38,7 @@ for width in 64 32 16 8; do
>     echo 0 > events/kprobes/testprobe/enable
> 
>     : "Confirm the arguments is recorded in given types correctly"
> -  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) 
> arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
> +  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) 
> arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
>     check_types $ARGS $width
> 
>     : "Clear event for next loop"
> 
> thanks,
> -- Shuah
Shuah Khan May 1, 2020, 4:30 p.m. UTC | #4
On 5/1/20 10:20 AM, Steven Rostedt wrote:
> On Fri, 1 May 2020 09:38:59 -0600
> shuah <shuah@kernel.org> wrote:
> 
>> On 5/1/20 8:17 AM, Steven Rostedt wrote:
>>> On Fri,  1 May 2020 22:37:51 +0900
>>> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>>>    
>>>> Since the kprobe/kprobe_args_type.tc reads out all event logs
>>>> from the trace buffer, the test can fail if there is another
>>>> fork event happens.
>>>> Use head command to pick only the first kprobe event from
>>>> the trace buffer to test the argument types.
>>>>
>>>> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
>>>> ---
>>>>    .../ftrace/test.d/kprobe/kprobe_args_type.tc       |    2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
>>>> index 1bcb67dcae26..81490ecaaa92 100644
>>>> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
>>>> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
>>>> @@ -38,7 +38,7 @@ for width in 64 32 16 8; do
>>>>      echo 0 > events/kprobes/testprobe/enable
>>>>    
>>>>      : "Confirm the arguments is recorded in given types correctly"
>>>> -  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
>>>> +  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
>>>>      check_types $ARGS $width
>>>>    
>>>>      : "Clear event for next loop"
>>>
>>> I think I've manually added this exact change to my tests to keep it from
>>> failing.
>>>
>>> Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>>>    
>>
>> Does this conflict with:
>>
>> Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
>> Date:   Tue Apr 7 14:34:19 2020 +0800
>>
>>       selftests/ftrace: Check the first record for kprobe_args_type.tc
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next&id=f0c0d0cf590f71b2213b29a7ded2cde3d0a1a0ba
>>
>> I went into mainline yesterday in my rc4 pull request.
>>
>> Exact change it appears.
> 
> Ah, then I guess we don't need this patch ;-)
> 

I took the first one. Will wait for patch 3 to finalize.

thanks,
-- Shuah
Masami Hiramatsu (Google) May 2, 2020, 3:05 a.m. UTC | #5
On Fri, 1 May 2020 09:38:59 -0600
shuah <shuah@kernel.org> wrote:

> On 5/1/20 8:17 AM, Steven Rostedt wrote:
> > On Fri,  1 May 2020 22:37:51 +0900
> > Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > 
> >> Since the kprobe/kprobe_args_type.tc reads out all event logs
> >> from the trace buffer, the test can fail if there is another
> >> fork event happens.
> >> Use head command to pick only the first kprobe event from
> >> the trace buffer to test the argument types.
> >>
> >> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> >> ---
> >>   .../ftrace/test.d/kprobe/kprobe_args_type.tc       |    2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> >> index 1bcb67dcae26..81490ecaaa92 100644
> >> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> >> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> >> @@ -38,7 +38,7 @@ for width in 64 32 16 8; do
> >>     echo 0 > events/kprobes/testprobe/enable
> >>   
> >>     : "Confirm the arguments is recorded in given types correctly"
> >> -  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
> >> +  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
> >>     check_types $ARGS $width
> >>   
> >>     : "Clear event for next loop"
> > 
> > I think I've manually added this exact change to my tests to keep it from
> > failing.
> > 
> > Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > 
> 
> Does this conflict with:
> 
> Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
> Date:   Tue Apr 7 14:34:19 2020 +0800
> 
>      selftests/ftrace: Check the first record for kprobe_args_type.tc
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next&id=f0c0d0cf590f71b2213b29a7ded2cde3d0a1a0ba
> 
> I went into mainline yesterday in my rc4 pull request.
> 
> Exact change it appears.
> 
> diff --git 
> a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc 
> b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> index 1bcb67dcae26..81490ecaaa92 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> @@ -38,7 +38,7 @@ for width in 64 32 16 8; do
>     echo 0 > events/kprobes/testprobe/enable
> 
>     : "Confirm the arguments is recorded in given types correctly"
> -  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) 
> arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
> +  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) 
> arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
>     check_types $ARGS $width
> 
>     : "Clear event for next loop"

Oops, yes, please drop this patch.

Thank you,

> 
> thanks,
> -- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
index 1bcb67dcae26..81490ecaaa92 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
@@ -38,7 +38,7 @@  for width in 64 32 16 8; do
   echo 0 > events/kprobes/testprobe/enable
 
   : "Confirm the arguments is recorded in given types correctly"
-  ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
+  ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
   check_types $ARGS $width
 
   : "Clear event for next loop"