diff mbox series

[v2,03/32] selftests/ftrace: Add --console hidden option

Message ID 153443703653.23257.12015337438174061938.stgit@devbox (mailing list archive)
State Superseded
Headers show
Series selftests/ftrace: Improve ftracetest with coverage check | expand

Commit Message

Masami Hiramatsu (Google) Aug. 16, 2018, 4:30 p.m. UTC
Add --console hidden option for debug test cases.
This option allows to put "sh" or something else
when the test case hits a bug.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 tools/testing/selftests/ftrace/ftracetest |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Steven Rostedt Aug. 24, 2018, 8:37 p.m. UTC | #1
On Fri, 17 Aug 2018 01:30:36 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Add --console hidden option for debug test cases.
> This option allows to put "sh" or something else
> when the test case hits a bug.

Can you add more information to why and how this would be used.

-- Steve
Masami Hiramatsu (Google) Aug. 25, 2018, 1:35 a.m. UTC | #2
On Fri, 24 Aug 2018 16:37:37 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Fri, 17 Aug 2018 01:30:36 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Add --console hidden option for debug test cases.
> > This option allows to put "sh" or something else
> > when the test case hits a bug.
> 
> Can you add more information to why and how this would be used.

For example, if you find a testcase which doesn't
pass, you can insert sh for interactive debug as below

  #!/bin/sh
  # description: sample test case

  good-command
  suspicious-wrong-command
  sh # <- add this for interactive debug


Thank you,
Steven Rostedt Aug. 25, 2018, 1:42 a.m. UTC | #3
On Sat, 25 Aug 2018 10:35:13 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> On Fri, 24 Aug 2018 16:37:37 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> > On Fri, 17 Aug 2018 01:30:36 +0900
> > Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >   
> > > Add --console hidden option for debug test cases.
> > > This option allows to put "sh" or something else
> > > when the test case hits a bug.  
> > 
> > Can you add more information to why and how this would be used.  
> 
> For example, if you find a testcase which doesn't
> pass, you can insert sh for interactive debug as below
> 
>   #!/bin/sh
>   # description: sample test case
> 
>   good-command
>   suspicious-wrong-command
>   sh # <- add this for interactive debug
> 

Ah! OK. But this needs to be explained a little better in the change
log as well as in the comments for it.

Thanks!

-- Steve
Masami Hiramatsu (Google) Aug. 26, 2018, 7:28 a.m. UTC | #4
On Fri, 24 Aug 2018 21:42:04 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Sat, 25 Aug 2018 10:35:13 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > On Fri, 24 Aug 2018 16:37:37 -0400
> > Steven Rostedt <rostedt@goodmis.org> wrote:
> > 
> > > On Fri, 17 Aug 2018 01:30:36 +0900
> > > Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > >   
> > > > Add --console hidden option for debug test cases.
> > > > This option allows to put "sh" or something else
> > > > when the test case hits a bug.  
> > > 
> > > Can you add more information to why and how this would be used.  
> > 
> > For example, if you find a testcase which doesn't
> > pass, you can insert sh for interactive debug as below
> > 
> >   #!/bin/sh
> >   # description: sample test case
> > 
> >   good-command
> >   suspicious-wrong-command
> >   sh # <- add this for interactive debug
> > 
> 
> Ah! OK. But this needs to be explained a little better in the change
> log as well as in the comments for it.

Ah sorry I missed "I will add following example"... yes, of course
I add this to description.

Thank you,

> 
> Thanks!
> 
> -- Steve
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index c9c7fa8dc440..8debd37038e4 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -60,11 +60,21 @@  parse_opts() { # opts
       shift 1
     ;;
     --verbose|-v|-vv|-vvv)
+      if [ $VERBOSE -eq -1 ]; then
+	usage "--console can not use with --verbose"
+      fi
       VERBOSE=$((VERBOSE + 1))
       [ $1 = '-vv' ] && VERBOSE=$((VERBOSE + 1))
       [ $1 = '-vvv' ] && VERBOSE=$((VERBOSE + 2))
       shift 1
     ;;
+    --console)
+      if [ $VERBOSE -ne 0 ]; then
+	usage "--console can not use with --verbose"
+      fi
+      VERBOSE=-1
+      shift 1
+    ;;
     --debug|-d)
       DEBUG=1
       shift 1
@@ -283,7 +293,9 @@  run_test() { # testfile
   testcase $1
   echo "execute$INSTANCE: "$1 > $testlog
   SIG_RESULT=0
-  if [ -z "$LOG_FILE" ]; then
+  if [ $VERBOSE -eq -1 ]; then
+    __run_test $1
+  elif [ -z "$LOG_FILE" ]; then
     __run_test $1 2>&1
   elif [ $VERBOSE -ge 3 ]; then
     __run_test $1 | tee -a $testlog 2>&1