[PATCH v4 30/39] dyndbg-test: fixup search-trace-name help

From: Łukasz Bartosik
Date: Sat Feb 10 2024 - 18:57:49 EST


From: Jim Cromie <jim.cromie@xxxxxxxxx>

The recent change to do whole-buf search (not just single line) had
the side-effect of printing too much $output, which hides the
information in clutter. Print the search pattern instead.

Also add -v last arg handling, like in check_match_ct(). This lets a
single caller enable verbose output, to see the trace-bufs content.

Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
---
tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
index a48cb57aa5cb..d1f447eef4c0 100755
--- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
+++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
@@ -159,6 +159,7 @@ function search_trace() {
# $1 - trace instance name, 0 for global event trace
# $2 - line number counting from the bottom
# $3 - text to search for
+# $4 - optional -v to see verbose results
function search_trace_name() {
if [ "$1" = "0" ]; then
buf=$(cat /sys/kernel/debug/tracing/trace)
@@ -179,8 +180,9 @@ function search_trace_name() {
in line '$line' or '$buf'"
exit
fi
- if [ $v_search_trace = 1 ]; then
- echo -e "${MAGENTA}: search_trace_name in $1 found: \n$output \nin:${BLUE} $buf ${NC}"
+ if [[ "$4" == "-v" || "$v_search_trace" = 1 ]]; then
+ echo -e "${MAGENTA}: search_trace_name in $1 found: \n${YELLOW}$3 \
+ \nin:${BLUE} $buf ${NC}"
fi
}

--
2.43.0.687.g38aa6559b0-goog