From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756630AbcJSEys (ORCPT ); Wed, 19 Oct 2016 00:54:48 -0400 Received: from mail.kernel.org ([198.145.29.136]:42852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756474AbcJSEyU (ORCPT ); Wed, 19 Oct 2016 00:54:20 -0400 From: Masami Hiramatsu To: Steven Rostedt Cc: Masami Hiramatsu , Shuah Khan , linux-kernel@vger.kernel.org, Ingo Molnar , Namhyung Kim , Tom Zanussi , linux-kselftest@vger.kernel.org Subject: [PATCH 5/5] selftests: ftrace: Add a testcase for types of kprobe event Date: Wed, 19 Oct 2016 13:54:14 +0900 Message-Id: <147685285432.8760.9114124487704649863.stgit@devbox> X-Mailer: git-send-email 2.7.4 In-Reply-To: <147685280526.8760.8021110184607782896.stgit@devbox> References: <147685280526.8760.8021110184607782896.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../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