Skip to contentSkip to conversation

fstests: cleanup duplicate initialization and avoid writing to .full

PATCH In review Anand Jain 2 participants 6 messages May 24, 2025 – Jul 1, 2025 Btrfs file system

lore
Share & tools
lore

Anand Jain

author
#0 lore raw

cover fstests: cleanup duplicate initialization and avoid writing to .full

Patch 1/2 removes duplicate initialization and unnecessary comments from the test template.
Patch 2/2, sent earlier [1], initializes seqres early to avoid writing to .full.

[1]
https://patchwork.kernel.org/project/linux-btrfs/patch/12a741fc7606f1b1e13524b9ee745456feade656.1744183008.git.anand.jain@oracle.com/

Anand Jain (2):
fstests: remove duplicate initialization in the testcase
fstests: check: fix unset seqres in run_section()

 check           |  2 +-
 tests/btrfs/253 |  3 ---
 tests/ext4/053  | 10 ----------
 3 files changed, 1 insertion(+), 14 deletions(-)
Signature · 1 line
2.49.0
author
#1 lore raw

PATCH 1/2 fstests: remove duplicate initialization in the testcase

_begin_fstest() already initializes several variables, including seq and seqres, so remove those redundant initializations from the testcase.

Also, ext4/053 unnecessarily re-initializes here, tmp, and status, which _begin_fstest already handles. Remove those as well.

and remove template comment.

---
 tests/btrfs/253 |  3 ---
 tests/ext4/053  | 10 ----------
 2 files changed, 13 deletions(-)
tests/btrfs/253 +0 -3
index 96ab140f1780..a0cc9b55de69 100755
@@ -28,9 +28,6 @@
 . ./common/sysfs
 _begin_fstest auto
 
-seq=`basename $0`
-seqres="${RESULT_DIR}/${seq}"
-
 # Parse a size string which is in the format "XX.XXMib".
 #
 # Parameters:
tests/ext4/053 +0 -10
index 77b3ac8171f0..55f337b48355 100755
@@ -9,12 +9,6 @@
 . ./common/preamble
 _begin_fstest auto mount
 
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _cleanup()
@@ -27,13 +21,9 @@ _cleanup()
 	rm -f $tmp.*
 }
 
-# get standard environment, filters and checks
 . ./common/filter
 . ./common/quota
 
-# remove previous $seqres.full before test
-rm -f $seqres.full
-
 echo "Silence is golden."
 
 SIZE=$((1024 * 1024))	# 1GB in KB
Signature · 1 line
2.49.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] fstests: remove duplicate initialization in the testcase

Quoted 10 lines · Anand Jain

_begin_fstest() already initializes several variables, including seq and seqres, so remove those redundant initializations from the testcase.

Also, ext4/053 unnecessarily re-initializes here, tmp, and status, which _begin_fstest already handles. Remove those as well.

and remove template comment.

---

Thanks for cleaning up these redundant codes,

Quoted 52 lines
 tests/btrfs/253 |  3 ---
 tests/ext4/053  | 10 ----------
 2 files changed, 13 deletions(-)
tests/btrfs/253 +0 -3
index 96ab140f1780..a0cc9b55de69 100755
@@ -28,9 +28,6 @@
 . ./common/sysfs
 _begin_fstest auto
 
-seq=`basename $0`
-seqres="${RESULT_DIR}/${seq}"
-
 # Parse a size string which is in the format "XX.XXMib".
 #
 # Parameters:
tests/ext4/053 +0 -10
index 77b3ac8171f0..55f337b48355 100755
@@ -9,12 +9,6 @@
 . ./common/preamble
 _begin_fstest auto mount
 
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _cleanup()
@@ -27,13 +21,9 @@ _cleanup()
 	rm -f $tmp.*
 }
 
-# get standard environment, filters and checks
 . ./common/filter
 . ./common/quota
 
-# remove previous $seqres.full before test
-rm -f $seqres.full
-
 echo "Silence is golden."
 
 SIZE=$((1024 * 1024))	# 1GB in KB
Signature · 1 line
2.49.0
author
#3 lore raw

PATCH 2/2 fstests: check: fix unset seqres in run_section()

In reply to Anand Jain

While testing, I saw that ".full" is created by _scratch_unmount(), called here:

725 function run_section()
::
815 if [ ! -z "$SCRATCH_DEV" ]; then
816 _scratch_unmount 2> /dev/null
817 # call the overridden mkfs - make sure the FS is built

Ensure seqres is set early in run_section() as a fix.

---
This patch was sent earlier; it now addresses review comments and includes an updated git commit log, no code changes.
https://patchwork.kernel.org/project/linux-btrfs/patch/12a741fc7606f1b1e13524b9ee745456feade656.1744183008.git.anand.jain@oracle.com/

 check | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
check +1 -1
index ede54f6987bc..93d8a6cd3237 100755
@@ -794,6 +794,7 @@ function run_section()
 
 	seq="check.$$"
 	check="$RESULT_BASE/check"
+	seqres="$check"
 
 	# don't leave old full output behind on a clean run
 	rm -f $check.full
@@ -835,7 +836,6 @@ function run_section()
 	  fi
 	fi
 
-	seqres="$check"
 	_check_test_fs
 
 	loop_status=()	# track rerun-on-failure state
Signature · 1 line
2.49.0
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] fstests: check: fix unset seqres in run_section()

Quoted 8 lines · Anand Jain

While testing, I saw that ".full" is created by _scratch_unmount(), called here:

725 function run_section()
::
815 if [ ! -z "$SCRATCH_DEV" ]; then
816 _scratch_unmount 2> /dev/null
817 # call the overridden mkfs - make sure the FS is built

Quoted 4 lines

Ensure seqres is set early in run_section() as a fix.

---

Quoted 30 lines

This patch was sent earlier; it now addresses review comments and includes an updated git commit log, no code changes.
https://patchwork.kernel.org/project/linux-btrfs/patch/12a741fc7606f1b1e13524b9ee745456feade656.1744183008.git.anand.jain@oracle.com/

 check | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
check +1 -1
index ede54f6987bc..93d8a6cd3237 100755
@@ -794,6 +794,7 @@ function run_section()
 
 	seq="check.$$"
 	check="$RESULT_BASE/check"
+	seqres="$check"
 
 	# don't leave old full output behind on a clean run
 	rm -f $check.full
@@ -835,7 +836,6 @@ function run_section()
 	  fi
 	fi
 
-	seqres="$check"
 	_check_test_fs
 
 	loop_status=()	# track rerun-on-failure state
Signature · 1 line
2.49.0
author
#5 lore raw
In reply to Anand Jain

Zorro, just a gentle ping on this patchset.

Thanks.

Quoted 17 lines · Anand Jain

Patch 1/2 removes duplicate initialization and unnecessary comments from the test template.
Patch 2/2, sent earlier [1], initializes seqres early to avoid writing to .full.

[1]
https://patchwork.kernel.org/project/linux-btrfs/patch/12a741fc7606f1b1e13524b9ee745456feade656.1744183008.git.anand.jain@oracle.com/

Anand Jain (2):
fstests: remove duplicate initialization in the testcase
fstests: check: fix unset seqres in run_section()

  check           |  2 +-
  tests/btrfs/253 |  3 ---
  tests/ext4/053  | 10 ----------
  3 files changed, 1 insertion(+), 14 deletions(-)