selftests/ftrace: Add testcases for dynamic event
Add common testcases for dynamic_events interface. - Add/remove kprobe events via dynamic_events - Add/remove synthetic events via dynamic_events - Selective clear events (clear events other interfaces) - Genelic clear events ("!LINE" syntax) Link: http://lkml.kernel.org/r/154140872590.17322.10394440849261743052.stgit@devbox Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
1ce25e9f6f
commit
dbc3f042fb
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# description: Generic dynamic event - add/remove kprobe events
|
||||
|
||||
[ -f dynamic_events ] || exit_unsupported
|
||||
|
||||
grep -q "place: \[<module>:\]<symbol>" README || exit_unsupported
|
||||
grep -q "place (kretprobe): \[<module>:\]<symbol>" README || exit_unsupported
|
||||
|
||||
echo 0 > events/enable
|
||||
echo > dynamic_events
|
||||
|
||||
PLACE=_do_fork
|
||||
|
||||
echo "p:myevent1 $PLACE" >> dynamic_events
|
||||
echo "r:myevent2 $PLACE" >> dynamic_events
|
||||
|
||||
grep -q myevent1 dynamic_events
|
||||
grep -q myevent2 dynamic_events
|
||||
test -d events/kprobes/myevent1
|
||||
test -d events/kprobes/myevent2
|
||||
|
||||
echo "-:myevent2" >> dynamic_events
|
||||
|
||||
grep -q myevent1 dynamic_events
|
||||
! grep -q myevent2 dynamic_events
|
||||
|
||||
echo > dynamic_events
|
||||
|
||||
clear_trace
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# description: Generic dynamic event - add/remove synthetic events
|
||||
|
||||
[ -f dynamic_events ] || exit_unsupported
|
||||
|
||||
grep -q "s:\[synthetic/\]" README || exit_unsupported
|
||||
|
||||
echo 0 > events/enable
|
||||
echo > dynamic_events
|
||||
|
||||
echo "s:latency1 u64 lat; pid_t pid;" >> dynamic_events
|
||||
echo "s:latency2 u64 lat; pid_t pid;" >> dynamic_events
|
||||
|
||||
grep -q latency1 dynamic_events
|
||||
grep -q latency2 dynamic_events
|
||||
test -d events/synthetic/latency1
|
||||
test -d events/synthetic/latency2
|
||||
|
||||
echo "-:synthetic/latency2" >> dynamic_events
|
||||
|
||||
grep -q latency1 dynamic_events
|
||||
! grep -q latency2 dynamic_events
|
||||
|
||||
echo > dynamic_events
|
||||
|
||||
clear_trace
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# description: Generic dynamic event - selective clear (compatibility)
|
||||
|
||||
[ -f dynamic_events ] || exit_unsupported
|
||||
|
||||
grep -q "place: \[<module>:\]<symbol>" README || exit_unsupported
|
||||
grep -q "place (kretprobe): \[<module>:\]<symbol>" README || exit_unsupported
|
||||
|
||||
grep -q "s:\[synthetic/\]" README || exit_unsupported
|
||||
|
||||
[ -f synthetic_events ] || exit_unsupported
|
||||
[ -f kprobe_events ] || exit_unsupported
|
||||
|
||||
echo 0 > events/enable
|
||||
echo > dynamic_events
|
||||
|
||||
PLACE=_do_fork
|
||||
|
||||
setup_events() {
|
||||
echo "p:myevent1 $PLACE" >> dynamic_events
|
||||
echo "s:latency1 u64 lat; pid_t pid;" >> dynamic_events
|
||||
echo "r:myevent2 $PLACE" >> dynamic_events
|
||||
echo "s:latency2 u64 lat; pid_t pid;" >> dynamic_events
|
||||
|
||||
grep -q myevent1 dynamic_events
|
||||
grep -q myevent2 dynamic_events
|
||||
grep -q latency1 dynamic_events
|
||||
grep -q latency2 dynamic_events
|
||||
}
|
||||
|
||||
setup_events
|
||||
echo > synthetic_events
|
||||
|
||||
grep -q myevent1 dynamic_events
|
||||
grep -q myevent2 dynamic_events
|
||||
! grep -q latency1 dynamic_events
|
||||
! grep -q latency2 dynamic_events
|
||||
|
||||
echo > dynamic_events
|
||||
|
||||
setup_events
|
||||
echo > kprobe_events
|
||||
|
||||
! grep -q myevent1 dynamic_events
|
||||
! grep -q myevent2 dynamic_events
|
||||
grep -q latency1 dynamic_events
|
||||
grep -q latency2 dynamic_events
|
||||
|
||||
echo > dynamic_events
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# description: Generic dynamic event - generic clear event
|
||||
|
||||
[ -f dynamic_events ] || exit_unsupported
|
||||
|
||||
grep -q "place: \[<module>:\]<symbol>" README || exit_unsupported
|
||||
grep -q "place (kretprobe): \[<module>:\]<symbol>" README || exit_unsupported
|
||||
|
||||
grep -q "s:\[synthetic/\]" README || exit_unsupported
|
||||
|
||||
echo 0 > events/enable
|
||||
echo > dynamic_events
|
||||
|
||||
PLACE=_do_fork
|
||||
|
||||
setup_events() {
|
||||
echo "p:myevent1 $PLACE" >> dynamic_events
|
||||
echo "s:latency1 u64 lat; pid_t pid;" >> dynamic_events
|
||||
echo "r:myevent2 $PLACE" >> dynamic_events
|
||||
echo "s:latency2 u64 lat; pid_t pid;" >> dynamic_events
|
||||
|
||||
grep -q myevent1 dynamic_events
|
||||
grep -q myevent2 dynamic_events
|
||||
grep -q latency1 dynamic_events
|
||||
grep -q latency2 dynamic_events
|
||||
}
|
||||
|
||||
setup_events
|
||||
|
||||
echo "!p:myevent1 $PLACE" >> dynamic_events
|
||||
! grep -q myevent1 dynamic_events
|
||||
grep -q myevent2 dynamic_events
|
||||
grep -q latency1 dynamic_events
|
||||
grep -q latency2 dynamic_events
|
||||
|
||||
echo "!s:latency1 u64 lat; pid_t pid;" >> dynamic_events
|
||||
grep -q myevent2 dynamic_events
|
||||
! grep -q latency1 dynamic_events
|
||||
grep -q latency2 dynamic_events
|
||||
|
||||
echo "!r:myevent2 $PLACE" >> dynamic_events
|
||||
! grep -q myevent2 dynamic_events
|
||||
grep -q latency2 dynamic_events
|
||||
|
||||
echo "!s:latency2 u64 lat; pid_t pid;" >> dynamic_events
|
||||
! grep -q latency2 dynamic_events
|
||||
|
||||
echo > dynamic_events
|
Loading…
Reference in New Issue