diff mbox series

[2/3] tests/generic/027: use c-style for loops

Message ID 20221212230820.3466-2-ddiss@suse.de (mailing list archive)
State New, archived
Headers show
Series [1/3] common/attr: require xfs_spaceman for xfs acl_get_max | expand

Commit Message

David Disseldorp Dec. 12, 2022, 11:08 p.m. UTC
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 tests/generic/027 | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Eric Biggers Dec. 13, 2022, 5:51 a.m. UTC | #1
On Tue, Dec 13, 2022 at 12:08:19AM +0100, David Disseldorp wrote:
> Signed-off-by: David Disseldorp <ddiss@suse.de>
> ---
>  tests/generic/027 | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/generic/027 b/tests/generic/027
> index 47f1981d..002be120 100755
> --- a/tests/generic/027
> +++ b/tests/generic/027
> @@ -53,22 +53,18 @@ fi
>  
>  dir=$SCRATCH_MNT/testdir
>  echo -n "iteration" >>$seqres.full
> -i=1
> -while [ $i -le $loop ]; do
> +for ((i = 1; i < loop; i++)); do

This does one fewer iteration than before.

- Eric
David Disseldorp Dec. 13, 2022, 8:56 a.m. UTC | #2
On Mon, 12 Dec 2022 21:51:09 -0800, Eric Biggers wrote:

> > -while [ $i -le $loop ]; do
> > +for ((i = 1; i < loop; i++)); do  
> 
> This does one fewer iteration than before.

Gah you're right. I'll drop this patch as it was only intended as a
readability clean-up. Thanks for the review.

Cheers, David
diff mbox series

Patch

diff --git a/tests/generic/027 b/tests/generic/027
index 47f1981d..002be120 100755
--- a/tests/generic/027
+++ b/tests/generic/027
@@ -53,22 +53,18 @@  fi
 
 dir=$SCRATCH_MNT/testdir
 echo -n "iteration" >>$seqres.full
-i=1
-while [ $i -le $loop ]; do
+for ((i = 1; i < loop; i++)); do
 	echo -n " $i" >>$seqres.full
-	nr_worker=8
-	while [ $nr_worker -gt 0 ]; do
+	for ((nr_worker = 8; nr_worker > 0; nr_worker--)); do
 		# half buffered I/O half direct I/O
 		if [ `expr $nr_worker % 2` -eq 0 ]; then
 			create_file $dir/$nr_worker -d >>$seqres.full &
 		else
 			create_file $dir/$nr_worker >>$seqres.full &
 		fi
-		let nr_worker=$nr_worker-1
 	done
 	wait
 	rm -rf $dir
-	let i=$i+1
 done
 _scratch_unmount