From: Steven Rostedt <rostedt@goodmis.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Shuah Khan <shuah@kernel.org>, Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH v2] selftests: ftrace: Allow some tests to be run in a tracing instance
Date: Fri, 21 Apr 2017 23:22:28 -0400 [thread overview]
Message-ID: <20170421232228.5f51faca@gandalf.local.home> (raw)
In-Reply-To: <20170422080036.606e14853537f2933f8c09e5@kernel.org>
On Sat, 22 Apr 2017 08:00:36 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> BTW, this seems too complecated (with many similar variables).
I'm use to complicated ;-)
> I think we just need following patch, if we run the tests which
> have "instance" flag twice on top-level and an instance.
> (If you'd like to run those tests only on instance, we need
> just one more line in the main loop ;-) )
>
> -----------
> diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests
> index 52e3c4d..bdb10e6 100755
> --- a/tools/testing/selftests/ftrace/ftracetest
> +++ b/tools/testing/selftests/ftrace/ftracetest
> @@ -152,6 +152,10 @@ testcase() { # testfile
> prlog -n "[$CASENO]$desc"
> }
>
> +test_on_instance() { # testfile
> + grep "^#[ \t]*flag:.*instance" $1
> +}
> +
> eval_result() { # sigval
> case $1 in
> $PASS)
> @@ -266,6 +270,16 @@ for t in $TEST_CASES; do
> run_test $t
> done
>
> +# Test on instance loop
> +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
I have a slight modification to this. Will send soon.
-- Steve
> +
> prlog ""
> prlog "# of passed: " `echo $PASSED_CASES | wc -w`
> prlog "# of failed: " `echo $FAILED_CASES | wc -w`
> -----------
>
> Would this work for you?
>
> Thank you,
>
> > +
> > eval_result() { # sigval
> > case $1 in
> > $PASS)
> > @@ -233,18 +242,26 @@ exit_xfail () {
> > }
> > trap 'SIG_RESULT=$XFAIL' $SIG_XFAIL
> >
> > +INSTANCE_DIR="."
> > __run_test() { # testfile
> > # setup PID and PPID, $$ is not updated.
> > (cd $TRACING_DIR; read PID _ < /proc/self/stat; set -e; set -x; initialize_ftrace; . $1)
> > [ $? -ne 0 ] && kill -s $SIG_FAIL $SIG_PID
> > }
> >
> > +TEST_INSTANCES=0
> > +
> > # Run one test case
> > run_test() { # testfile
> > local testname=`basename $1`
> > local testlog=`mktemp $LOG_DIR/${testname}-log.XXXXXX`
> > export TMPDIR=`mktemp -d /tmp/ftracetest-dir.XXXXXX`
> > testcase $1
> > + local SAVE_TRACING_DIR=$TRACING_DIR
> > + if [ $TEST_INSTANCES -eq 1 ]; then
> > + TRACING_DIR=$TRACING_DIR/instances/${testname}_test_$$
> > + mkdir $TRACING_DIR
> > + fi
> > echo "execute: "$1 > $testlog
> > SIG_RESULT=0
> > if [ $VERBOSE -ge 2 ]; then
> > @@ -260,17 +277,40 @@ run_test() { # testfile
> > [ $VERBOSE -ge 1 ] && catlog $testlog
> > TOTAL_RESULT=1
> > fi
> > + if [ $TEST_INSTANCES -eq 1 ]; then
> > + rmdir $TRACING_DIR
> > + fi
> > + TRACING_DIR=$SAVE_TRACING_DIR
> > rm -rf $TMPDIR
> > }
> >
> > # load in the helper functions
> > . $TEST_DIR/functions
> >
> > +RUN_INSTANCES=0
> > +
> > # Main loop
> > for t in $TEST_CASES; do
> > + testinstance $t
> > + if [ $INSTANCE -eq 1 ]; then
> > + RUN_INSTANCES=1
> > + fi
> > run_test $t
> > done
> >
> > +TEST_INSTANCES=1
> > +
> > +if [ $RUN_INSTANCES -eq 1 ]; then
> > + echo "Running tests in a tracing instance:"
> > + for t in $TEST_CASES; do
> > + testinstance $t
> > + if [ $INSTANCE -eq 0 ]; then
> > + continue
> > + fi
> > + run_test $t
> > + done
> > +fi
> > +
> > prlog ""
> > prlog "# of passed: " `echo $PASSED_CASES | wc -w`
> > prlog "# of failed: " `echo $FAILED_CASES | wc -w`
> > --
> > 2.9.3
> >
>
>
prev parent reply other threads:[~2017-04-22 3:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 14:41 Steven Rostedt
2017-04-21 23:00 ` Masami Hiramatsu
2017-04-22 3:22 ` Steven Rostedt [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=20170421232228.5f51faca@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=namhyung@kernel.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
all inboxes | Powered by JetHome®