Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/ftrace: Fix multiple kprobe testcase

Fix multiple kprobe event testcase to work it correctly.
There are 2 bugfixes.
- Since `wc -l FILE` returns not only line number but also
FILE filename, following "if" statement always failed.
Fix this bug by replacing it with 'cat FILE | wc -l'
- Since "while do-done loop" block with pipeline becomes a
subshell, $N local variable is not update outside of
the loop.
Fix this bug by using actual target number (256) instead
of $N.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Masami Hiramatsu and committed by
Shuah Khan
5cc6c8d4 ba1b9c50

+3 -3
+3 -3
tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
··· 20 20 test $N -eq 256 && break 21 21 done 22 22 23 - L=`wc -l kprobe_events` 24 - if [ $L -ne $N ]; then 25 - echo "The number of kprobes events ($L) is not $N" 23 + L=`cat kprobe_events | wc -l` 24 + if [ $L -ne 256 ]; then 25 + echo "The number of kprobes events ($L) is not 256" 26 26 exit_fail 27 27 fi 28 28