linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Shuah Khan <shuah@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH v2 32/32] selftests/ftrace: Add blktrace testcase
Date: Thu, 30 Aug 2018 16:53:01 +0900	[thread overview]
Message-ID: <20180830165301.b6a66909351610e4a8f53e15@kernel.org> (raw)
In-Reply-To: <20180824222219.1d8aae6f@vmware.local.home>

On Fri, 24 Aug 2018 22:22:19 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Fri, 17 Aug 2018 01:44:18 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Add a basic testcase for blktrace. For making it portable,
> > this test uses a loop device.
> 
> blktrace is a bit special, as it's maintained by the block subsystem
> and not really truly part of ftrace. It lives in the tracing directory,
> but the changes go through Jens's tree. I'm guessing that Jens already
> has tests for this. Not sure we should add a test to the ftrace
> selftests for this tracer.

I see. But as far as it is in the ftrace, and can easily wake it up
from tracefs interface, I think we can have a basic testcase in
ftracetest, just for keeping it doesn't break anything.

> 
> Jens, you have thoughts on this?

Jens, ping?

Thank you,

> 
> -- Steve
> 
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  tools/testing/selftests/ftrace/config              |    1 
> >  .../testing/selftests/ftrace/test.d/tracer/blk.tc  |   91 ++++++++++++++++++++
> >  2 files changed, 92 insertions(+)
> >  create mode 100644 tools/testing/selftests/ftrace/test.d/tracer/blk.tc
> > 
> > diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config
> > index c2c8de4fafff..d999032442e1 100644
> > --- a/tools/testing/selftests/ftrace/config
> > +++ b/tools/testing/selftests/ftrace/config
> > @@ -5,6 +5,7 @@ CONFIG_TRACER_SNAPSHOT=y
> >  CONFIG_STACK_TRACER=y
> >  CONFIG_HIST_TRIGGERS=y
> >  CONFIG_SCHED_TRACER=y
> > +CONFIG_BLK_DEV_IO_TRACE=y
> >  CONFIG_PREEMPT_TRACER=y
> >  CONFIG_IRQSOFF_TRACER=y
> >  CONFIG_PREEMPTIRQ_DELAY_TEST=m
> > diff --git a/tools/testing/selftests/ftrace/test.d/tracer/blk.tc b/tools/testing/selftests/ftrace/test.d/tracer/blk.tc
> > new file mode 100644
> > index 000000000000..9d6e72810c8a
> > --- /dev/null
> > +++ b/tools/testing/selftests/ftrace/test.d/tracer/blk.tc
> > @@ -0,0 +1,91 @@
> > +#!/bin/sh
> > +# SPDX-License-Identifier: GPL2.0
> > +# description: Test blktrace
> > +
> > +IMG=$TMPDIR/fs.img
> > +MNTDIR=$TMPDIR/mnt
> > +
> > +if ! grep -wq "blk" available_tracers ; then
> > +  echo "blktrace is not supported"
> > +  exit_unsupported
> > +fi
> > +
> > +available_fs() { #fstype
> > +  grep -q $1 /proc/filesystems && which mkfs.$1
> > +}
> > +
> > +if available_fs ext3; then
> > +  FSTYPE=ext3
> > +elif available_fs ext4; then
> > +  FSTYPE=ext4
> > +elif available_fs ext2; then
> > +  FSTYPE=ext2
> > +elif available_fs xfs; then
> > +  FSTYPE=xfs
> > +elif available_fs btrfs; then
> > +  FSTYPE=btrfs
> > +else
> > +  echo "No available block-based filesystems"
> > +  exit_unresolved
> > +fi
> > +
> > +if ! which losetup; then
> > +  echo "No losetup found"
> > +  exit_unresolved
> > +fi
> > +LODEV=`losetup -f`
> > +LODEVTRACE=/sys/block/`basename $LODEV`/trace
> > +
> > +do_cleanup() {
> > +  if [ -d $MNTDIR ]; then
> > +   umount $MNTDIR ||:
> > +  fi
> > +  losetup -d $LODEV ||:
> > +  rm -f $IMG
> > +}
> > +
> > +# workload failure is not a tracer's failure
> > +workload_fail() {
> > +  do_cleanup
> > +  echo "Failed to run workload"
> > +  exit_unresolved
> > +}
> > +
> > +do_fail() {
> > +  do_cleanup
> > +  echo "Test failed"
> > +  exit 1
> > +}
> > +
> > +enable_lodevtrace() {
> > +  if [ `cat $LODEVTRACE/enable` -ne 1 ]; then
> > +    echo 1 > $LODEVTRACE/enable
> > +  fi
> > +}
> > +
> > +echo blk > current_tracer
> > +
> > +dd if=/dev/zero of=$IMG bs=1M count=10 &&\
> > +losetup $LODEV $IMG &&\
> > +mkfs.$FSTYPE $LODEV &&\
> > +mkdir -p $MNTDIR &&\
> > +mount -t $FSTYPE $LODEV $MNTDIR &&\
> > +enable_lodevtrace &&\
> > +dd if=/dev/urandom of=$MNTDIR/testfile bs=1M count=1 &&\
> > +sync &&\
> > +umount $MNTDIR || workload_fail
> > +
> > +grep -q "[dd]" trace || do_fail
> > +grep -q "[umount]" trace || do_fail
> > +echo > trace
> > +
> > +losetup $LODEV $IMG &&\
> > +mount -t $FSTYPE $LODEV $MNTDIR &&\
> > +cat $MNTDIR/testfile > /dev/null &&\
> > +echo 0 > $LODEVTRACE/enable &&\
> > +umount $MNTDIR || workload_fail
> > +
> > +grep -q "[cat]" trace || do_fail
> > +grep -q "[mount]" trace || do_fail
> > +
> > +do_cleanup
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

      reply	other threads:[~2018-08-30  7:53 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16 16:29 [PATCH v2 00/32] selftests/ftrace: Improve ftracetest with coverage check Masami Hiramatsu
2018-08-16 16:29 ` [PATCH v2 01/32] tracing: Allow gcov profiling on only ftrace subsystem Masami Hiramatsu
2018-08-20 15:32   ` Steven Rostedt
2018-08-20 15:33     ` Steven Rostedt
2018-08-21  6:53       ` Masami Hiramatsu
2018-08-21  7:27       ` [PATCH v2.1] " Masami Hiramatsu
2018-08-21 13:12         ` Steven Rostedt
2018-08-16 16:30 ` [PATCH v2 02/32] selftests/ftrace: Add --stop-fail hidden option for debug Masami Hiramatsu
2018-08-24 20:38   ` Steven Rostedt
2018-08-16 16:30 ` [PATCH v2 03/32] selftests/ftrace: Add --console hidden option Masami Hiramatsu
2018-08-24 20:37   ` Steven Rostedt
2018-08-25  1:35     ` Masami Hiramatsu
2018-08-25  1:42       ` Steven Rostedt
2018-08-26  7:28         ` Masami Hiramatsu
2018-08-16 16:31 ` [PATCH v2 04/32] selftests/ftrace: Add case number prefix to logfile Masami Hiramatsu
2018-08-24 21:47   ` Steven Rostedt
2018-08-16 16:31 ` [PATCH v2 05/32] selftests/ftrace: More initialize features in initialize_ftrace Masami Hiramatsu
2018-08-24 21:24   ` Steven Rostedt
2018-08-24 21:46   ` Steven Rostedt
2018-08-24 21:46     ` Steven Rostedt
2018-08-16 16:32 ` [PATCH v2 06/32] selftests/ftrace: Add SPDX License Identifier to template Masami Hiramatsu
2018-08-16 16:32 ` [PATCH v2 07/32] selftests/ftrace: Cleanup ftrace after running test Masami Hiramatsu
2018-08-16 16:32 ` [PATCH v2 08/32] selftests/ftrace: Remove unneeded per-test init/cleanup ftrace Masami Hiramatsu
2018-08-16 16:33 ` [PATCH v2 09/32] selftests/ftrace: Fix to test kprobe $comm arg only if available Masami Hiramatsu
2018-08-16 16:33 ` [PATCH v2 10/32] selftests/ftrace: Fix checkbashisms errors Masami Hiramatsu
2018-08-24 21:50   ` Steven Rostedt
2018-08-16 16:34 ` [PATCH v2 11/32] selftests/ftrace: Use loopback address instead of localhost Masami Hiramatsu
2018-08-24 21:52   ` Steven Rostedt
2018-08-25  1:47     ` Masami Hiramatsu
2018-08-16 16:34 ` [PATCH v2 12/32] selftests/ftrace: Improve kprobe on module testcase to load/unload module Masami Hiramatsu
2018-08-24 23:07   ` Steven Rostedt
2018-08-16 16:35 ` [PATCH v2 13/32] selftests/ftrace: Improve kprobe testcase to check log data Masami Hiramatsu
2018-08-16 16:35 ` [PATCH v2 14/32] selftests/ftrace: Improve kretprobe " Masami Hiramatsu
2018-08-16 16:36 ` [PATCH v2 15/32] selftests/ftrace: Test kprobe-event argument with various bitsize Masami Hiramatsu
2018-08-16 16:36 ` [PATCH v2 16/32] selftests/ftrace: Check set_event_pid result Masami Hiramatsu
2018-08-16 16:37 ` [PATCH v2 17/32] selftests/ftrace: Add kprobe event with $comm argument testcase Masami Hiramatsu
2018-08-16 16:37 ` [PATCH v2 18/32] selftests/ftrace: Add kprobe profile testcase Masami Hiramatsu
2018-08-16 16:38 ` [PATCH v2 19/32] selftests/ftrace: Add a testcase for nop tracer Masami Hiramatsu
2018-08-24 22:53   ` Steven Rostedt
2018-08-26  7:30     ` Masami Hiramatsu
2018-08-16 16:38 ` [PATCH v2 20/32] selftests/ftrace: Add kprobe-event with symbol argument test Masami Hiramatsu
2018-08-16 16:39 ` [PATCH v2 21/32] selftests/ftrace: Add trace_printk sample module test Masami Hiramatsu
2018-08-24 23:06   ` Steven Rostedt
2018-08-26  8:43     ` Masami Hiramatsu
2018-08-16 16:39 ` [PATCH v2 22/32] selftests/ftrace: Add ringbuffer size changing testcase Masami Hiramatsu
2018-08-24 23:18   ` Steven Rostedt
2018-08-30  7:12     ` Masami Hiramatsu
2018-08-30 15:50       ` Steven Rostedt
2018-08-30 23:35         ` Masami Hiramatsu
2018-08-30 23:40           ` Steven Rostedt
2018-08-16 16:40 ` [PATCH v2 23/32] selftests/ftrace: Add function profiling stat testcase Masami Hiramatsu
2018-08-24 23:20   ` Steven Rostedt
2018-08-26 11:20     ` Masami Hiramatsu
2018-08-16 16:40 ` [PATCH v2 24/32] selftests/ftrace: Add max stack tracer testcase Masami Hiramatsu
2018-08-24 23:23   ` Steven Rostedt
2018-08-25  1:45     ` Masami Hiramatsu
2018-08-25  2:41       ` Steven Rostedt
2018-08-26  8:42         ` Masami Hiramatsu
2018-08-16 16:40 ` [PATCH v2 25/32] selftests/ftrace: Add function filter on module testcase Masami Hiramatsu
2018-08-24 23:25   ` Steven Rostedt
2018-08-16 16:41 ` [PATCH v2 26/32] selftests/ftrace: Add trace_pipe testcase Masami Hiramatsu
2018-08-24 23:26   ` Steven Rostedt
2018-08-26 11:20     ` Masami Hiramatsu
2018-08-16 16:41 ` [PATCH v2 27/32] selftests/ftrace: Add stacktrace ftrace filter command testcase Masami Hiramatsu
2018-08-24 23:28   ` Steven Rostedt
2018-08-16 16:42 ` [PATCH v2 28/32] selftests/ftrace: Add wakeup tracer testcase Masami Hiramatsu
2018-08-16 16:42 ` [PATCH v2 29/32] selftests/ftrace: Add wakeup_rt " Masami Hiramatsu
2018-08-25  2:09   ` Steven Rostedt
2018-08-26 11:22     ` Masami Hiramatsu
2018-08-16 16:43 ` [PATCH v2 30/32] selftests/ftrace: Add ftrace cpumask testcase Masami Hiramatsu
2018-08-25  2:18   ` Steven Rostedt
2018-08-27 12:16     ` Masami Hiramatsu
2018-08-16 16:43 ` [PATCH v2 31/32] selftests/ftrace: Add output format testcase Masami Hiramatsu
2018-08-25  2:19   ` Steven Rostedt
2018-08-30  7:48     ` Masami Hiramatsu
2018-08-16 16:44 ` [PATCH v2 32/32] selftests/ftrace: Add blktrace testcase Masami Hiramatsu
2018-08-25  2:22   ` Steven Rostedt
2018-08-30  7:53     ` Masami Hiramatsu [this message]

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=20180830165301.b6a66909351610e4a8f53e15@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    /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).