From: Seth Forshee <seth.forshee@canonical.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>, Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/ftrace: Use printf instead of echo in kprobe syntax error tests
Date: Wed, 4 Mar 2020 15:49:37 -0600 [thread overview]
Message-ID: <20200304214937.GA2347@ubuntu-x1> (raw)
In-Reply-To: <20200304155004.7dd033a3@gandalf.local.home>
On Wed, Mar 04, 2020 at 03:50:04PM -0500, Steven Rostedt wrote:
> On Wed, 4 Mar 2020 10:14:35 -0600
> Seth Forshee <seth.forshee@canonical.com> wrote:
>
> > --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
> > @@ -37,7 +37,7 @@ fi
> >
> > check_error 'p vfs_read ^$none_var' # BAD_VAR
> >
> > -check_error 'p vfs_read ^%none_reg' # BAD_REG_NAME
> > +check_error 'p vfs_read ^%%none_reg' # BAD_REG_NAME
> > check_error 'p vfs_read ^@12345678abcde' # BAD_MEM_ADDR
> > check_error 'p vfs_read ^@+10' # FILE_ON_KPROBE
> >
> > @@ -80,7 +80,7 @@ check_error 'p vfs_read arg1=^' # NO_ARG_BODY
> > # instruction boundary check is valid on x86 (at this moment)
> > case $(uname -m) in
> > x86_64|i[3456]86)
> > - echo 'p vfs_read' > kprobe_events
> > + printf 'p vfs_read' > kprobe_events
> > if grep -q FTRACE ../kprobes/list ; then
> > check_error 'p ^vfs_read+3' # BAD_INSN_BNDRY (only if function-tracer is enabled)
> > fi
> > @@ -89,13 +89,13 @@ esac
> >
> > # multiprobe errors
> > if grep -q "Create/append/" README && grep -q "imm-value" README; then
> > -echo 'p:kprobes/testevent _do_fork' > kprobe_events
> > +printf 'p:kprobes/testevent _do_fork' > kprobe_events
> > check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE
> > -echo 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events
> > -check_error 'p:kprobes/testevent _do_fork ^bcd=\1' # DIFF_ARG_TYPE
> > -check_error 'p:kprobes/testevent _do_fork ^abcd=\1:u8' # DIFF_ARG_TYPE
> > -check_error 'p:kprobes/testevent _do_fork ^abcd=\"foo"' # DIFF_ARG_TYPE
> > -check_error '^p:kprobes/testevent _do_fork abcd=\1' # SAME_PROBE
> > +printf 'p:kprobes/testevent _do_fork abcd=\\1' > kprobe_events
> > +check_error 'p:kprobes/testevent _do_fork ^bcd=\\1' # DIFF_ARG_TYPE
> > +check_error 'p:kprobes/testevent _do_fork ^abcd=\\1:u8' # DIFF_ARG_TYPE
> > +check_error 'p:kprobes/testevent _do_fork ^abcd=\\"foo"'# DIFF_ARG_TYPE
> > +check_error '^p:kprobes/testevent _do_fork abcd=\\1' # SAME_PROBE
> > fi
> >
> > exit 0
>
>
> This change causes my tests to fail:
>
> ++ echo 'Test command: p vfs_read arg1="abcd'
> Test command: p vfs_read arg1="abcd
> ++ echo
> ++ grep 'trace_kprobe: error:' -A 3 error_log
> [61913.240093] trace_kprobe: error: Invalid fetch argument
> Command: p vfs_read arg1="abcd
> ^
> +++ tail -n 1 error_log
> +++ wc -c
> ++ N=29
> +++ expr 13 + 21
> ++ test 34 -eq 29
Ah, I did miss a couple of backslashes that need to be escaped there.
The test passes for me without it though, so mabye printf behavior is
less consistent than I thought.
I'll send a v2, hopefully it will work better for you.
Seth
prev parent reply other threads:[~2020-03-04 21:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-04 16:14 [PATCH] selftests/ftrace: Use printf instead of echo in kprobe syntax error tests Seth Forshee
2020-03-04 20:50 ` Steven Rostedt
2020-03-04 21:49 ` Seth Forshee [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=20200304214937.GA2347@ubuntu-x1 \
--to=seth.forshee@canonical.com \
--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