Thread (47 messages) 47 messages, 4 authors, 2d ago

Re: [PATCH v3 16/17] selftests/verification: Rearrange the wwnr_printk test

From: Wen Yang <hidden>
Date: 2026-07-09 17:08:29
Also in: linux-kselftest, lkml


On 6/25/26 20:14, Gabriele Monaco wrote:
quoted hunk ↗ jump to hunk
The wwnr_printk test expects no reactions in some situations, after
fixing the bash assertion, the test is failing because expecting no
reaction after a previous step had reactions is flaky without making
sure all buffers are flushed.

Simplify the test and run the steps expecting no reaction before the one
expecting reactions. Also simplify the load function to stop loads as
soon as a reaction occurs, this limits the number of lines to flush and
makes tests overall more stable.

Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
  .../verification/test.d/rv_wwnr_printk.tc       | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc b/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
index 96de95edb5..a23d22f6ec 100644
--- a/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
+++ b/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
@@ -4,27 +4,30 @@
  # requires: available_reactors wwnr:monitor printk:reactor stress-ng:program
  
  load() { # returns true if there was a reaction
-	local lines_before num
+	local lines_before num load_pid ret
  	num=$((($(nproc) + 1) / 2))
  	lines_before=$(dmesg | wc -l)
-	stress-ng --cpu-sched "$num" --timer "$num" -t 5 -q
-	dmesg | tail -n $((lines_before + 1)) | grep -q "rv: monitor wwnr does not allow event"
+	stress-ng --cpu-sched "$num" --timer "$num" -t 5 -q &
+	load_pid=$!
+	timeout 5 dmesg -w | tail -n +$((lines_before + 1)) | grep -m 1 -q "rv: monitor wwnr does not allow event"

Minor nit: could we add a small delay (e.g., sleep 0.1) before dmesg?

Reviewed-by: Wen Yang <redacted>
+	ret=$?
+	kill "$load_pid"
+	wait "$load_pid"
+	return $ret
  }
  
  echo 1 > monitors/wwnr/enable
  echo printk > monitors/wwnr/reactors
  
-load
-
  echo 0 > monitoring_on
  ! load || false
  echo 1 > monitoring_on
  
-load
-
  echo 0 > reacting_on
  ! load || false
  echo 1 > reacting_on
  
+load
+
  echo nop > monitors/wwnr/reactors
  echo 0 > monitors/wwnr/enable
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help