linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: rostedt@goodmis.org, tglx@linutronix.de, mhiramat@kernel.org,
	namhyung@kernel.org, vedang.patel@intel.com,
	bigeasy@linutronix.de, joel.opensrc@gmail.com, joelaf@google.com,
	mathieu.desnoyers@efficios.com, baohong.liu@intel.com,
	rajvi.jingar@intel.com, julia@ni.com,
	linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v4 37/37] selftests: ftrace: Add inter-event hist triggers testcases
Date: Tue, 31 Oct 2017 23:29:04 +0900	[thread overview]
Message-ID: <20171031232904.0e1bfede7c685d40fd83c36f@kernel.org> (raw)
In-Reply-To: <25a4c52df50f4af199d1c63acc5fe3675715148f.1509395596.git.tom.zanussi@linux.intel.com>

On Mon, 30 Oct 2017 15:52:19 -0500
Tom Zanussi <tom.zanussi@linux.intel.com> wrote:

> From: Rajvi Jingar <rajvi.jingar@intel.com>
> 
> This adds inter-event hist triggers testcases which covers following:
>  - create/remove synthetic event
>  - disable histogram for synthetic event
>  - extended error support
>  - field variable support
>  - histogram variables
>  - histogram trigger onmatch action
>  - histogram trigger onmax action
>  - histogram trigger onmatch-onmax action
>  - simple expression support
>  - combined histogram

Thank you for adding testcases :)
That helps me to understand how to use it.
I have some comments, see below;


[..]
> 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
> new file mode 100644
> index 0000000..41dbf4c
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
> @@ -0,0 +1,39 @@
> +#!/bin/sh
> +# description: event trigger - test extended error support
> +
> +
> +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
> +
> +reset_tracer
> +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 &&

What is the last "&&"? Would you expect that the second echo is fail?

> +if ! grep "ERROR:" events/sched/sched_wakeup/hist; then

Would you like to show the grep result? or you can use -q option for grep command.

[...]
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
> new file mode 100644
> index 0000000..c73e491
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
> @@ -0,0 +1,46 @@
> +#!/bin/sh
> +# description: event trigger - test synthetic event create remove
> +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 create synthetic event"
> +
> +echo 'wakeup_latency  u64 lat pid_t pid char comm[16]' > synthetic_events
> +if [ ! -d events/synthetic/wakeup_latency ]; then
> +    fail "Failed to create wakeup_latency synthetic event"
> +fi
> +
> +reset_trigger
> +
> +echo "Test remove synthetic event"
> +echo '!wakeup_latency  u64 lat; pid_t pid; char[16] comm' > synthetic_events

both char[16] and char comm[16] are acceptable?
But I would like to see same style in creating and removing.

> +if [ -d events/synthetic/wakeup_latency ]; then
> +    fail "Failed to delete wakeup_latency synthetic event"
> +fi

There seems no expected failure test cases. Could you add such test?
like as echoing events with invalid format etc.


<off topic>
BTW, $FAIL is not for expressing failure, it is a value
for $SIG_RESULT. But it seems many test cases use it for return code.

Note that any failure in this script treated as error and exit soon. 
Which means caller can get any return code from this script, because
the return code depends on executed command. So, any NON-ZERO code
can be treated as FAILURE code.

"exit $FAIL" is OK, but just making myself review easier, I'll
introduce exit_pass()/exit_fail().
<off topic>

Thank you,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2017-10-31 14:29 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30 20:51 [PATCH v4 00/37] tracing: Inter-event (e.g. latency) support Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 01/37] tracing: Move hist trigger Documentation to histogram.txt Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 02/37] tracing: Add Documentation for log2 modifier Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 03/37] tracing: Add support to detect and avoid duplicates Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 04/37] tracing: Remove code which merges duplicates Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 05/37] ring-buffer: Add interface for setting absolute time stamps Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 06/37] ring-buffer: Redefine the unimplemented RINGBUF_TYPE_TIME_STAMP Tom Zanussi
2017-11-06  5:09   ` Namhyung Kim
2017-11-06 15:52     ` Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 07/37] tracing: Add timestamp_mode trace file Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 08/37] tracing: Give event triggers access to ring_buffer_event Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 09/37] tracing: Add ring buffer event param to hist field functions Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 10/37] tracing: Break out hist trigger assignment parsing Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 11/37] tracing: Add hist trigger timestamp support Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 12/37] tracing: Add per-element variable support to tracing_map Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 13/37] tracing: Add hist_data member to hist_field Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 14/37] tracing: Add usecs modifier for hist trigger timestamps Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 15/37] tracing: Add variable support to hist triggers Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 16/37] tracing: Account for variables in named trigger compatibility Tom Zanussi
2017-10-30 20:51 ` [PATCH v4 17/37] tracing: Move get_hist_field_flags() Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 18/37] tracing: Add simple expression support to hist triggers Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 19/37] tracing: Generalize per-element hist trigger data Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 20/37] tracing: Pass tracing_map_elt to hist_field accessor functions Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 21/37] tracing: Add hist_field 'type' field Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 22/37] tracing: Add variable reference handling to hist triggers Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 23/37] tracing: Add hist trigger action hook Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 24/37] tracing: Add support for 'synthetic' events Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 25/37] tracing: Add support for 'field variables' Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 26/37] tracing: Add 'onmatch' hist trigger action support Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 27/37] tracing: Add 'onmax' " Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 28/37] tracing: Allow whitespace to surround hist trigger filter Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 29/37] tracing: Add cpu field for hist triggers Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 30/37] tracing: Add hist trigger support for variable reference aliases Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 31/37] tracing: Add 'last error' error facility for hist triggers Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 32/37] tracing: Add inter-event hist trigger Documentation Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 33/37] tracing: Make tracing_set_clock() non-static Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 34/37] tracing: Add a clock attribute for hist triggers Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 35/37] tracing: Increase trace_recursive_lock() limit for synthetic events Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 36/37] tracing: Add inter-event blurb to HIST_TRIGGERS config option Tom Zanussi
2017-10-30 20:52 ` [PATCH v4 37/37] selftests: ftrace: Add inter-event hist triggers testcases Tom Zanussi
2017-10-31 14:29   ` Masami Hiramatsu [this message]
2017-10-31 20:40     ` Jingar, Rajvi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171031232904.0e1bfede7c685d40fd83c36f@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=baohong.liu@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=joel.opensrc@gmail.com \
    --cc=joelaf@google.com \
    --cc=julia@ni.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=namhyung@kernel.org \
    --cc=rajvi.jingar@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tom.zanussi@linux.intel.com \
    --cc=vedang.patel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).