selftests: tracing: Update inter-event testcases
Masami Hiramatsu
maintainercover 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]>
Masami Hiramatsu
maintainerPATCH 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.
--- .../inter-event/trigger-extended-error-support.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc +1 -1
@@ -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
Masami Hiramatsu
maintainerPATCH 2/2 selftests: ftrace: Add a testcase for multiple actions on trigger
In reply to Masami HiramatsuAdd 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").
--- .../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
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc new file +44 -0
@@ -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
Steven Rostedt
maintainerQuoted 6 lines · 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.
Quoted 6 lines
This series can be applied on Steven's tracing repo.
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
ftrace/coreTom, could you review it?
Even without Tom's review. I took both patches.
Thanks Masami!
-- Steve
Quoted 9 lines · Steven Rostedt
Quoted 6 lines · 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.
Quoted 9 lines
Quoted 6 lines
This series can be applied on Steven's tracing repo.
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
ftrace/coreTom, could you review it?
Even without Tom's review. I took both patches.
Oops, sorry, completely forgot about these..
For both patches:
Thanks,
Tom
Quoted 3 lines
Thanks Masami!
-- Steve