Re: [PATCH] generic/{175,297,298}: fix use of uninitialized var

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Sat, Aug 12, 2023 at 06:15:00PM +0300, Amir Goldstein wrote:
> Not sure how those tests pass in regression tests.
> Probably truncate silently fails and is not critical to the test.
> 
> in kdevops I get errors like:
> /data/fstests-install/xfstests/tests/generic/298: line 45: /dev/loop12):
>            syntax error: operand expected (error token is "/dev/loop12)")
> 
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ---

Hmm, weird, I never hit this failure, all test passed [1]. But I think the
reason is [2], $(()) looks like treat empty variable as 0.

Anyway, this patch makes sense, so

Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx>

[1]
# ./check -s simpledev generic/175 generic/297 generic/298
SECTION       -- simpledev
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 hp-dl380pg8-01 6.5.0-0.rc3.23.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 24 13:32:24 UTC 2023
MKFS_OPTIONS  -- -f /dev/sda3
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda3 /mnt/scratch

generic/175 91s ...  40s
generic/297        44s
generic/298 125s ...  44s
Ran: generic/175 generic/297 generic/298
Passed all 3 tests

SECTION       -- simpledev
=========================
Ran: generic/175 generic/297 generic/298
Passed all 3 tests


[2]
# blksz=4096
# echo $blksz
4096
# echo $i

# echo $(( (2 ** i) * blksz))
4096
# echo $i

# echo $((i))
0






>  tests/generic/175 | 2 +-
>  tests/generic/297 | 2 +-
>  tests/generic/298 | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/generic/175 b/tests/generic/175
> index 07af2199..14825a39 100755
> --- a/tests/generic/175
> +++ b/tests/generic/175
> @@ -33,7 +33,7 @@ _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
>  
>  fnr=19
>  echo "Create extents"
> -truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
> +truncate -s $(( (2 ** (fnr + 1)) * blksz)) "$testdir/file1"
>  for i in $(seq 0 $fnr); do
>  	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
>  	n=$(( (2 ** i) * blksz))
> diff --git a/tests/generic/297 b/tests/generic/297
> index 6bdc3e1c..1fc48671 100755
> --- a/tests/generic/297
> +++ b/tests/generic/297
> @@ -42,7 +42,7 @@ _pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
>  fnr=26		# 2^26 reflink extents should be enough to find a slow op?
>  timeout=8	# guarantee a good long run...
>  echo "Find a reflink size that takes a long time"
> -truncate -s $(( (2 ** i) * blksz)) $testdir/file1
> +truncate -s $(( (2 ** (fnr + 1)) * blksz)) $testdir/file1
>  for i in $(seq 0 $fnr); do
>  	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
>  	n=$(( (2 ** i) * blksz))
> diff --git a/tests/generic/298 b/tests/generic/298
> index 95d4c02b..2e917a87 100755
> --- a/tests/generic/298
> +++ b/tests/generic/298
> @@ -42,7 +42,7 @@ _pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
>  fnr=26		# 2^26 reflink extents should be enough to find a slow op?
>  timeout=8	# guarantee a good long run...
>  echo "Find a reflink size that takes a long time"
> -truncate -s $(( (2 ** i) * blksz)) $testdir/file1
> +truncate -s $(( (2 ** (fnr + 1)) * blksz)) $testdir/file1
>  for i in $(seq 0 $fnr); do
>  	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
>  	n=$(( (2 ** i) * blksz))
> -- 
> 2.34.1
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux