linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing/selftests: Update synthetic event selftest to use common_stacktrace
@ 2023-05-24  2:54 Steven Rostedt
  2023-05-25  2:24 ` Masami Hiramatsu
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2023-05-24  2:54 UTC (permalink / raw)
  To: LKML, Linux trace kernel
  Cc: Masami Hiramatsu, Tom Zanussi, Mark Rutland, Shuah Khan,
	Shuah Khan, linux-kselftest

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

With the rename of the stacktrace field to common_stacktrace, update the
selftests to reflect this change. Copy the current selftest to test the
backward compatibility "stacktrace" keyword. Also the "requires" of that
test was incorrect, so it would never actually ran before. That is fixed
now.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 .../trigger-synthetic-event-stack-legacy.tc   | 24 +++++++++++++++++++
 .../trigger-synthetic-event-stack.tc          |  5 ++--
 2 files changed, 26 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack-legacy.tc

diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack-legacy.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack-legacy.tc
new file mode 100644
index 000000000000..d0cd91a93069
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack-legacy.tc
@@ -0,0 +1,24 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: event trigger - test inter-event histogram trigger trace action with dynamic string param (legacy stack)
+# requires: set_event synthetic_events events/sched/sched_process_exec/hist "long[] stack' >> synthetic_events":README
+
+fail() { #msg
+    echo $1
+    exit_fail
+}
+
+echo "Test create synthetic event with stack"
+
+# Test the old stacktrace keyword (for backward compatibility)
+echo 's:wake_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events
+echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=stacktrace  if prev_state == 1||prev_state == 2' >> events/sched/sched_switch/trigger
+echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,s=$st:onmax($delta).trace(wake_lat,prev_pid,$delta,$s)' >> events/sched/sched_switch/trigger
+echo 1 > events/synthetic/wake_lat/enable
+sleep 1
+
+if ! grep -q "=>.*sched" trace; then
+    fail "Failed to create synthetic event with stack"
+fi
+
+exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc
index 755dbe94ccf4..8f1cc9a86a06 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 # description: event trigger - test inter-event histogram trigger trace action with dynamic string param
-# requires: set_event synthetic_events events/sched/sched_process_exec/hist "long[]' >> synthetic_events":README
+# requires: set_event synthetic_events events/sched/sched_process_exec/hist "can be any field, or the special string 'common_stacktrace'":README
 
 fail() { #msg
     echo $1
@@ -10,9 +10,8 @@ fail() { #msg
 
 echo "Test create synthetic event with stack"
 
-
 echo 's:wake_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events
-echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=stacktrace  if prev_state == 1||prev_state == 2' >> events/sched/sched_switch/trigger
+echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=common_stacktrace  if prev_state == 1||prev_state == 2' >> events/sched/sched_switch/trigger
 echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,s=$st:onmax($delta).trace(wake_lat,prev_pid,$delta,$s)' >> events/sched/sched_switch/trigger
 echo 1 > events/synthetic/wake_lat/enable
 sleep 1
-- 
2.39.2


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

* Re: [PATCH] tracing/selftests: Update synthetic event selftest to use common_stacktrace
  2023-05-24  2:54 [PATCH] tracing/selftests: Update synthetic event selftest to use common_stacktrace Steven Rostedt
@ 2023-05-25  2:24 ` Masami Hiramatsu
  2023-06-05 19:32   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2023-05-25  2:24 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Linux trace kernel, Masami Hiramatsu, Tom Zanussi,
	Mark Rutland, Shuah Khan, Shuah Khan, linux-kselftest

On Tue, 23 May 2023 22:54:29 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> With the rename of the stacktrace field to common_stacktrace, update the
> selftests to reflect this change. Copy the current selftest to test the
> backward compatibility "stacktrace" keyword. Also the "requires" of that
> test was incorrect, so it would never actually ran before. That is fixed
> now.
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Looks good to me.

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

Thanks,

> ---
>  .../trigger-synthetic-event-stack-legacy.tc   | 24 +++++++++++++++++++
>  .../trigger-synthetic-event-stack.tc          |  5 ++--
>  2 files changed, 26 insertions(+), 3 deletions(-)
>  create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack-legacy.tc
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack-legacy.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack-legacy.tc
> new file mode 100644
> index 000000000000..d0cd91a93069
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack-legacy.tc
> @@ -0,0 +1,24 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# description: event trigger - test inter-event histogram trigger trace action with dynamic string param (legacy stack)
> +# requires: set_event synthetic_events events/sched/sched_process_exec/hist "long[] stack' >> synthetic_events":README
> +
> +fail() { #msg
> +    echo $1
> +    exit_fail
> +}
> +
> +echo "Test create synthetic event with stack"
> +
> +# Test the old stacktrace keyword (for backward compatibility)
> +echo 's:wake_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events
> +echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=stacktrace  if prev_state == 1||prev_state == 2' >> events/sched/sched_switch/trigger
> +echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,s=$st:onmax($delta).trace(wake_lat,prev_pid,$delta,$s)' >> events/sched/sched_switch/trigger
> +echo 1 > events/synthetic/wake_lat/enable
> +sleep 1
> +
> +if ! grep -q "=>.*sched" trace; then
> +    fail "Failed to create synthetic event with stack"
> +fi
> +
> +exit 0
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc
> index 755dbe94ccf4..8f1cc9a86a06 100644
> --- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc
> @@ -1,7 +1,7 @@
>  #!/bin/sh
>  # SPDX-License-Identifier: GPL-2.0
>  # description: event trigger - test inter-event histogram trigger trace action with dynamic string param
> -# requires: set_event synthetic_events events/sched/sched_process_exec/hist "long[]' >> synthetic_events":README
> +# requires: set_event synthetic_events events/sched/sched_process_exec/hist "can be any field, or the special string 'common_stacktrace'":README
>  
>  fail() { #msg
>      echo $1
> @@ -10,9 +10,8 @@ fail() { #msg
>  
>  echo "Test create synthetic event with stack"
>  
> -
>  echo 's:wake_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events
> -echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=stacktrace  if prev_state == 1||prev_state == 2' >> events/sched/sched_switch/trigger
> +echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=common_stacktrace  if prev_state == 1||prev_state == 2' >> events/sched/sched_switch/trigger
>  echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,s=$st:onmax($delta).trace(wake_lat,prev_pid,$delta,$s)' >> events/sched/sched_switch/trigger
>  echo 1 > events/synthetic/wake_lat/enable
>  sleep 1
> -- 
> 2.39.2
> 


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

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

* Re: [PATCH] tracing/selftests: Update synthetic event selftest to use common_stacktrace
  2023-05-25  2:24 ` Masami Hiramatsu
@ 2023-06-05 19:32   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2023-06-05 19:32 UTC (permalink / raw)
  To: Masami Hiramatsu (Google), Steven Rostedt
  Cc: LKML, Linux trace kernel, Tom Zanussi, Mark Rutland, Shuah Khan,
	linux-kselftest, Shuah Khan

On 5/24/23 20:24, Masami Hiramatsu (Google) wrote:
> On Tue, 23 May 2023 22:54:29 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
>> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>>
>> With the rename of the stacktrace field to common_stacktrace, update the
>> selftests to reflect this change. Copy the current selftest to test the
>> backward compatibility "stacktrace" keyword. Also the "requires" of that
>> test was incorrect, so it would never actually ran before. That is fixed
>> now.
>>
>> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> 
> Looks good to me.
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 

Applied to linux-kselftest next for Linux 6.5-rc1

thanks,
-- Shuah


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

end of thread, other threads:[~2023-06-05 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-24  2:54 [PATCH] tracing/selftests: Update synthetic event selftest to use common_stacktrace Steven Rostedt
2023-05-25  2:24 ` Masami Hiramatsu
2023-06-05 19:32   ` 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).