[PATCH 28/61] selftests-dyndbg: add test_mod_submod
Jim Cromie
jim.cromie at gmail.com
Thu Oct 10 16:14:28 UTC 2024
This new test-fn runs 3 module/submodule modprobe scenarios, variously
using both the generic dyndbg=<queries> modprobe arg, and the
test-module's classmap-params to manipulate the test-mod*'s pr_debugs.
In all cases, the current flag-settings are counted and tested vs
expectations.
The 3rd scenario recapitulates the DRM_USE_DYNAMIC_DEBUG=y failure.
1. 2 modprobes (super then sub), with separate dyndbg=class-settings
check module specific flag settings
2. modprobe submod, supermod is auto-loaded
set supermod class-params
check expected enablements in super & submod
3. modprobe super, with param=setting (like drm.debug=0x1ef)
modprobe submod
validate submod's class'd pr_debugs get properly enabled
The test uses multi-queries, with both commas and percents (to avoid
spaces and quoting). This is the main reason the test wasn't earlier
in the patchset, closer to the classmap patches its validating.
With some tedium, the tests could be refactored to split out early
tests which avoid multi-cmds, and test only the class-params.
Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
.../dynamic_debug/dyndbg_selftest.sh | 67 +++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
index 613e73fe67fa..9128b81c9a9c 100755
--- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
+++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
@@ -271,10 +271,77 @@ function test_percent_splitting {
ifrmmod test_dynamic_debug
}
+function test_mod_submod {
+ echo -e "${GREEN}# TEST_MOD_SUBMOD ${NC}"
+ ifrmmod test_dynamic_debug_submod
+ ifrmmod test_dynamic_debug
+ ddcmd =_
+
+ # modprobe with class enablements
+ modprobe test_dynamic_debug \
+ dyndbg=class,D2_CORE,+pf%class,D2_KMS,+pt%class,D2_ATOMIC,+pm
+
+ check_match_ct '\[test_dynamic_debug\]' 23 -r
+ check_match_ct =pf 1
+ check_match_ct =pt 1
+ check_match_ct =pm 1
+
+ modprobe test_dynamic_debug_submod
+ check_match_ct test_dynamic_debug_submod 23 -r
+ check_match_ct '\[test_dynamic_debug\]' 23 -r
+ check_match_ct test_dynamic_debug 46 -r
+
+ # no enablements propagate here
+ check_match_ct =pf 1
+ check_match_ct =pt 1
+ check_match_ct =pm 1
+
+ # change classes again, this time submod too
+ ddcmd class,D2_CORE,+mf%class,D2_KMS,+lt%class,D2_ATOMIC,+ml "# add some prefixes"
+ check_match_ct =pmf 1 -v
+ check_match_ct =plt 1 -v
+ check_match_ct =pml 1 -v
+ # submod changed too
+ check_match_ct =mf 1 -v
+ check_match_ct =lt 1 -v
+ check_match_ct =ml 1 -v
+
+ # now work the classmap-params
+ # fresh start, to clear all above flags (test-fn limits)
+ ifrmmod test_dynamic_debug_submod
+ ifrmmod test_dynamic_debug
+ modprobe test_dynamic_debug_submod # get supermod too
+
+ echo 1 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits
+ echo 4 > /sys/module/test_dynamic_debug/parameters/p_level_num
+ # 2 mods * ( V1-3 + D2_CORE )
+ check_match_ct =p 8 -v
+ echo 3 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits
+ echo 0 > /sys/module/test_dynamic_debug/parameters/p_level_num
+ # 2 mods * ( D2_CORE, D2_DRIVER )
+ check_match_ct =p 4 -v
+ echo 0x16 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits
+ echo 0 > /sys/module/test_dynamic_debug/parameters/p_level_num
+ # 2 mods * ( D2_DRIVER, D2_KMS, D2_ATOMIC )
+ check_match_ct =p 6 -v
+
+ # recap DRM_USE_DYNAMIC_DEBUG regression
+ ifrmmod test_dynamic_debug_submod
+ ifrmmod test_dynamic_debug
+ # set super-mod params
+ modprobe test_dynamic_debug p_disjoint_bits=0x16 p_level_num=5
+ check_match_ct =p 7 -v
+ modprobe test_dynamic_debug_submod
+ # see them picked up by submod
+ check_match_ct =p 14 -v
+}
+
tests_list=(
basic_tests
+ # these require test_dynamic_debug*.ko
comma_terminator_tests
test_percent_splitting
+ test_mod_submod
)
# Run tests
--
2.46.2
More information about the Intel-gfx-trybot
mailing list