brintos

brintos / linux-shallow public Read only

0
0
Text · 1.4 KiB · e52e470 Raw
81 lines · plain
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03# description: Test ftrace direct functions against kprobes4# requires: kprobe_events5 6rmmod ftrace-direct ||:7if ! modprobe ftrace-direct ; then8  echo "No ftrace-direct sample module - please build with CONFIG_SAMPLE_FTRACE_DIRECT=m"9  exit_unresolved;10fi11 12echo "Let the module run a little"13sleep 114 15grep -q "my_direct_func: waking up" trace16 17rmmod ftrace-direct18 19echo 'p:kwake wake_up_process task=$arg1' > kprobe_events20 21start_direct() {22	echo > trace23	modprobe ftrace-direct24	sleep 125	grep -q "my_direct_func: waking up" trace26}27 28stop_direct() {29	rmmod ftrace-direct30}31 32enable_probe() {33	echo > trace34	echo 1 > events/kprobes/kwake/enable35	sleep 136	grep -q "kwake:" trace37}38 39disable_probe() {40	echo 0 > events/kprobes/kwake/enable41}42 43test_kprobes() {44	# probe -> direct -> no direct > no probe45	enable_probe46	start_direct47	stop_direct48	disable_probe49 50	# probe -> direct -> no probe > no direct51	enable_probe52	start_direct53	disable_probe54	stop_direct55 56	# direct -> probe -> no probe > no direct57	start_direct58	enable_probe59	disable_probe60	stop_direct61 62	# direct -> probe -> no direct > no noprobe63	start_direct64	enable_probe65	stop_direct66	disable_probe67}68 69test_kprobes70 71# Now do this with a second registered direct function72echo "Running with another ftrace direct function"73 74modprobe ftrace-direct-too75 76test_kprobes77 78rmmod ftrace-direct-too79 80echo > kprobe_events81