selftests/ftrace: Test kprobe-event argument with various bitsize
Improve the kprobe-event with argument types testcase to test it with various bitsize. kprobe-event argument can be recorded in given types with various bitsize (8, 16, 32, 64), thus the type testcase should test the different bitsize too. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
This commit is contained in:
parent
1e51263ef4
commit
00b2f2bc3a
1 changed files with 32 additions and 16 deletions
|
@ -6,29 +6,45 @@
|
||||||
|
|
||||||
grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
|
grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
|
||||||
|
|
||||||
echo 'p:testprobe _do_fork $stack0:s32 $stack0:u32 $stack0:x32 $stack0:b8@4/32' > kprobe_events
|
gen_event() { # Bitsize
|
||||||
grep testprobe kprobe_events
|
echo "p:testprobe _do_fork \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1"
|
||||||
test -d events/kprobes/testprobe
|
}
|
||||||
|
|
||||||
echo 1 > events/kprobes/testprobe/enable
|
check_types() { # s-type u-type x-type bf-type width
|
||||||
( echo "forked")
|
test $# -eq 5
|
||||||
echo 0 > events/kprobes/testprobe/enable
|
CW=$5
|
||||||
ARGS=`tail -n 1 trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
|
CW=$((CW / 4))
|
||||||
|
X1=`printf "%x" $1 | tail -c ${CW}`
|
||||||
check_types() {
|
|
||||||
X1=`printf "%x" $1 | tail -c 8`
|
|
||||||
X2=`printf "%x" $2`
|
X2=`printf "%x" $2`
|
||||||
X3=`printf "%x" $3`
|
X3=`printf "%x" $3`
|
||||||
test $X1 = $X2
|
test $X1 = $X2
|
||||||
test $X2 = $X3
|
test $X2 = $X3
|
||||||
test 0x$X3 = $3
|
test 0x$X3 = $3
|
||||||
|
|
||||||
B4=`printf "%02x" $4`
|
B4=`printf "%1x" $4`
|
||||||
B3=`echo -n $X3 | tail -c 3 | head -c 2`
|
B3=`printf "%03x" 0x$X3 | tail -c 2 | head -c 1`
|
||||||
test $B3 = $B4
|
test $B3 = $B4
|
||||||
}
|
}
|
||||||
check_types $ARGS
|
|
||||||
|
|
||||||
echo "-:testprobe" >> kprobe_events
|
for width in 64 32 16 8; do
|
||||||
clear_trace
|
: "Add new event with basic types"
|
||||||
test -d events/kprobes/testprobe && exit_fail || exit_pass
|
gen_event $width > kprobe_events
|
||||||
|
grep testprobe kprobe_events
|
||||||
|
test -d events/kprobes/testprobe
|
||||||
|
|
||||||
|
: "Trace the event"
|
||||||
|
echo 1 > events/kprobes/testprobe/enable
|
||||||
|
( echo "forked")
|
||||||
|
echo 0 > events/kprobes/testprobe/enable
|
||||||
|
|
||||||
|
: "Confirm the arguments is recorded in given types correctly"
|
||||||
|
ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
|
||||||
|
check_types $ARGS $width
|
||||||
|
|
||||||
|
: "Clear event for next loop"
|
||||||
|
echo "-:testprobe" >> kprobe_events
|
||||||
|
clear_trace
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
exit_pass
|
||||||
|
|
Loading…
Add table
Reference in a new issue