Skip to content

Commit

Permalink
selftests/ftrace: Add test case to test adding and removing of event …
Browse files Browse the repository at this point in the history
…probe

Add a test case that adds an event probe, makes sure that it works, and
then removes it.

Link: https://lore.kernel.org/linux-kselftest/[email protected]/
Link: https://lkml.kernel.org/r/[email protected]

Cc: "Tzvetomir Stoyanov" <[email protected]>
Cc: Tom Zanussi <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: [email protected]
Acked-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
  • Loading branch information
rostedt committed Aug 21, 2021
1 parent 210f9df commit 079db70
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: Generic dynamic event - add/remove eprobe events
# requires: dynamic_events events/syscalls/sys_enter_openat "e[:[<group>/]<event>] <attached-group>.<attached-event> [<args>]":README

echo 0 > events/enable

clear_dynamic_events

SYSTEM="syscalls"
EVENT="sys_enter_openat"
FIELD="filename"
EPROBE="eprobe_open"

echo "e:$EPROBE $SYSTEM/$EVENT file=+0(\$filename):ustring" >> dynamic_events

grep -q "$EPROBE" dynamic_events
test -d events/eprobes/$EPROBE

echo 1 > events/eprobes/$EPROBE/enable
ls
echo 0 > events/eprobes/$EPROBE/enable

content=`grep '^ *ls-' trace | grep 'file='`
nocontent=`grep '^ *ls-' trace | grep 'file=' | grep -v -e '"/' -e '"."'` || true

if [ -z "$content" ]; then
exit_fail
fi

if [ ! -z "$nocontent" ]; then
exit_fail
fi

echo "-:$EPROBE" >> dynamic_events

! grep -q "$EPROBE" dynamic_events
! test -d events/eprobes/$EPROBE

clear_trace

0 comments on commit 079db70

Please sign in to comment.