Commit c6ffad06 authored by Mike Gerdts's avatar Mike Gerdts Committed by Jim Harris
Browse files

test/bdev: improper check of mkfs.ext4 return



Before this fix, nbd_with_lvol_verify() would compare the string output
of mkfs.ext4 ("Dicarding device blocks...") with 0. If the shell does
not cast an invalid number to 0, test in the if statement will evaluate
to false.

The intent of the test in the if statement seems to be to check the exit
code from mkfs.ext4. This commit implements that assumed intent.
Additionally, mkfs_ret is now a local variable.

Signed-off-by: default avatarMike Gerdts <mgerdts@nvidia.com>
Change-Id: I6c0de7b3f70674fb442abbcc9164f65a1ad55d40
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15276


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarXinrui Mao <xinrui.mao@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent bf253bf6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -125,13 +125,15 @@ function nbd_rpc_start_stop_verify() {
function nbd_with_lvol_verify() {
	local rpc_server=$1
	local nbd_list=($2)
	local mkfs_ret

	$rootdir/scripts/rpc.py -s $rpc_server bdev_malloc_create -b malloc_lvol_verify 16 512
	$rootdir/scripts/rpc.py -s $rpc_server bdev_lvol_create_lvstore malloc_lvol_verify lvs
	$rootdir/scripts/rpc.py -s $rpc_server bdev_lvol_create lvol 4 -l lvs
	$rootdir/scripts/rpc.py -s $rpc_server nbd_start_disk lvs/lvol "${nbd_list[0]}"

	mkfs_ret=$(mkfs.ext4 ${nbd_list[0]})
	mkfs.ext4 ${nbd_list[0]}
	mkfs_ret=$?
	nbd_stop_disks $rpc_server "${nbd_list[0]}"
	if [ $mkfs_ret -ne 0 ]; then
		return 1