diff mbox series

[v2,25/59] selftests-dyndbg: add comma_terminator_tests

Message ID 20250320185238.447458-26-jim.cromie@gmail.com (mailing list archive)
State New, archived
Headers show
Series Fix CONFIG_DRM_USE_DYNAMIC_DEBUG=y | expand

Commit Message

Jim Cromie March 20, 2025, 6:52 p.m. UTC
New fn validates parsing and effect of queries using combinations of
commas and spaces to delimit the tokens.

It manipulates pr-debugs in builtin module/params, so might have deps
I havent foreseen on odd configurations.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
- skip comma tests if no builtins
---
 .../dynamic_debug/dyndbg_selftest.sh          | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

Comments

Louis Chauvet March 24, 2025, 3:19 p.m. UTC | #1
Le 20/03/2025 à 19:52, Jim Cromie a écrit :
> New fn validates parsing and effect of queries using combinations of
> commas and spaces to delimit the tokens.
> 
> It manipulates pr-debugs in builtin module/params, so might have deps
> I havent foreseen on odd configurations.
> 
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>

> ---
> - skip comma tests if no builtins
> ---
>   .../dynamic_debug/dyndbg_selftest.sh          | 21 ++++++++++++++++++-
>   1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
> index 68a9046405f2..368d10a691a0 100755
> --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
> +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
> @@ -216,7 +216,7 @@ function check_err_msg() {
>   function basic_tests {
>       echo -e "${GREEN}# BASIC_TESTS ${NC}"
>       if [ $LACK_DD_BUILTIN -eq 1 ]; then
> -	echo "SKIP"
> +	echo "SKIP - test requires params, which is a builtin module"
>   	return
>       fi
>       ddcmd =_ # zero everything
> @@ -238,8 +238,27 @@ EOF
>       ddcmd =_
>   }
>   
> +function comma_terminator_tests {
> +    echo -e "${GREEN}# COMMA_TERMINATOR_TESTS ${NC}"
> +    if [ $LACK_DD_BUILTIN -eq 1 ]; then
> +	echo "SKIP - test requires params, which is a builtin module"
> +	return
> +    fi
> +    # try combos of spaces & commas
> +    check_match_ct '\[params\]' 4 -r
> +    ddcmd module,params,=_		# commas as spaces
> +    ddcmd module,params,+mpf		# turn on module's pr-debugs
> +    check_match_ct =pmf 4
> +    ddcmd ,module ,, ,  params, -p
> +    check_match_ct =mf 4
> +    ddcmd " , module ,,, ,  params, -m"	#
> +    check_match_ct =f 4
> +    ddcmd =_
> +}
> +
>   tests_list=(
>       basic_tests
> +    comma_terminator_tests
>   )
>   
>   # Run tests
diff mbox series

Patch

diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
index 68a9046405f2..368d10a691a0 100755
--- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
+++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
@@ -216,7 +216,7 @@  function check_err_msg() {
 function basic_tests {
     echo -e "${GREEN}# BASIC_TESTS ${NC}"
     if [ $LACK_DD_BUILTIN -eq 1 ]; then
-	echo "SKIP"
+	echo "SKIP - test requires params, which is a builtin module"
 	return
     fi
     ddcmd =_ # zero everything
@@ -238,8 +238,27 @@  EOF
     ddcmd =_
 }
 
+function comma_terminator_tests {
+    echo -e "${GREEN}# COMMA_TERMINATOR_TESTS ${NC}"
+    if [ $LACK_DD_BUILTIN -eq 1 ]; then
+	echo "SKIP - test requires params, which is a builtin module"
+	return
+    fi
+    # try combos of spaces & commas
+    check_match_ct '\[params\]' 4 -r
+    ddcmd module,params,=_		# commas as spaces
+    ddcmd module,params,+mpf		# turn on module's pr-debugs
+    check_match_ct =pmf 4
+    ddcmd ,module ,, ,  params, -p
+    check_match_ct =mf 4
+    ddcmd " , module ,,, ,  params, -m"	#
+    check_match_ct =f 4
+    ddcmd =_
+}
+
 tests_list=(
     basic_tests
+    comma_terminator_tests
 )
 
 # Run tests