diff mbox series

[blktests,v3,2/6] block/032: make error messages clearer if mkfs or mount fails

Message ID 20250212205448.2107005-3-mcgrof@kernel.org (mailing list archive)
State New
Headers show
Series enable bs > ps device testing | expand

Commit Message

Luis Chamberlain Feb. 12, 2025, 8:54 p.m. UTC
If block/032 fails at mkfs we want to know why, so propagate
error messages. While at it, enhance the test to also propagate
the error return from mount and remove the odd sleep for a udevadm
settle as that's the only thing I can think of we need to wait for
here.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 tests/block/032 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Shinichiro Kawasaki Feb. 14, 2025, 11:06 a.m. UTC | #1
On Feb 12, 2025 / 12:54, Luis Chamberlain wrote:
> If block/032 fails at mkfs we want to know why, so propagate
> error messages. While at it, enhance the test to also propagate
> the error return from mount and remove the odd sleep for a udevadm
> settle as that's the only thing I can think of we need to wait for
> here.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  tests/block/032 | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/block/032 b/tests/block/032
> index 8975879660d7..fc6d1a51dcad 100755
> --- a/tests/block/032
> +++ b/tests/block/032
> @@ -25,10 +25,10 @@ test() {
>  	fi
>  
>  	mkdir -p "${TMPDIR}/mnt"
> -	_xfs_mkfs_and_mount "/dev/${SCSI_DEBUG_DEVICES[0]}" "${TMPDIR}/mnt" > /dev/null 2>&1
> +	_xfs_mkfs_and_mount "/dev/${SCSI_DEBUG_DEVICES[0]}" "${TMPDIR}/mnt" >> $FULL || return $?

The $FULL needs double quotations to avoid a shellcheck warning. That change was
in the 6th patch, but let's fix it here.

When _xfs_mkfs_and_mount() fails, I think it is the better to call
_exit_scsi_debug() before returning from test(). It will clean up the scsi_debug
device, then will reduce the impact on following test cases.

>  	echo 1 > "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/delete"
> -	sleep 2
> -	umount "${TMPDIR}/mnt"
> +	udevadm settle
> +	umount "${TMPDIR}/mnt" || return $?
>  
>  	_exit_scsi_debug
>  
> -- 
> 2.45.2
>
diff mbox series

Patch

diff --git a/tests/block/032 b/tests/block/032
index 8975879660d7..fc6d1a51dcad 100755
--- a/tests/block/032
+++ b/tests/block/032
@@ -25,10 +25,10 @@  test() {
 	fi
 
 	mkdir -p "${TMPDIR}/mnt"
-	_xfs_mkfs_and_mount "/dev/${SCSI_DEBUG_DEVICES[0]}" "${TMPDIR}/mnt" > /dev/null 2>&1
+	_xfs_mkfs_and_mount "/dev/${SCSI_DEBUG_DEVICES[0]}" "${TMPDIR}/mnt" >> $FULL || return $?
 	echo 1 > "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/delete"
-	sleep 2
-	umount "${TMPDIR}/mnt"
+	udevadm settle
+	umount "${TMPDIR}/mnt" || return $?
 
 	_exit_scsi_debug