git: 187f4fce3b34 - main - stress2: Added a fsck check to the scenario

From: Peter Holm <pho_at_FreeBSD.org>
Date: Mon, 20 Feb 2023 11:06:20 UTC
The branch main has been updated by pho:

URL: https://cgit.FreeBSD.org/src/commit/?id=187f4fce3b3445e69ab2da539c48e355981ae436

commit 187f4fce3b3445e69ab2da539c48e355981ae436
Author:     Peter Holm <pho@FreeBSD.org>
AuthorDate: 2023-02-20 11:04:24 +0000
Commit:     Peter Holm <pho@FreeBSD.org>
CommitDate: 2023-02-20 11:04:24 +0000

    stress2: Added a fsck check to the scenario
---
 tools/test/stress2/misc/newfs6.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/test/stress2/misc/newfs6.sh b/tools/test/stress2/misc/newfs6.sh
index 5e887f1496a6..690170ceb938 100755
--- a/tools/test/stress2/misc/newfs6.sh
+++ b/tools/test/stress2/misc/newfs6.sh
@@ -38,6 +38,7 @@ mount | grep "on $mntpoint " | grep -q md$mdstart &&
 mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart
 mdconfig -a -t swap -s 1g -u $mdstart || exit 1
 
+log=/tmp/newfs6.sh.log
 s=0
 for opt in -O1 -O2 -U -j; do
 	bs=4096
@@ -49,9 +50,15 @@ for opt in -O1 -O2 -U -j; do
 			    md$mdstart > /dev/null || { s=1; continue; }
 			mount /dev/md$mdstart $mntpoint || s=2 &&
 			    umount $mntpoint
+			fsck -fy /dev/md$mdstart > $log 2>&1
+			grep -q "WAS MODIFIED" $log && {
+				s=3
+				cat $log
+			}
 		done
 		bs=$((bs * 2))
 	done
 done
 mdconfig -d -u $mdstart
+rm -f $log
 exit $s