On Tue, Mar 18, 2025 at 11:15:18AM -0700, Song Liu wrote:
> CONFIG_KPROBES_ON_FTRACE is required for test-kprobe. Skip test-kprobe
> when CONFIG_KPROBES_ON_FTRACE is not set. Since some kernel may not have
> /proc/config.gz, grep for kprobe_ftrace_ops from /proc/kallsyms to check
> whether CONFIG_KPROBES_ON_FTRACE is enabled.
> 
> Signed-off-by: Song Liu <[email protected]>
> 
> ---
> 
> Changes v1 => v2:
> 1. Grep for kprobe_ftrace_ops in /proc/kallsyms, as some systems may not
>    have /proc/config.gz
> ---
>  tools/testing/selftests/livepatch/test-kprobe.sh | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/livepatch/test-kprobe.sh 
> b/tools/testing/selftests/livepatch/test-kprobe.sh
> index 115065156016..e514391c5454 100755
> --- a/tools/testing/selftests/livepatch/test-kprobe.sh
> +++ b/tools/testing/selftests/livepatch/test-kprobe.sh
> @@ -5,6 +5,8 @@
>  
>  . $(dirname $0)/functions.sh
>  
> +grep kprobe_ftrace_ops /proc/kallsyms || skip "test-kprobe requires 
> CONFIG_KPROBES_ON_FTRACE"
> +
>  MOD_LIVEPATCH=test_klp_livepatch
>  MOD_KPROBE=test_klp_kprobe
>  

Super minor nit (maybe Petr can tweak on merging): this grep (without
-q) will dump the resulting search lines to the terminal while all other
existing tests only show "TEST: description .... ok" lines they pass.

Acked-by: Joe Lawrence <[email protected]>

-- Joe


Reply via email to