[LTP] [PATCH 1/8] tst_test.sh: Add $TST_MOUNT_DEVICE

Cyril Hrubis chrubis@suse.cz
Mon May 30 16:04:06 CEST 2022


Hi!
> +	if [ "$TST_MOUNT_DEVICE" = 1 -a "$TST_MOUNT_FLAG" = 1 ]; then

Isn't the TST_MOUNT_DEVICE redundant here? We set the mount flag only if
the device was mounted by the library. Or do I miss something?

> +		tst_umount
> +	fi
> +
>  	if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then
>  		if ! tst_device release "$TST_DEVICE"; then
>  			tst_res TWARN "Failed to release device '$TST_DEVICE'"
> @@ -632,7 +636,7 @@ tst_run()
>  			NET_SKIP_VARIABLE_INIT|NEEDS_CHECKPOINTS);;
>  			CHECKPOINT_WAIT|CHECKPOINT_WAKE);;
>  			CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);;
> -			DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE);;
> +			DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE|MOUNT_DEVICE);;
>  			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
>  			esac
>  		done
> @@ -666,6 +670,7 @@ tst_run()
>  
>  	_tst_setup_timer
>  
> +	[ "$TST_MOUNT_DEVICE" = 1 ] && TST_FORMAT_DEVICE=1
>  	[ "$TST_FORMAT_DEVICE" = 1 ] && TST_NEEDS_DEVICE=1
>  	[ "$TST_NEEDS_DEVICE" = 1 ] && TST_NEEDS_TMPDIR=1
>  
> @@ -702,6 +707,11 @@ tst_run()
>  		tst_mkfs $TST_FS_TYPE $TST_DEV_FS_OPTS $TST_DEVICE $TST_DEV_EXTRA_OPTS
>  	fi
>  
> +	if [ "$TST_MOUNT_DEVICE" = 1 ]; then
> +		tst_mount
> +		TST_MOUNT_FLAG=1
> +	fi
> +
>  	[ -n "$TST_NEEDS_CHECKPOINTS" ] && _tst_init_checkpoints
>  
>  	if [ -n "$TST_SETUP" ]; then

Other than that it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list