diff mbox series

[v4,10/10] test: ftrace: Fix kprobe test for eventfs

Message ID 1689248004-8158-11-git-send-email-akaher@vmware.com (mailing list archive)
State Superseded
Headers show
Series tracing: introducing eventfs | expand

Commit Message

Ajay Kaher July 13, 2023, 11:33 a.m. UTC
kprobe_args_char.tc, kprobe_args_string.tc has validation check
for tracefs_create_dir, for eventfs it should be eventfs_create_dir.

Signed-off-by: Ajay Kaher <akaher@vmware.com>
Co-developed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Tested-by: Ching-lin Yu <chinglinyu@google.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 .../selftests/ftrace/test.d/kprobe/kprobe_args_char.tc        | 4 ++--
 .../selftests/ftrace/test.d/kprobe/kprobe_args_string.tc      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Steven Rostedt July 14, 2023, 2:37 a.m. UTC | #1
On Thu, 13 Jul 2023 17:03:24 +0530
Ajay Kaher <akaher@vmware.com> wrote:

> kprobe_args_char.tc, kprobe_args_string.tc has validation check
> for tracefs_create_dir, for eventfs it should be eventfs_create_dir.
> 
> Signed-off-by: Ajay Kaher <akaher@vmware.com>
> Co-developed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> Tested-by: Ching-lin Yu <chinglinyu@google.com>
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

As this patch as is will break when running on older kernels, I was
wondering if we should do this instead?

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
index 285b4770efad..ff7499eb98d6 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
@@ -34,14 +34,19 @@ mips*)
 esac
 
 : "Test get argument (1)"
-echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char" > kprobe_events
+if grep -q eventfs_add_dir available_filter_functions; then
+  DIR_NAME="eventfs_add_dir"
+else
+  DIR_NAME="tracefs_create_dir"
+fi
+echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):char" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
 echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1='t'" trace
 
 echo 0 > events/kprobes/testprobe/enable
 : "Test get argument (2)"
-echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
+echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
 echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1='t' arg2={'t','e','s','t'}" trace
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
index a4f8e7c53c1f..a202b2ea4baf 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
@@ -37,14 +37,19 @@ loongarch*)
 esac
 
 : "Test get argument (1)"
-echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
+if grep -q eventfs_add_dir available_filter_functions; then
+  DIR_NAME="eventfs_add_dir"
+else
+  DIR_NAME="tracefs_create_dir"
+fi
+echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):string" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
 echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1=\"test\"" trace
 
 echo 0 > events/kprobes/testprobe/enable
 : "Test get argument (2)"
-echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
+echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
 echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace

-- Steve

> ---
>  .../selftests/ftrace/test.d/kprobe/kprobe_args_char.tc        | 4 ++--
>  .../selftests/ftrace/test.d/kprobe/kprobe_args_string.tc      | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> index 285b4770efad..523cfb64539f 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> @@ -34,14 +34,14 @@ mips*)
>  esac
>  
>  : "Test get argument (1)"
> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char" > kprobe_events
> +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):char" > kprobe_events
>  echo 1 > events/kprobes/testprobe/enable
>  echo "p:test $FUNCTION_FORK" >> kprobe_events
>  grep -qe "testprobe.* arg1='t'" trace
>  
>  echo 0 > events/kprobes/testprobe/enable
>  : "Test get argument (2)"
> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
> +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
>  echo 1 > events/kprobes/testprobe/enable
>  echo "p:test $FUNCTION_FORK" >> kprobe_events
>  grep -qe "testprobe.* arg1='t' arg2={'t','e','s','t'}" trace
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> index a4f8e7c53c1f..b9f8c3f8bae8 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> @@ -37,14 +37,14 @@ loongarch*)
>  esac
>  
>  : "Test get argument (1)"
> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
> +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):string" > kprobe_events
>  echo 1 > events/kprobes/testprobe/enable
>  echo "p:test $FUNCTION_FORK" >> kprobe_events
>  grep -qe "testprobe.* arg1=\"test\"" trace
>  
>  echo 0 > events/kprobes/testprobe/enable
>  : "Test get argument (2)"
> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
> +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
>  echo 1 > events/kprobes/testprobe/enable
>  echo "p:test $FUNCTION_FORK" >> kprobe_events
>  grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
Masami Hiramatsu (Google) July 14, 2023, 1:27 p.m. UTC | #2
On Thu, 13 Jul 2023 22:37:58 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Thu, 13 Jul 2023 17:03:24 +0530
> Ajay Kaher <akaher@vmware.com> wrote:
> 
> > kprobe_args_char.tc, kprobe_args_string.tc has validation check
> > for tracefs_create_dir, for eventfs it should be eventfs_create_dir.
> > 
> > Signed-off-by: Ajay Kaher <akaher@vmware.com>
> > Co-developed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > Tested-by: Ching-lin Yu <chinglinyu@google.com>
> > Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> As this patch as is will break when running on older kernels, I was
> wondering if we should do this instead?

