lkml.org 
[lkml]   [2018]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 13/14] tracing/selftest: Add selftests to test trace_marker histogram triggers
On Mon, 28 May 2018 21:20:55 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon, 28 May 2018 01:32:58 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > Hi Steve,
> >
> > On Fri, 25 May 2018 17:13:53 -0400
> > Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > > On Fri, 25 May 2018 17:12:29 -0400
> > > Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > >
> > > > #!/bin/sh
> > >
> > > Hmm, I think I need to make this #!/bin/bash
> > >
> > > > test_trace() {
> > > > file=$1
> > > > x=$2
> > > >
> > > > cat $file | while read line; do
> > > > if [ "$line" != "${line/\#/}" ]; then
> > > > continue
> > > > fi
> > > > echo "testing $line for >$x<"
> > > > if [ "$line" == "${line/>$x</}" ]; then
> > >
> > > The ${line/>$x</} is unique to bash I believe.
> >
> > Hmm, could you try to use only posix-shell based test ?
> > Since I would like to keep this can run on small
> > environment, like busybox, etc.
> >
>
> Like something like this?

This looks good to me. :)

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thanks,

>
> -- Steve
>
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc
> index c6c50a2..3a3c33d 100644
> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc
> @@ -41,11 +41,13 @@ test_trace() {
> x=$2
>
> cat $file | while read line; do
> - if [ "$line" != "${line/\#/}" ]; then
> + comment=`echo $line | sed -e 's/^#//'`
> + if [ "$line" != "$comment" ]; then
> continue
> fi
> echo "testing $line for >$x<"
> - if [ "$line" == "${line/>$x</}" ]; then
> + match=`echo $line | sed -e "s/>$x<//"`
> + if [ "$line" == "$match" ]; then
> fail "$line does not have >$x< in it"
> fi
> let x=$x+2


--
Masami Hiramatsu <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2018-05-31 01:10    [W:0.071 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site