From: Masami Hiramatsu <mhiramat@kernel.org> To: Shuah Khan <shuah@kernel.org>, Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@redhat.com>, Masami Hiramatsu <mhiramat@kernel.org>, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 19/25] selftests/ftrace: Add kprobe-event with symbol argument test Date: Fri, 27 Jul 2018 21:18:54 +0900 [thread overview] Message-ID: <153269393477.3084.13242296184705905821.stgit@devbox> (raw) In-Reply-To: <153269339575.3084.16279591141931053689.stgit@devbox> Add a testcase for kprobe-event with @symbol argument. Since @symbol needs to refer the kernel data symbol (linux_proc_banner), it requires CONFIG_KALLSYMS_ALL. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> --- tools/testing/selftests/ftrace/config | 1 + .../ftrace/test.d/kprobe/kprobe_args_symbol.tc | 39 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config index 766669592173..4c7d90aa97b2 100644 --- a/tools/testing/selftests/ftrace/config +++ b/tools/testing/selftests/ftrace/config @@ -8,3 +8,4 @@ CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_SAMPLES=y CONFIG_SAMPLE_TRACE_PRINTK=m +CONFIG_KALLSYMS_ALL=y diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc new file mode 100644 index 000000000000..2b6dd33f9076 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc @@ -0,0 +1,39 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event symbol argument + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +SYMBOL="linux_proc_banner" + +if [ ! -f /proc/kallsyms ]; then + echo "Can not check the target symbol - please enable CONFIG_KALLSYMS" + exit_unresolved +elif ! grep "$SYMBOL\$" /proc/kallsyms; then + echo "Linux banner is not exported - please enable CONFIG_KALLSYMS_ALL" + exit_unresolved +fi + +: "Test get basic types symbol argument" +echo "p:testprobe_u _do_fork arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events +echo "p:testprobe_s _do_fork arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events +if grep -q "x8/16/32/64" README; then + echo "p:testprobe_x _do_fork arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events +fi +echo "p:testprobe_bf _do_fork arg1=@linux_proc_banner:b8@4/32" >> kprobe_events +echo 1 > events/kprobes/enable +(echo "forked") +echo 0 > events/kprobes/enable +grep "testprobe_[usx]:.* arg1=.* arg2=.* arg3=.* arg4=.*" trace +grep "testprobe_bf:.* arg1=.*" trace + +: "Test get string symbol argument" +echo "p:testprobe_str _do_fork arg1=@linux_proc_banner:string" > kprobe_events +echo 1 > events/kprobes/enable +(echo "forked") +echo 0 > events/kprobes/enable +RESULT=`grep "testprobe_str" trace | sed -e 's/.* arg1=\(.*\)/\1/'` + +RESULT=`echo $RESULT | sed -e 's/.* \((.*)\) \((.*)\) .*/\1 \2/'` +ORIG=`cat /proc/version | sed -e 's/.* \((.*)\) \((.*)\) .*/\1 \2/'` +test "$RESULT" = "$ORIG"
WARNING: multiple messages have this Message-ID
From: mhiramat at kernel.org (Masami Hiramatsu) Subject: [PATCH 19/25] selftests/ftrace: Add kprobe-event with symbol argument test Date: Fri, 27 Jul 2018 21:18:54 +0900 [thread overview] Message-ID: <153269393477.3084.13242296184705905821.stgit@devbox> (raw) In-Reply-To: <153269339575.3084.16279591141931053689.stgit@devbox> Add a testcase for kprobe-event with @symbol argument. Since @symbol needs to refer the kernel data symbol (linux_proc_banner), it requires CONFIG_KALLSYMS_ALL. Signed-off-by: Masami Hiramatsu <mhiramat at kernel.org> --- tools/testing/selftests/ftrace/config | 1 + .../ftrace/test.d/kprobe/kprobe_args_symbol.tc | 39 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config index 766669592173..4c7d90aa97b2 100644 --- a/tools/testing/selftests/ftrace/config +++ b/tools/testing/selftests/ftrace/config @@ -8,3 +8,4 @@ CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_SAMPLES=y CONFIG_SAMPLE_TRACE_PRINTK=m +CONFIG_KALLSYMS_ALL=y diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc new file mode 100644 index 000000000000..2b6dd33f9076 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc @@ -0,0 +1,39 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event symbol argument + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +SYMBOL="linux_proc_banner" + +if [ ! -f /proc/kallsyms ]; then + echo "Can not check the target symbol - please enable CONFIG_KALLSYMS" + exit_unresolved +elif ! grep "$SYMBOL\$" /proc/kallsyms; then + echo "Linux banner is not exported - please enable CONFIG_KALLSYMS_ALL" + exit_unresolved +fi + +: "Test get basic types symbol argument" +echo "p:testprobe_u _do_fork arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events +echo "p:testprobe_s _do_fork arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events +if grep -q "x8/16/32/64" README; then + echo "p:testprobe_x _do_fork arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events +fi +echo "p:testprobe_bf _do_fork arg1=@linux_proc_banner:b8 at 4/32" >> kprobe_events +echo 1 > events/kprobes/enable +(echo "forked") +echo 0 > events/kprobes/enable +grep "testprobe_[usx]:.* arg1=.* arg2=.* arg3=.* arg4=.*" trace +grep "testprobe_bf:.* arg1=.*" trace + +: "Test get string symbol argument" +echo "p:testprobe_str _do_fork arg1=@linux_proc_banner:string" > kprobe_events +echo 1 > events/kprobes/enable +(echo "forked") +echo 0 > events/kprobes/enable +RESULT=`grep "testprobe_str" trace | sed -e 's/.* arg1=\(.*\)/\1/'` + +RESULT=`echo $RESULT | sed -e 's/.* \((.*)\) \((.*)\) .*/\1 \2/'` +ORIG=`cat /proc/version | sed -e 's/.* \((.*)\) \((.*)\) .*/\1 \2/'` +test "$RESULT" = "$ORIG" -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID
From: mhiramat@kernel.org (Masami Hiramatsu) Subject: [PATCH 19/25] selftests/ftrace: Add kprobe-event with symbol argument test Date: Fri, 27 Jul 2018 21:18:54 +0900 [thread overview] Message-ID: <153269393477.3084.13242296184705905821.stgit@devbox> (raw) Message-ID: <20180727121854.-H-7wanS85fjEiUH5VMDH2PKS9ZEaFz0zPds05eBQEo@z> (raw) In-Reply-To: <153269339575.3084.16279591141931053689.stgit@devbox> Add a testcase for kprobe-event with @symbol argument. Since @symbol needs to refer the kernel data symbol (linux_proc_banner), it requires CONFIG_KALLSYMS_ALL. Signed-off-by: Masami Hiramatsu <mhiramat at kernel.org> --- tools/testing/selftests/ftrace/config | 1 + .../ftrace/test.d/kprobe/kprobe_args_symbol.tc | 39 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config index 766669592173..4c7d90aa97b2 100644 --- a/tools/testing/selftests/ftrace/config +++ b/tools/testing/selftests/ftrace/config @@ -8,3 +8,4 @@ CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_SAMPLES=y CONFIG_SAMPLE_TRACE_PRINTK=m +CONFIG_KALLSYMS_ALL=y diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc new file mode 100644 index 000000000000..2b6dd33f9076 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc @@ -0,0 +1,39 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event symbol argument + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +SYMBOL="linux_proc_banner" + +if [ ! -f /proc/kallsyms ]; then + echo "Can not check the target symbol - please enable CONFIG_KALLSYMS" + exit_unresolved +elif ! grep "$SYMBOL\$" /proc/kallsyms; then + echo "Linux banner is not exported - please enable CONFIG_KALLSYMS_ALL" + exit_unresolved +fi + +: "Test get basic types symbol argument" +echo "p:testprobe_u _do_fork arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events +echo "p:testprobe_s _do_fork arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events +if grep -q "x8/16/32/64" README; then + echo "p:testprobe_x _do_fork arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events +fi +echo "p:testprobe_bf _do_fork arg1=@linux_proc_banner:b8 at 4/32" >> kprobe_events +echo 1 > events/kprobes/enable +(echo "forked") +echo 0 > events/kprobes/enable +grep "testprobe_[usx]:.* arg1=.* arg2=.* arg3=.* arg4=.*" trace +grep "testprobe_bf:.* arg1=.*" trace + +: "Test get string symbol argument" +echo "p:testprobe_str _do_fork arg1=@linux_proc_banner:string" > kprobe_events +echo 1 > events/kprobes/enable +(echo "forked") +echo 0 > events/kprobes/enable +RESULT=`grep "testprobe_str" trace | sed -e 's/.* arg1=\(.*\)/\1/'` + +RESULT=`echo $RESULT | sed -e 's/.* \((.*)\) \((.*)\) .*/\1 \2/'` +ORIG=`cat /proc/version | sed -e 's/.* \((.*)\) \((.*)\) .*/\1 \2/'` +test "$RESULT" = "$ORIG" -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-07-27 12:19 UTC|newest] Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-27 12:09 [PATCH 00/25] selftests/ftrace: Improve ftracetest with coverage check Masami Hiramatsu 2018-07-27 12:09 ` Masami Hiramatsu 2018-07-27 12:09 ` mhiramat 2018-07-27 12:10 ` [PATCH 01/25] tracing: Allow gcov profiling on only ftrace subsystem Masami Hiramatsu 2018-07-27 12:10 ` Masami Hiramatsu 2018-07-27 12:10 ` mhiramat 2018-07-27 12:10 ` [PATCH 02/25] selftests/ftrace: Add --stop-fail hidden option for debug Masami Hiramatsu 2018-07-27 12:10 ` Masami Hiramatsu 2018-07-27 12:10 ` mhiramat 2018-07-27 12:11 ` [PATCH 03/25] selftests/ftrace: Add --console hidden option Masami Hiramatsu 2018-07-27 12:11 ` Masami Hiramatsu 2018-07-27 12:11 ` mhiramat 2018-07-27 12:11 ` [PATCH 04/25] selftests/ftrace: Add case number prefix to logfile Masami Hiramatsu 2018-07-27 12:11 ` Masami Hiramatsu 2018-07-27 12:11 ` mhiramat 2018-07-27 12:12 ` [PATCH 05/25] selftests/ftrace: More initialize features in initialize_ftrace Masami Hiramatsu 2018-07-27 12:12 ` Masami Hiramatsu 2018-07-27 12:12 ` mhiramat 2018-07-27 12:12 ` [PATCH 06/25] selftests/ftrace: Cleanup ftrace after running test Masami Hiramatsu 2018-07-27 12:12 ` Masami Hiramatsu 2018-07-27 12:12 ` mhiramat 2018-07-27 12:13 ` [PATCH 07/25] selftests/ftrace: Remove unneeded per-test init/cleanup ftrace Masami Hiramatsu 2018-07-27 12:13 ` Masami Hiramatsu 2018-07-27 12:13 ` mhiramat 2018-07-27 12:13 ` [PATCH 08/25] selftests/ftrace: Fix to test kprobe $comm arg only if available Masami Hiramatsu 2018-07-27 12:13 ` Masami Hiramatsu 2018-07-27 12:13 ` mhiramat 2018-07-27 12:14 ` [PATCH 09/25] selftests/ftrace: Fix checkbashisms errors Masami Hiramatsu 2018-07-27 12:14 ` Masami Hiramatsu 2018-07-27 12:14 ` mhiramat 2018-07-27 12:14 ` [PATCH 10/25] selftests/ftrace: Use loopback address instead of localhost Masami Hiramatsu 2018-07-27 12:14 ` Masami Hiramatsu 2018-07-27 12:14 ` mhiramat 2018-07-27 12:15 ` [PATCH 11/25] selftests/ftrace: Improve kprobe on module testcase to load/unload module Masami Hiramatsu 2018-07-27 12:15 ` Masami Hiramatsu 2018-07-27 12:15 ` mhiramat 2018-08-02 1:02 ` Masami Hiramatsu 2018-08-02 1:02 ` Masami Hiramatsu 2018-08-02 1:02 ` mhiramat 2018-08-02 7:22 ` Masami Hiramatsu 2018-08-02 7:22 ` Masami Hiramatsu 2018-08-02 7:22 ` mhiramat 2018-07-27 12:15 ` [PATCH 12/25] selftests/ftrace: Improve kprobe testcase to check log data Masami Hiramatsu 2018-07-27 12:15 ` Masami Hiramatsu 2018-07-27 12:15 ` mhiramat 2018-07-27 12:16 ` [PATCH 13/25] selftests/ftrace: Improve kretprobe " Masami Hiramatsu 2018-07-27 12:16 ` Masami Hiramatsu 2018-07-27 12:16 ` mhiramat 2018-07-27 12:16 ` [PATCH 14/25] selftests/ftrace: Test kprobe-event argument with various bitsize Masami Hiramatsu 2018-07-27 12:16 ` Masami Hiramatsu 2018-07-27 12:16 ` mhiramat 2018-07-27 12:17 ` [PATCH 15/25] selftests/ftrace: Check set_event_pid result Masami Hiramatsu 2018-07-27 12:17 ` Masami Hiramatsu 2018-07-27 12:17 ` mhiramat 2018-07-27 12:17 ` [PATCH 16/25] selftests/ftrace: Add kprobe event with $comm argument testcase Masami Hiramatsu 2018-07-27 12:17 ` Masami Hiramatsu 2018-07-27 12:17 ` mhiramat 2018-07-27 12:17 ` [PATCH 17/25] selftests/ftrace: Add kprobe profile testcase Masami Hiramatsu 2018-07-27 12:17 ` Masami Hiramatsu 2018-07-27 12:17 ` mhiramat 2018-07-27 12:18 ` [PATCH 18/25] selftests/ftrace: Add a testcase for nop tracer Masami Hiramatsu 2018-07-27 12:18 ` Masami Hiramatsu 2018-07-27 12:18 ` mhiramat 2018-07-27 12:18 ` Masami Hiramatsu [this message] 2018-07-27 12:18 ` [PATCH 19/25] selftests/ftrace: Add kprobe-event with symbol argument test Masami Hiramatsu 2018-07-27 12:18 ` mhiramat 2018-07-27 12:19 ` [PATCH 20/25] selftests/ftrace: Add trace_printk sample module test Masami Hiramatsu 2018-07-27 12:19 ` Masami Hiramatsu 2018-07-27 12:19 ` mhiramat 2018-07-27 12:19 ` [PATCH 21/25] selftests/ftrace: Add ringbuffer size changing testcase Masami Hiramatsu 2018-07-27 12:19 ` Masami Hiramatsu 2018-07-27 12:19 ` mhiramat 2018-07-27 12:20 ` [PATCH 22/25] selftests/ftrace: Add function profiling stat testcase Masami Hiramatsu 2018-07-27 12:20 ` Masami Hiramatsu 2018-07-27 12:20 ` mhiramat 2018-07-27 12:20 ` [PATCH 23/25] selftests/ftrace: Add max stack tracer testcase Masami Hiramatsu 2018-07-27 12:20 ` Masami Hiramatsu 2018-07-27 12:20 ` mhiramat 2018-08-03 5:24 ` Masami Hiramatsu 2018-08-03 5:24 ` Masami Hiramatsu 2018-08-03 5:24 ` mhiramat 2018-07-27 12:21 ` [PATCH 24/25] selftests/ftrace: Add function filter on module testcase Masami Hiramatsu 2018-07-27 12:21 ` Masami Hiramatsu 2018-07-27 12:21 ` mhiramat 2018-07-27 12:21 ` [PATCH 25/25] selftests/ftrace: Add trace_pipe testcase Masami Hiramatsu 2018-07-27 12:21 ` Masami Hiramatsu 2018-07-27 12:21 ` mhiramat
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=153269393477.3084.13242296184705905821.stgit@devbox \ --to=mhiramat@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=mingo@redhat.com \ --cc=rostedt@goodmis.org \ --cc=shuah@kernel.org \ --subject='Re: [PATCH 19/25] selftests/ftrace: Add kprobe-event with symbol argument test' \ /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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.