+1 since the latest kselftest is used also for checking the older
stable kernels, the test case has to check the environment and
change the parameter (or make it unsupported for new feature)
So below looks good to me.

Thanks,

> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> index 285b4770efad..ff7499eb98d6 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> @@ -34,14 +34,19 @@ mips*)
>  esac
>  
>  : "Test get argument (1)"
> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char" > kprobe_events
> +if grep -q eventfs_add_dir available_filter_functions; then
> +  DIR_NAME="eventfs_add_dir"
> +else
> +  DIR_NAME="tracefs_create_dir"
> +fi
> +echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):char" > kprobe_events
>  echo 1 > events/kprobes/testprobe/enable
>  echo "p:test $FUNCTION_FORK" >> kprobe_events
>  grep -qe "testprobe.* arg1='t'" trace
>  
>  echo 0 > events/kprobes/testprobe/enable
>  : "Test get argument (2)"
> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
> +echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
>  echo 1 > events/kprobes/testprobe/enable
>  echo "p:test $FUNCTION_FORK" >> kprobe_events
>  grep -qe "testprobe.* arg1='t' arg2={'t','e','s','t'}" trace
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> index a4f8e7c53c1f..a202b2ea4baf 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> @@ -37,14 +37,19 @@ loongarch*)
>  esac
>  
>  : "Test get argument (1)"
> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
> +if grep -q eventfs_add_dir available_filter_functions; then
> +  DIR_NAME="eventfs_add_dir"
> +else
> +  DIR_NAME="tracefs_create_dir"
> +fi
> +echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):string" > kprobe_events
>  echo 1 > events/kprobes/testprobe/enable
>  echo "p:test $FUNCTION_FORK" >> kprobe_events
>  grep -qe "testprobe.* arg1=\"test\"" trace
>  
>  echo 0 > events/kprobes/testprobe/enable
>  : "Test get argument (2)"
> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
> +echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
>  echo 1 > events/kprobes/testprobe/enable
>  echo "p:test $FUNCTION_FORK" >> kprobe_events
>  grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
> 
> -- Steve
> 
> > ---
> >  .../selftests/ftrace/test.d/kprobe/kprobe_args_char.tc        | 4 ++--
> >  .../selftests/ftrace/test.d/kprobe/kprobe_args_string.tc      | 4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> > index 285b4770efad..523cfb64539f 100644
> > --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
> > @@ -34,14 +34,14 @@ mips*)
> >  esac
> >  
> >  : "Test get argument (1)"
> > -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char" > kprobe_events
> > +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):char" > kprobe_events
> >  echo 1 > events/kprobes/testprobe/enable
> >  echo "p:test $FUNCTION_FORK" >> kprobe_events
> >  grep -qe "testprobe.* arg1='t'" trace
> >  
> >  echo 0 > events/kprobes/testprobe/enable
> >  : "Test get argument (2)"
> > -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
> > +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
> >  echo 1 > events/kprobes/testprobe/enable
> >  echo "p:test $FUNCTION_FORK" >> kprobe_events
> >  grep -qe "testprobe.* arg1='t' arg2={'t','e','s','t'}" trace
> > diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> > index a4f8e7c53c1f..b9f8c3f8bae8 100644
> > --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
> > @@ -37,14 +37,14 @@ loongarch*)
> >  esac
> >  
> >  : "Test get argument (1)"
> > -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
> > +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):string" > kprobe_events
> >  echo 1 > events/kprobes/testprobe/enable
> >  echo "p:test $FUNCTION_FORK" >> kprobe_events
> >  grep -qe "testprobe.* arg1=\"test\"" trace
> >  
> >  echo 0 > events/kprobes/testprobe/enable
> >  : "Test get argument (2)"
> > -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
> > +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
> >  echo 1 > events/kprobes/testprobe/enable
> >  echo "p:test $FUNCTION_FORK" >> kprobe_events
> >  grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
>
Ajay Kaher July 17, 2023, 5:24 a.m. UTC | #3
> On 14-Jul-2023, at 6:57 PM, Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> !! External Email
> 
> On Thu, 13 Jul 2023 22:37:58 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
>> On Thu, 13 Jul 2023 17:03:24 +0530
>> Ajay Kaher <akaher@vmware.com> wrote:
>> 
>>> kprobe_args_char.tc, kprobe_args_string.tc has validation check
>>> for tracefs_create_dir, for eventfs it should be eventfs_create_dir.
>>> 
>>> Signed-off-by: Ajay Kaher <akaher@vmware.com>
>>> Co-developed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>>> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>>> Tested-by: Ching-lin Yu <chinglinyu@google.com>
>>> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>> 
>> As this patch as is will break when running on older kernels, I was
>> wondering if we should do this instead?
> 
> +1 since the latest kselftest is used also for checking the older
> stable kernels, the test case has to check the environment and
> change the parameter (or make it unsupported for new feature)
> So below looks good to me.

