[PATCH 29/33] ext4/006: fix this test

Darrick J. Wong
2025-10-29T01:27:59Z

This test fails with:

--- tests/ext4/006.out 2025-04-30 16:20:44.427339499 -0700
+++ /var/tmp/fstests/ext4/006.out.bad 2025-09-12 14:46:22.697238872 -0700
@@ -1,3 +1,4 @@
QA output created by 006
See interesting results in RESULT_DIR/006.full
+e2fsck did not fix everything
finished fuzzing

The reason for this is that the $ROUND2_LOG file has five lines in it:

++ mount image (2)
++ chattr -R -i
++ test scratch
++ modify scratch
+++ stressing filesystem
++ unmount

When I wrote this test there were more things that common/fuzzy tried to
do. Commit 9bab148bb3c7db reduced the _scratch_fuzz_modify output from
3 lines to 1, which accounts for the discrepancy.

Fix this by counting the lines that do /not/ start with two pluses and
failing if there's at least one such line.

Cc: <fstests@vger.kernel.org> # v2023.02.26
Fixes: 9bab148bb3c7db ("common/fuzzy: exercise the filesystem a little harder after repairing")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/ext4/006 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/ext4/006 b/tests/ext4/006
index 2ece22a4bd1ed8..3379ab77de30fb 100755
--- a/tests/ext4/006
+++ b/tests/ext4/006
@@ -125,13 +125,15 @@ _scratch_fuzz_modify >> $ROUND2_LOG 2>&1
echo "++ unmount" >> $ROUND2_LOG
umount "${SCRATCH_MNT}" >> $ROUND2_LOG 2>&1

+echo "======= round2" >> $seqres.full
cat "$ROUND2_LOG" >> $seqres.full
+echo "=======" >> $seqres.full

echo "++ check fs (2)" >> $seqres.full
_check_scratch_fs >> $seqres.full 2>&1

grep -E -q '(did not fix|makes no progress)' $seqres.full && echo "e2fsck failed" | tee -a $seqres.full
-if [ "$(wc -l < "$ROUND2_LOG")" -ne 7 ]; then
+if [ "$(grep -v '^++' "$ROUND2_LOG" | wc -l)" -gt 0 ]; then
echo "e2fsck did not fix everything" | tee -a $seqres.full
fi
echo "finished fuzzing" | tee -a "$seqres.full"