kselftest: ftrace: Fix to compare a zero-filled hex value
[linux-stable.git] / tools / testing / selftests / ftrace / test.d / kprobe / kprobe_args_type.tc
blobc75faefb4fffcb617383f9aebab0d40270f58743
1 #!/bin/sh
2 # description: Kprobes event arguments with types
4 [ -f kprobe_events ] || exit_unsupported # this is configurable
6 grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
8 echo 0 > events/enable
9 echo > kprobe_events
10 enable_tracing
12 echo 'p:testprobe _do_fork $stack0:s32 $stack0:u32 $stack0:x32 $stack0:b8@4/32' > kprobe_events
13 grep testprobe kprobe_events
14 test -d events/kprobes/testprobe
16 echo 1 > events/kprobes/testprobe/enable
17 ( echo "forked")
18 echo 0 > events/kprobes/testprobe/enable
19 ARGS=`tail -n 1 trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
21 check_types() {
22 X1=`printf "%x" $1 | tail -c 8`
23 X2=`printf "%x" $2`
24 X3=`printf "%x" $3`
25 test $X1 = $X2
26 test $X2 = $X3
27 test 0x$X3 = $3
29 B4=`printf "%02x" $4`
30 B3=`echo -n $X3 | tail -c 3 | head -c 2`
31 test $B3 = $B4
33 check_types $ARGS
35 echo "-:testprobe" >> kprobe_events
36 clear_trace
37 test -d events/kprobes/testprobe && exit 1 || exit 0