+1, many ftrace tests are unsupported in my setup and may few require
changes, not sure. Does any auto job takes care of this?

- Ajay

>> 
>> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
>> index 285b4770efad..ff7499eb98d6 100644
>> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
>> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
>> @@ -34,14 +34,19 @@ mips*)
>> esac
>> 
>> : "Test get argument (1)"
>> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char" > kprobe_events
>> +if grep -q eventfs_add_dir available_filter_functions; then
>> +  DIR_NAME="eventfs_add_dir"
>> +else
>> +  DIR_NAME="tracefs_create_dir"
>> +fi
>> +echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):char" > kprobe_events
>> echo 1 > events/kprobes/testprobe/enable
>> echo "p:test $FUNCTION_FORK" >> kprobe_events
>> grep -qe "testprobe.* arg1='t'" trace
>> 
>> echo 0 > events/kprobes/testprobe/enable
>> : "Test get argument (2)"
>> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
>> +echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
>> echo 1 > events/kprobes/testprobe/enable
>> echo "p:test $FUNCTION_FORK" >> kprobe_events
>> grep -qe "testprobe.* arg1='t' arg2={'t','e','s','t'}" trace
>> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
>> index a4f8e7c53c1f..a202b2ea4baf 100644
>> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
>> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
>> @@ -37,14 +37,19 @@ loongarch*)
>> esac
>> 
>> : "Test get argument (1)"
>> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
>> +if grep -q eventfs_add_dir available_filter_functions; then
>> +  DIR_NAME="eventfs_add_dir"
>> +else
>> +  DIR_NAME="tracefs_create_dir"
>> +fi
>> +echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):string" > kprobe_events
>> echo 1 > events/kprobes/testprobe/enable
>> echo "p:test $FUNCTION_FORK" >> kprobe_events
>> grep -qe "testprobe.* arg1=\"test\"" trace
>> 
>> echo 0 > events/kprobes/testprobe/enable
>> : "Test get argument (2)"
>> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
>> +echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
>> echo 1 > events/kprobes/testprobe/enable
>> echo "p:test $FUNCTION_FORK" >> kprobe_events
>> grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
>> 
>> -- Steve
>> 
>>> ---
>>> .../selftests/ftrace/test.d/kprobe/kprobe_args_char.tc        | 4 ++--
>>> .../selftests/ftrace/test.d/kprobe/kprobe_args_string.tc      | 4 ++--
>>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>> 
>>> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
>>> index 285b4770efad..523cfb64539f 100644
>>> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
>>> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
>>> @@ -34,14 +34,14 @@ mips*)
>>> esac
>>> 
>>> : "Test get argument (1)"
>>> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char" > kprobe_events
>>> +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):char" > kprobe_events
>>> echo 1 > events/kprobes/testprobe/enable
>>> echo "p:test $FUNCTION_FORK" >> kprobe_events
>>> grep -qe "testprobe.* arg1='t'" trace
>>> 
>>> echo 0 > events/kprobes/testprobe/enable
>>> : "Test get argument (2)"
>>> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
>>> +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
>>> echo 1 > events/kprobes/testprobe/enable
>>> echo "p:test $FUNCTION_FORK" >> kprobe_events
>>> grep -qe "testprobe.* arg1='t' arg2={'t','e','s','t'}" trace
>>> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
>>> index a4f8e7c53c1f..b9f8c3f8bae8 100644
>>> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
>>> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
>>> @@ -37,14 +37,14 @@ loongarch*)
>>> esac
>>> 
>>> : "Test get argument (1)"
>>> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
>>> +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):string" > kprobe_events
>>> echo 1 > events/kprobes/testprobe/enable
>>> echo "p:test $FUNCTION_FORK" >> kprobe_events
>>> grep -qe "testprobe.* arg1=\"test\"" trace
>>> 
>>> echo 0 > events/kprobes/testprobe/enable
>>> : "Test get argument (2)"
>>> -echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
>>> +echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
>>> echo 1 > events/kprobes/testprobe/enable
>>> echo "p:test $FUNCTION_FORK" >> kprobe_events
>>> grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
Steven Rostedt July 17, 2023, 12:24 p.m. UTC | #4
On Mon, 17 Jul 2023 05:24:43 +0000
Ajay Kaher <akaher@vmware.com> wrote:

