2018-04-05 09:30:10

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 0/2] selftests: tracing: Update inter-event testcases

Hi,

I've fixed a testcase for inter-event extended error
and added a testcase for multiple actions on trigger,
which is based on what Tom shown in his mail.

This series can be applied on Steven's tracing repo.

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
ftrace/core

Tom, could you review it?

Thanks,

---

Masami Hiramatsu (2):
selftests: ftrace: Fix trigger extended error testcase
selftests: ftrace: Add a testcase for multiple actions on trigger


.../inter-event/trigger-extended-error-support.tc | 2 -
.../inter-event/trigger-multi-actions-accept.tc | 44 ++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc

--
Masami Hiramatsu (Linaro) <[email protected]>


2018-04-05 09:31:37

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 1/2] selftests: ftrace: Fix trigger extended error testcase

Previous testcase redirects echo-out into /dev/null
using "&>" as below

echo "trigger-command" >> trigger &> /dev/null

But this means redirecting both stdout and stderr into
/dev/null because it is same as below

echo "trigger-command" >> trigger > /dev/null 2>&1

So ">> trigger" redirects stdout to trigger file, but
next "> /dev/null" redirects stdout to /dev/null again
and the last "2>/&1" redirects stderr to stdout (/dev/null)

This fixes it by "2> /dev/null". And also, since it
must fail, add "!" to echo command.

Fixes: f06eec4d0f2c ("selftests: ftrace: Add inter-event hist triggers testcases")
Signed-off-by: Masami Hiramatsu <[email protected]>
---
.../inter-event/trigger-extended-error-support.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
index 786dce7e48be..2aabab363cfb 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
@@ -29,7 +29,7 @@ do_reset

echo "Test extended error support"
echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
-echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger &>/dev/null
+! echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger 2> /dev/null
if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then
fail "Failed to generate extended error in histogram"
fi


2018-04-05 09:31:37

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 2/2] selftests: ftrace: Add a testcase for multiple actions on trigger

Add a testcase for multiple actions with different
parameters on an event trigger, which has been fixed
by commit 192c283e93bd ("tracing: Add action comparisons
when testing matching hist triggers").

Signed-off-by: Masami Hiramatsu <[email protected]>
---
.../inter-event/trigger-multi-actions-accept.tc | 44 ++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc

diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc
new file mode 100644
index 000000000000..c193dce611a2
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc
@@ -0,0 +1,44 @@
+#!/bin/sh
+# description: event trigger - test multiple actions on hist trigger
+
+
+do_reset() {
+ reset_trigger
+ echo > set_event
+ clear_trace
+}
+
+fail() { #msg
+ do_reset
+ echo $1
+ exit_fail
+}
+
+if [ ! -f set_event ]; then
+ echo "event tracing is not supported"
+ exit_unsupported
+fi
+
+if [ ! -f synthetic_events ]; then
+ echo "synthetic event is not supported"
+ exit_unsupported
+fi
+
+clear_synthetic_events
+reset_tracer
+do_reset
+
+echo "Test multiple actions on hist trigger"
+echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events
+TRIGGER1=events/sched/sched_wakeup/trigger
+TRIGGER2=events/sched/sched_switch/trigger
+
+echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' > $TRIGGER1
+echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0 if next_comm=="cyclictest"' >> $TRIGGER2
+echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest"' >> $TRIGGER2
+echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> $TRIGGER2
+echo 'hist:keys=next_pid if next_comm=="cyclictest"' >> $TRIGGER2
+
+do_reset
+
+exit 0


2018-04-24 19:23:57

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 0/2] selftests: tracing: Update inter-event testcases

On Thu, 5 Apr 2018 18:28:11 +0900
Masami Hiramatsu <[email protected]> wrote:

> Hi,
>
> I've fixed a testcase for inter-event extended error
> and added a testcase for multiple actions on trigger,
> which is based on what Tom shown in his mail.
>
> This series can be applied on Steven's tracing repo.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
> ftrace/core
>
> Tom, could you review it?

Even without Tom's review. I took both patches.

Thanks Masami!

-- Steve

2018-04-24 22:26:18

by Tom Zanussi

[permalink] [raw]
Subject: Re: [PATCH 0/2] selftests: tracing: Update inter-event testcases

On Tue, 2018-04-24 at 15:22 -0400, Steven Rostedt wrote:
> On Thu, 5 Apr 2018 18:28:11 +0900
> Masami Hiramatsu <[email protected]> wrote:
>
> > Hi,
> >
> > I've fixed a testcase for inter-event extended error
> > and added a testcase for multiple actions on trigger,
> > which is based on what Tom shown in his mail.
> >
> > This series can be applied on Steven's tracing repo.
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
> > ftrace/core
> >
> > Tom, could you review it?
>
> Even without Tom's review. I took both patches.
>

Oops, sorry, completely forgot about these..

For both patches:

Reviewed-by: Tom Zanussi <[email protected]>
Tested-by: Tom Zanussi <[email protected]>

Thanks,

Tom

> Thanks Masami!
>
> -- Steve