xref: /openbmc/linux/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc (revision 6c71a0574249f5e5a45fe055ab5f837023d5eeca)
1297e1dcdSSteven Rostedt (VMware)#!/bin/sh
2297e1dcdSSteven Rostedt (VMware)# SPDX-License-Identifier: GPL-2.0
3297e1dcdSSteven Rostedt (VMware)# description: Generic dynamic event - check if duplicate events are caught
4*dff9b223SMasami Hiramatsu (Google)# requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README events/syscalls/sys_enter_openat
5297e1dcdSSteven Rostedt (VMware)
6297e1dcdSSteven Rostedt (VMware)echo 0 > events/enable
7297e1dcdSSteven Rostedt (VMware)
8297e1dcdSSteven Rostedt (VMware)HAVE_KPROBES=0
9297e1dcdSSteven Rostedt (VMware)
10297e1dcdSSteven Rostedt (VMware)if [ -f kprobe_events ]; then
11297e1dcdSSteven Rostedt (VMware)	HAVE_KPROBES=1
12297e1dcdSSteven Rostedt (VMware)fi
13297e1dcdSSteven Rostedt (VMware)
14297e1dcdSSteven Rostedt (VMware)clear_dynamic_events
15297e1dcdSSteven Rostedt (VMware)
16297e1dcdSSteven Rostedt (VMware)# first create dynamic events for eprobes and kprobes.
17297e1dcdSSteven Rostedt (VMware)
18297e1dcdSSteven Rostedt (VMware)echo 'e:egroup/eevent syscalls/sys_enter_openat file=+0($filename):ustring' >> dynamic_events
19297e1dcdSSteven Rostedt (VMware)
20297e1dcdSSteven Rostedt (VMware)# Test eprobe for same eprobe, existing kprobe and existing event
21297e1dcdSSteven Rostedt (VMware)! echo 'e:egroup/eevent syscalls/sys_enter_openat file=+0($filename):ustring' >> dynamic_events
22297e1dcdSSteven Rostedt (VMware)! echo 'e:syscalls/sys_enter_open syscalls/sys_enter_openat file=+0($filename):ustring' >> dynamic_events
23297e1dcdSSteven Rostedt (VMware)
24297e1dcdSSteven Rostedt (VMware)if [ $HAVE_KPROBES -eq 1 ]; then
25297e1dcdSSteven Rostedt (VMware)    echo 'p:kgroup/kevent vfs_open file=+0($arg2)' >> dynamic_events
26297e1dcdSSteven Rostedt (VMware)    ! echo 'e:kgroup/kevent syscalls/sys_enter_openat file=+0($filename):ustring' >> dynamic_events
27297e1dcdSSteven Rostedt (VMware)
28297e1dcdSSteven Rostedt (VMware)# Test kprobe for same kprobe, existing eprobe and existing event
29297e1dcdSSteven Rostedt (VMware)    ! echo 'p:kgroup/kevent vfs_open file=+0($arg2)' >> dynamic_events
30297e1dcdSSteven Rostedt (VMware)    ! echo 'p:egroup/eevent vfs_open file=+0($arg2)' >> dynamic_events
31297e1dcdSSteven Rostedt (VMware)    ! echo 'p:syscalls/sys_enter_open vfs_open file=+0($arg2)' >> dynamic_events
32297e1dcdSSteven Rostedt (VMware)
33297e1dcdSSteven Rostedt (VMware)    echo '-:kgroup/kevent' >> dynamic_events
34297e1dcdSSteven Rostedt (VMware)fi
35297e1dcdSSteven Rostedt (VMware)
36297e1dcdSSteven Rostedt (VMware)echo '-:egroup/eevent' >> dynamic_events
37297e1dcdSSteven Rostedt (VMware)
38297e1dcdSSteven Rostedt (VMware)clear_trace
39