> >> As this patch as is will break when running on older kernels, I was
> >> wondering if we should do this instead?  
> > 
> > +1 since the latest kselftest is used also for checking the older
> > stable kernels, the test case has to check the environment and
> > change the parameter (or make it unsupported for new feature)
> > So below looks good to me.  
> 
> +1, many ftrace tests are unsupported in my setup and may few require
> changes, not sure. Does any auto job takes care of this?

You mean like some kernel CI? Not that I know of.

Shuah, do you run these selftests on older kernels to make sure they don't
fail just because the test is unsupported?

-- Steve
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
index 285b4770efad..523cfb64539f 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc
@@ -34,14 +34,14 @@  mips*)
 esac
 
 : "Test get argument (1)"
-echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char" > kprobe_events
+echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):char" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
 echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1='t'" trace
 
 echo 0 > events/kprobes/testprobe/enable
 : "Test get argument (2)"
-echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
+echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):char arg2=+0(${ARG1}):char[4]" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
 echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1='t' arg2={'t','e','s','t'}" trace
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
index a4f8e7c53c1f..b9f8c3f8bae8 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
@@ -37,14 +37,14 @@  loongarch*)
 esac
 
 : "Test get argument (1)"
-echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
+echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):string" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
 echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1=\"test\"" trace
 
 echo 0 > events/kprobes/testprobe/enable
 : "Test get argument (2)"
-echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
+echo "p:testprobe eventfs_add_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
 echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace