[LTP] [PATCH v3] commands/mkfs: Added new testcase to test mkfs(8) command.

Guangwen Feng fenggw-fnst@cn.fujitsu.com
Thu Nov 5 03:03:54 CET 2015


On 2015/11/04 21:22, Cyril Hrubis wrote:
> Hi!
>> +mkfs_verify_size()
>> +{
>> +	mkfs_mount
>> +	local blocknum=`df -B 1k mntpoint | tail -n1 | awk '{print $2}'`
>> +	mkfs_umount
>> +
>> +	if [ $blocknum -gt "$2" ]; then
>> +		return 1
>> +	fi
>> +
>> +	# Size argument in mkfs.ntfs denotes number-of-sectors which is 512bytes,
>> +	# 1k-block size should be devided by this argument for ntfs verification.
>> +	if [ "$1" = "ntfs" ]; then
>> +		local rate=1024/512
>> +		if [ $blocknum -lt "$(($2/rate*9/10))" ]; then
>> +			return 1
>> +		fi
>> +	else
>> +		if [ $blocknum -lt "$(($2*9/10))" ]; then
>> +			return 1
>> +		fi
>> +	fi
> 
> I've added explicit return 0 here, since otherwise the retul value would
> be set by the last executed command (which would be the either umount
> or mount above...).
> 

Indeed, got it.
Many thanks!

Best Regards,
Guangwen Feng

> 
> And pushed, thanks.
> 


More information about the Ltp mailing list