blob: 624a2c250c28e05a0f82d02f6ed563372e2d9d62 [file] [log] [blame]
From 0a5d9584baa904ba8b89ed1e87d2a2325bf2fc11 Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <>
Date: Tue, 26 Nov 2019 17:34:42 +0900
Subject: [PATCH] selftests/ftrace: Fix multiple kprobe testcase
commit 5cc6c8d4a99d0ee4d5466498e258e593df1d3eb6 upstream.
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 <>
Reviewed-by: Steven Rostedt (VMware) <>
Signed-off-by: Shuah Khan <>
Signed-off-by: Paul Gortmaker <>
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/ b/tools/testing/selftests/ftrace/test.d/kprobe/
index 5862eee91e1d..6e3dbe5f96b7 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/
@@ -20,9 +20,9 @@ while read i; do
test $N -eq 256 && break
-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"