]> asedeno.scripts.mit.edu Git - linux.git/blob - tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
37443dd23d15475ff37c36c088681212a6438764
[linux.git] / tools / testing / selftests / ftrace / test.d / kprobe / kprobe_args_type.tc
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: Kprobes event arguments with types
4
5 [ -f kprobe_events ] || exit_unsupported # this is configurable
6
7 grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
8
9 echo 'p:testprobe _do_fork $stack0:s32 $stack0:u32 $stack0:x32 $stack0:b8@4/32' > kprobe_events
10 grep testprobe kprobe_events
11 test -d events/kprobes/testprobe
12
13 echo 1 > events/kprobes/testprobe/enable
14 ( echo "forked")
15 echo 0 > events/kprobes/testprobe/enable
16 ARGS=`tail -n 1 trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
17
18 check_types() {
19   X1=`printf "%x" $1 | tail -c 8`
20   X2=`printf "%x" $2`
21   X3=`printf "%x" $3`
22   test $X1 = $X2
23   test $X2 = $X3
24   test 0x$X3 = $3
25
26   B4=`printf "%02x" $4`
27   B3=`echo -n $X3 | tail -c 3 | head -c 2`
28   test $B3 = $B4
29 }
30 check_types $ARGS
31
32 echo "-:testprobe" >> kprobe_events
33 clear_trace
34 test -d events/kprobes/testprobe && exit_fail || exit_pass