]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
selftests/ftrace: Fix multiple kprobe testcase
authorMasami Hiramatsu <mhiramat@kernel.org>
Tue, 26 Nov 2019 08:34:42 +0000 (17:34 +0900)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 30 Jan 2020 15:22:41 +0000 (16:22 +0100)
BugLink: https://bugs.launchpad.net/bugs/1860130
[ Upstream commit 5cc6c8d4a99d0ee4d5466498e258e593df1d3eb6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc

index 5862eee91e1d9b474bb1b91b6c8628e87aa53817..6e3dbe5f96b7b76c6361f5e286c868e9c3e7edfa 100644 (file)
@@ -20,9 +20,9 @@ while read i; do
   test $N -eq 256 && break
 done
 
-L=`wc -l kprobe_events`
-if [ $L -ne $N ]; then
-  echo "The number of kprobes events ($L) is not $N"
+L=`cat kprobe_events | wc -l`
+if [ $L -ne 256 ]; then
+  echo "The number of kprobes events ($L) is not 256"
   exit_fail
 fi