[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20170425120804.a2ca6b80e38c91f2efd90c3a@kernel.org>
Date: Tue, 25 Apr 2017 12:08:04 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Shuah Khan <shuah@...nel.org>,
Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH v3] selftests: ftrace: Allow some tests to be run in a
tracing instance
On Mon, 24 Apr 2017 18:01:38 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Sun, 23 Apr 2017 09:02:24 +0900
> Masami Hiramatsu <mhiramat@...nel.org> wrote:
>
>
> > > >
> > > > > +}
> > > > > +
> > > > > eval_result() { # sigval
> > > > > case $1 in
> > > > > $PASS)
> > > > > @@ -271,6 +275,21 @@ for t in $TEST_CASES; do
> > > > > run_test $t
> > > > > done
> > > > >
> > > > > +# Test on instance loop
> > > > > +FIRST_INSTANCE=0
> > > > > +for t in $TEST_CASES; do
> > > > > + test_on_instance $t || continue
> > > > > + if [ $FIRST_INSTANCE -eq 0 ]; then
> > > > > + FIRST_INSTANCE=1
> > > > > + echo "Running tests in a tracing instance:"
> > > > > + fi
> > > >
> > > > Ah, I see. This is important. And I would rather like to show
> > > > it on the description line of each test so that we can check
> > > > which test log is run in an instance. E.g. passing "(instance)"
> > > > message to run_test() and testcase() as the 2nd arg, and print
> > > > it in testlog and console?
> > >
> > > OK, I'll update to v4.
>
> What about something like this:
Ah, that's much better than I thought :)
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Thank you!
>
> -- Steve
>
> diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
> index a8631d9..32e6211 100755
> --- a/tools/testing/selftests/ftrace/ftracetest
> +++ b/tools/testing/selftests/ftrace/ftracetest
> @@ -150,11 +150,16 @@ XFAILED_CASES=
> UNDEFINED_CASES=
> TOTAL_RESULT=0
>
> +INSTANCE=
> CASENO=0
> testcase() { # testfile
> CASENO=$((CASENO+1))
> desc=`grep "^#[ \t]*description:" $1 | cut -f2 -d:`
> - prlog -n "[$CASENO]$desc"
> + prlog -n "[$CASENO]$INSTANCE$desc"
> +}
> +
> +test_on_instance() { # testfile
> + grep -q "^#[ \t]*flags:.*instance" $1
> }
>
> eval_result() { # sigval
> @@ -271,6 +276,17 @@ for t in $TEST_CASES; do
> run_test $t
> done
>
> +# Test on instance loop
> +INSTANCE=" (instance) "
> +for t in $TEST_CASES; do
> + test_on_instance $t || continue
> + SAVED_TRACING_DIR=$TRACING_DIR
> + export TRACING_DIR=`mktemp -d $TRACING_DIR/instances/ftracetest.XXXXXX`
> + run_test $t
> + rmdir $TRACING_DIR
> + TRACING_DIR=$SAVED_TRACING_DIR
> +done
> +
> prlog ""
> prlog "# of passed: " `echo $PASSED_CASES | wc -w`
> prlog "# of failed: " `echo $FAILED_CASES | wc -w`
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists