NAME uprobes - list probes by file
RUN {{BPFTRACE}} -l 'uprobe:./testprogs/uprobe_test:*'
EXPECT uprobe:./testprogs/uprobe_test:function1
TIMEOUT 5

NAME uprobes - list probes by file with wildcarded filter
RUN {{BPFTRACE}} -l 'uprobe:./testprogs/uprobe_test:func*'
EXPECT uprobe:./testprogs/uprobe_test:function1
TIMEOUT 5

NAME uprobes - list probes with wildcarded file matching multiple files
RUN {{BPFTRACE}} -l 'uprobe:./testprogs/uprobe*:*'
EXPECT uprobe:./testprogs/uprobe_test:function1
TIMEOUT 5

NAME uprobes - list probes by file with wildcarded file and filter
RUN {{BPFTRACE}} -l 'uprobe:./testprogs/uprobe_test*:func*'
EXPECT uprobe:./testprogs/uprobe_test:function1
TIMEOUT 5

NAME uprobes - list probes by file with specific filter
RUN {{BPFTRACE}} -l 'uprobe:./testprogs/uprobe_test:function1'
EXPECT uprobe:./testprogs/uprobe_test:function1
TIMEOUT 5

NAME uprobes - list probes by file with wildcarded probe type
RUN {{BPFTRACE}} -l '*:./testprogs/uprobe_test:*' | grep -e '^uprobe:'
EXPECT uprobe:./testprogs/uprobe_test:function1
TIMEOUT 5

NAME uprobes - list probes by pid
RUN {{BPFTRACE}} -l -p {{BEFORE_PID}} | grep -e '^uprobe'
EXPECT uprobe:.*/testprogs/uprobe_test:function1
TIMEOUT 5
BEFORE ./testprogs/uprobe_test

NAME uprobes - list probes by pid; uprobes only
RUN {{BPFTRACE}} -l 'uprobe:*' -p {{BEFORE_PID}}
EXPECT uprobe:.*/testprogs/uprobe_test:function1
TIMEOUT 5
BEFORE ./testprogs/uprobe_test

NAME uprobes - list probes by pid in separate mount namespace
RUN {{BPFTRACE}} -l -p {{BEFORE_PID}} | grep -e '^uprobe'
EXPECT uprobe:.*/bpftrace-unshare-mountns-test/uprobe_test:function1
TIMEOUT 5
BEFORE ./testprogs/mountns_wrapper uprobe_test

NAME uprobes - attach to probe for executable in separate mount namespace
RUN {{BPFTRACE}} -e 'uprobe:/tmp/bpftrace-unshare-mountns-test/uprobe_test:function1 { printf("here\n" ); exit(); }' -p {{BEFORE_PID}}
EXPECT Attaching 1 probe...
TIMEOUT 5
BEFORE ./testprogs/mountns_wrapper uprobe_test

NAME uprobes - list probes in non-executable library
RUN {{BPFTRACE}} -l 'uprobe:./testlibs/libsimple.so:fun'
EXPECT uprobe:./testlibs/libsimple.so:fun
TIMEOUT 5

NAME uprobes - probe function in non-executable library
PROG uprobe:./testlibs/libsimple.so:fun {}
EXPECT Attaching 1 probe...
TIMEOUT 5
