public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>, Shuah Khan <shuahkhan@gmail.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Tom Zanussi <tom.zanussi@linux.intel.com>,
	linux-kselftest@vger.kernel.org
Subject: [PATCH -tip v3 9/9] selftests: ftrace: Add a testcase for types of kprobe event
Date: Wed, 16 Nov 2016 17:14:50 +0900	[thread overview]
Message-ID: <147928409063.22982.3499119203875115458.stgit@devbox> (raw)
In-Reply-To: <147928393441.22982.15432364313721641355.stgit@devbox>

Add a testcase for types of kprobe event. This checks
kprobe event can accept and correctly expressed the
arguments typed as s32, u32, x32 and bitfield.

Here is the test result.
  -----
  # ./ftracetest test.d/kprobe/kprobe_args_type.tc
  === Ftrace unit tests ===
  [1] Kprobes event arguments with types	[PASS]

  # of passed:  1
  # of failed:  0
  # of unresolved:  0
  # of untested:  0
  # of unsupported:  0
  # of xfailed:  0
  # of undefined(test bug):  0
  -----

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 .../ftrace/test.d/kprobe/kprobe_args_type.tc       |   37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
new file mode 100644
index 0000000..0a78705
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
@@ -0,0 +1,37 @@
+#!/bin/sh
+# description: Kprobes event arguments with types
+
+[ -f kprobe_events ] || exit_unsupported # this is configurable
+
+grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
+
+echo 0 > events/enable
+echo > kprobe_events
+enable_tracing
+
+echo 'p:testprobe _do_fork $stack0:s32 $stack0:u32 $stack0:x32 $stack0:b8@4/32' > kprobe_events
+grep testprobe kprobe_events
+test -d events/kprobes/testprobe
+
+echo 1 > events/kprobes/testprobe/enable
+( echo "forked")
+echo 0 > events/kprobes/testprobe/enable
+ARGS=`tail -n 1 trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
+
+check_types() {
+  X1=`printf "%x" $1 | tail -c 8`
+  X2=`printf "%x" $2`
+  X3=`printf "%x" $3`
+  test $X1 = $X2
+  test $X2 = $X3
+  test 0x$X3 = $3
+
+  B4=`printf "%x" $4`
+  B3=`echo -n $X3 | tail -c 3 | head -c 2`
+  test $B3 = $B4
+}
+check_types $ARGS
+
+echo "-:testprobe" >> kprobe_events
+clear_trace
+test -d events/kprobes/testprobe && exit 1 || exit 0

      parent reply	other threads:[~2016-11-16  8:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16  8:12 [PATCH -tip v3 0/9] ftrace: selftests: Add full glob matching and update ftracetest Masami Hiramatsu
2016-11-16  8:12 ` [PATCH -tip v3 1/9] ftrace: Support full glob matching Masami Hiramatsu
2016-11-16 11:17   ` Masami Hiramatsu
2016-11-16  8:13 ` [PATCH -tip v3 2/9] selftests: ftrace: Initialize ftrace before each test Masami Hiramatsu
2016-11-16  8:13 ` [PATCH -tip v3 3/9] selftests: ftrace: Add --quiet option not to show error logs on screen Masami Hiramatsu
2016-11-22 19:44   ` Steven Rostedt
2016-11-25  0:04     ` Masami Hiramatsu
2016-11-16  8:13 ` [PATCH -tip v3 4/9] selftests: ftrace: Check whether snapshot trigger is supported correctly Masami Hiramatsu
2016-11-16  8:13 ` [PATCH -tip v3 5/9] selftests: ftrace: Fix trigger-mod to run without syscall trace Masami Hiramatsu
2016-11-16  8:14 ` [PATCH -tip v3 6/9] selftests: ftrace: Hide ftracetest logs from git Masami Hiramatsu
2016-11-16  8:14 ` [PATCH -tip v3 7/9] selftests: ftrace: Introduce TMPDIR for temporary files Masami Hiramatsu
2016-11-16  8:14 ` [PATCH -tip v3 8/9] selftests: ftrace: Add a testcase for function filter glob match Masami Hiramatsu
2016-11-16  8:14 ` Masami Hiramatsu [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=147928409063.22982.3499119203875115458.stgit@devbox \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=shuahkhan@gmail.com \
    --cc=tom.zanussi@linux.intel.com \
    /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