[v4,31/39] dyndbg-test: test_private_trace_mixed_class - parameterize modname

Message ID 20240210235009.2405808-32-ukaszb@chromium.org
State New
Headers
Series dyndbg: add support for writing debug logs to trace |

Commit Message

Ɓukasz Bartosik Feb. 10, 2024, 11:50 p.m. UTC
  From: Jim Cromie <jim.cromie@gmail.com>

This fn currently is hard-coded to modprobe test_dynamic_debug.ko for
its tests, we'd also like to use test_dynamic_debug_submod.ko.
Add local modname="test_dynamic_debug" to make this explicit.

This leaves the use of search_trace_name for hard-coded reference
content, unfortunately that will take more fiddling.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 .../dynamic_debug/dyndbg_selftest.sh          | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)
  

Patch

diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
index d1f447eef4c0..abe94af0f3eb 100755
--- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
+++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
@@ -499,7 +499,20 @@  function search_in_trace_for {
 }
 
 function test_private_trace_mixed_class {
-    echo -e "${GREEN}# TEST_PRIVATE_TRACE_5 ${NC}"
+    local modname="test_dynamic_debug"
+    echo -e "${GREEN}# TEST_PRIVATE_TRACE_mixed_class ${NC}"
+
+    local eyeball_ref=<<'EOD'
+        modprobe-1173    [001] .....   7.781008: 0: test_dynamic_debug:do_cats: test_dd: D2_CORE msg
+        modprobe-1173    [001] .....   7.781010: 0: test_dynamic_debug:do_cats: test_dd: D2_KMS msg
+        modprobe-1173    [001] .....   7.781010: 0: test_dynamic_debug:do_levels: test_dd: V3 msg
+             cat-1214    [001] .....   7.905494: 0: test_dd: doing categories
+             cat-1214    [001] .....   7.905495: 0: test_dynamic_debug:do_cats: test_dd: D2_CORE msg
+             cat-1214    [001] .....   7.905496: 0: test_dynamic_debug:do_cats: test_dd: D2_KMS msg
+             cat-1214    [001] .....   7.905497: 0: test_dd: doing levels
+             cat-1214    [001] .....   7.905498: 0: test_dynamic_debug:do_levels: test_dd: V3 msg
+EOD
+
     ddcmd =_
     ddcmd module,params,+T:unopened fail
     check_err_msg "Invalid argument"
@@ -509,7 +522,7 @@  function test_private_trace_mixed_class {
     ddcmd open bupkus
     is_trace_instance_opened bupkus
     check_trace_instance_dir bupkus 1
-    modprobe test_dynamic_debug \
+    modprobe $modname \
 	     dyndbg=class,D2_CORE,+T:bupkus.mf%class,D2_KMS,+T:bupkus.mf%class,V3,+T:bupkus.mf
 
     # test various name misses
@@ -524,8 +537,7 @@  function test_private_trace_mixed_class {
     ddcmd "module params =:0."
 
     check_match_ct =T:bupkus.mf 3		# the 3 classes enabled above
-    # enable the 5 non-class'd pr_debug()s
-    ddcmd "module test_dynamic_debug =T:bupkus"
+    ddcmd "module $modname =T:bupkus"		# enable the 5 non-class'd pr_debug()s
     check_match_ct =T:bupkus 8 -r		# 8=5+3
 
     doprints
@@ -538,18 +550,6 @@  function test_private_trace_mixed_class {
     ddcmd close,bupkus
     is_trace_instance_closed bupkus
 
-    # check results
-    eyeball_ref=<<EOD
-        modprobe-1173    [001] .....   7.781008: 0: test_dynamic_debug:do_cats: test_dd: D2_CORE msg
-        modprobe-1173    [001] .....   7.781010: 0: test_dynamic_debug:do_cats: test_dd: D2_KMS msg
-        modprobe-1173    [001] .....   7.781010: 0: test_dynamic_debug:do_levels: test_dd: V3 msg
-             cat-1214    [001] .....   7.905494: 0: test_dd: doing categories
-             cat-1214    [001] .....   7.905495: 0: test_dynamic_debug:do_cats: test_dd: D2_CORE msg
-             cat-1214    [001] .....   7.905496: 0: test_dynamic_debug:do_cats: test_dd: D2_KMS msg
-             cat-1214    [001] .....   7.905497: 0: test_dd: doing levels
-             cat-1214    [001] .....   7.905498: 0: test_dynamic_debug:do_levels: test_dd: V3 msg
-EOD
-
     # validate the 3 enabled class'd sites, with mf prefix
     search_trace_name bupkus 0 "test_dynamic_debug:do_cats: test_dd: D2_CORE msg"
     search_trace_name bupkus 0 "test_dynamic_debug:do_cats: test_dd: D2_KMS msg"