tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe_module.tc

Source file repositories/reference/linux-study-clean/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe_module.tc

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe_module.tc
Extension
.tc
Size
2412 bytes
Lines
88
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

FUNC2='vfs_read'

:;: "Add an event on the test module" ;:
echo "f:test1 $FUNC1" >> dynamic_events
echo 1 > events/fprobes/test1/enable

:;: "Ensure it is enabled" ;:
funcs=`cat enabled_functions | wc -l`
test $funcs -ne 0

:;: "Check the enabled_functions is cleared on unloading" ;:
rmmod trace-events-sample
funcs=`cat enabled_functions | wc -l`
test $funcs -eq 0

:;: "Check it is kept clean" ;:
modprobe trace-events-sample
echo 1 > events/fprobes/test1/enable || echo "OK"
funcs=`cat enabled_functions | wc -l`
test $funcs -eq 0

:;: "Add another event not on the test module" ;:
echo "f:test2 $FUNC2" >> dynamic_events
echo 1 > events/fprobes/test2/enable

:;: "Ensure it is enabled" ;:
ofuncs=`cat enabled_functions | wc -l`
test $ofuncs -ne 0

:;: "Disable and remove the first event"
echo 0 > events/fprobes/test1/enable
echo "-:fprobes/test1" >> dynamic_events
funcs=`cat enabled_functions | wc -l`
test $ofuncs -eq $funcs

:;: "Disable and remove other events" ;:
echo 0 > events/fprobes/enable
echo > dynamic_events
funcs=`cat enabled_functions | wc -l`
test $funcs -eq 0

rmmod trace-events-sample

:;: "Add events on kernel and test module" ;:
modprobe trace-events-sample
echo "f:test1 $FUNC1" >> dynamic_events
echo 1 > events/fprobes/test1/enable
echo "f:test2 $FUNC2" >> dynamic_events
echo 1 > events/fprobes/test2/enable
ofuncs=`cat enabled_functions | wc -l`
test $ofuncs -ne 0

:;: "Unload module (ftrace entry should be removed)" ;:
rmmod trace-events-sample
funcs=`cat enabled_functions | wc -l`
test $funcs -ne 0
test $ofuncs -ne $funcs

:;: "Disable and remove core-kernel fprobe event" ;:
echo 0 > events/fprobes/test2/enable
echo "-:fprobes/test2" >> dynamic_events

:;: "Ensure ftrace is disabled." ;:
funcs=`cat enabled_functions | wc -l`
test $funcs -eq 0

echo 0 > events/fprobes/enable
echo > dynamic_events

trap "" EXIT

Annotation

Implementation Notes