Linux block layer
 help / color / mirror / Atom feed
* [PATCH blktests] block/044: Strip script line numbers from expected stderr output
@ 2026-11-29 23:53 Bart Van Assche
  2026-12-03  0:24 ` Shin'ichiro Kawasaki
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2026-11-29 23:53 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block, Bart Van Assche

tests/block/044.out expects bash error messages referencing lines 56 and
57 for the two invalid error injection rules, while the corresponding echo
commands are on lines 49 and 50 of tests/block/044. As a result, block/044
fails whenever CONFIG_BLK_ERROR_INJECTION is enabled.

Strip the "<script>: line <N>: " prefix from stderr when testing invalid
rules and update tests/block/044.out accordingly so the test output does
not depend on script line numbers.

Fixes: 10f78d6a7ad0 ("block/044: basic block error injection sanity test")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 tests/block/044     | 6 ++++--
 tests/block/044.out | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/block/044 b/tests/block/044
index 097dd79d3bda..24367c048d81 100755
--- a/tests/block/044
+++ b/tests/block/044
@@ -46,8 +46,10 @@ _test_rules()
 	xfs_io -d -c 'pread -q 8192 8192' /dev/"$dev"
 
 	echo "Testing invalid rules"
-	echo "op=READ,status=IOERR" > "$debugfs_file"
-	echo "add,op=READ,status=EIO,start=32" > "$debugfs_file"
+	{
+		echo "op=READ,status=IOERR" > "$debugfs_file"
+		echo "add,op=READ,status=EIO,start=32" > "$debugfs_file"
+	} 2>&1 | sed 's/^[^:]*: line [0-9]*: //'
 	_exit_scsi_debug
 }
 
diff --git a/tests/block/044.out b/tests/block/044.out
index 92efcddf7c8e..01d27b40d21f 100644
--- a/tests/block/044.out
+++ b/tests/block/044.out
@@ -4,6 +4,6 @@ Testing valid rules
 pwrite: Cannot allocate memory
 pread: Input/output error
 Testing invalid rules
-tests/block/044: line 56: echo: write error: Invalid argument
-tests/block/044: line 57: echo: write error: Invalid argument
+echo: write error: Invalid argument
+echo: write error: Invalid argument
 Test complete

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03  0:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 23:53 [PATCH blktests] block/044: Strip script line numbers from expected stderr output Bart Van Assche
2026-12-03  0:24 ` Shin'ichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox