Skip to contentSkip to conversation

locking/lock_torture: accept optional "[debug]" in result string

PATCH In review Vincent Chen via ltp 2 participants 2 messages Jan 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 locking/lock_torture: accept optional "[debug]" in result string

lock_torture.sh parses the lock_torture result from dmesg by matching the "End of test: <RESULT>:" line.

When the kernel is built with lock debugging enabled (e.g. CONFIG_DEBUG_MUTEXES, CONFIG_DEBUG_RT_MUTEXES, CONFIG_DEBUG_SPINLOCK), lock_torture may print "End of test: SUCCESS [debug]: ...". The current regexp expects "SUCCESS:" and fails to match, causing the test to be reported as failure.

Allow an optional " [debug]" token between the result string and the colon so the test can correctly detect SUCCESS on debug kernels.

---
 testcases/kernel/device-drivers/locking/lock_torture.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/device-drivers/locking/lock_torture.sh +1 -1
index dfa57373f..d9bd95da2 100755
@@ -83,7 +83,7 @@ for type in $lock_type; do
 		tst_brkm TBROK "failed to unload module"
 
 	# check module status in dmesg
-	result_str=`dmesg | sed -nE '$s/.*End of test: ([A-Z]+):.*/\1/p'`
+	result_str=`dmesg | sed -nE '$s/.*End of test: ([A-Z]+)([[:space:]]+\[debug\])?:.*/\1/p'`
 	if [ "$result_str" = "SUCCESS" ]; then
 		tst_resm TPASS "$type: completed"
 	else
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Vincent,

Quoted 11 lines

lock_torture.sh parses the lock_torture result from dmesg by matching the "End of test: <RESULT>:" line.

When the kernel is built with lock debugging enabled (e.g. CONFIG_DEBUG_MUTEXES, CONFIG_DEBUG_RT_MUTEXES, CONFIG_DEBUG_SPINLOCK), lock_torture may print "End of test: SUCCESS [debug]: ...". The current regexp expects "SUCCESS:" and fails to match, causing the test to be reported as failure.

Allow an optional " [debug]" token between the result string and the colon so the test can correctly detect SUCCESS on debug kernels.

Indeed:

torture_type, tag, cxt.debug_lock ? " [debug]": "", [1] based on config you mentioned [2].

Thanks, merged!

Kind regards,
Petr

[1] https://elixir.bootlin.com/linux/v6.19-rc5/source/kernel/locking/locktorture.c#L1103
[2] https://elixir.bootlin.com/linux/v6.19-rc5/source/kernel/locking/locktorture.c#L1279

Quoted 18 lines
---
 testcases/kernel/device-drivers/locking/lock_torture.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/device-drivers/locking/lock_torture.sh +1 -1
index dfa57373f..d9bd95da2 100755
@@ -83,7 +83,7 @@ for type in $lock_type; do
 		tst_brkm TBROK "failed to unload module"
 
 	# check module status in dmesg
-	result_str=`dmesg | sed -nE '$s/.*End of test: ([A-Z]+):.*/\1/p'`
+	result_str=`dmesg | sed -nE '$s/.*End of test: ([A-Z]+)([[:space:]]+\[debug\])?:.*/\1/p'`
 	if [ "$result_str" = "SUCCESS" ]; then
 		tst_resm TPASS "$type: completed"
 	else
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp