Skip to contentSkip to conversation

generic/{175,297,298}: fix use of uninitialized var

PATCH In review Amir Goldstein 3 participants 3 messages Aug 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 generic/{175,297,298}: fix use of uninitialized var

The truncate command in those tests use an uninitialized variable i. in kdevops, i must contain some leftover, so we get errors like:
/data/fstests-install/xfstests/tests/generic/298: line 45: /dev/loop12):
syntax error: operand expected (error token is "/dev/loop12)")

Apparently, noone including the author of the tests knows why this truncate command is in the test, so remove the wrong truncate command.

---

Changes since v1:
- Remove the unneeded truncate command instead of fixing it

 tests/generic/175 | 1 -
 tests/generic/297 | 1 -
 tests/generic/298 | 1 -
 3 files changed, 3 deletions(-)
tests/generic/175 +0 -1
index 07af2199..f827beb6 100755
@@ -33,7 +33,6 @@ _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
 
 fnr=19
 echo "Create extents"
-truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
 	n=$(( (2 ** i) * blksz))
tests/generic/297 +0 -1
index 6bdc3e1c..54c2ac21 100755
@@ -42,7 +42,6 @@ _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
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
 	n=$(( (2 ** i) * blksz))
tests/generic/298 +0 -1
index 95d4c02b..115a9bf7 100755
@@ -42,7 +42,6 @@ _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
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
 	n=$(( (2 ** i) * blksz))
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Amir Goldstein

The truncate command in those tests use an uninitialized variable i. in kdevops, i must contain some leftover, so we get errors like:
/data/fstests-install/xfstests/tests/generic/298: line 45: /dev/loop12):
syntax error: operand expected (error token is "/dev/loop12)")

Apparently, noone including the author of the tests knows why this truncate command is in the test, so remove the wrong truncate command.

---

Good to me,

Quoted 48 lines

Changes since v1:
- Remove the unneeded truncate command instead of fixing it

 tests/generic/175 | 1 -
 tests/generic/297 | 1 -
 tests/generic/298 | 1 -
 3 files changed, 3 deletions(-)
tests/generic/175 +0 -1
index 07af2199..f827beb6 100755
@@ -33,7 +33,6 @@ _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
 
 fnr=19
 echo "Create extents"
-truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
 	n=$(( (2 ** i) * blksz))
tests/generic/297 +0 -1
index 6bdc3e1c..54c2ac21 100755
@@ -42,7 +42,6 @@ _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
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
 	n=$(( (2 ** i) * blksz))
tests/generic/298 +0 -1
index 95d4c02b..115a9bf7 100755
@@ -42,7 +42,6 @@ _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
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
 	n=$(( (2 ** i) * blksz))
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#2 lore raw
In reply to Amir Goldstein
Quoted 9 lines · Amir Goldstein

The truncate command in those tests use an uninitialized variable i. in kdevops, i must contain some leftover, so we get errors like:
/data/fstests-install/xfstests/tests/generic/298: line 45: /dev/loop12):
syntax error: operand expected (error token is "/dev/loop12)")

Apparently, noone including the author of the tests knows why this truncate command is in the test, so remove the wrong truncate command.

LGTM! :)

--D

Quoted 49 lines

---

Changes since v1:
- Remove the unneeded truncate command instead of fixing it

 tests/generic/175 | 1 -
 tests/generic/297 | 1 -
 tests/generic/298 | 1 -
 3 files changed, 3 deletions(-)
tests/generic/175 +0 -1
index 07af2199..f827beb6 100755
@@ -33,7 +33,6 @@ _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
 
 fnr=19
 echo "Create extents"
-truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
 	n=$(( (2 ** i) * blksz))
tests/generic/297 +0 -1
index 6bdc3e1c..54c2ac21 100755
@@ -42,7 +42,6 @@ _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
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
 	n=$(( (2 ** i) * blksz))
tests/generic/298 +0 -1
index 95d4c02b..115a9bf7 100755
@@ -42,7 +42,6 @@ _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
 for i in $(seq 0 $fnr); do
 	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
 	n=$(( (2 ** i) * blksz))
Signature · 1 line
2.34.1