git: b4a666180180 - main - stress2: Handle "gunion create" error exit

From: Peter Holm <pho_at_FreeBSD.org>
Date: Fri, 15 Jul 2022 08:20:27 UTC
The branch main has been updated by pho:

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

commit b4a666180180719272e16d9bfade5b7fc500b6be
Author:     Peter Holm <pho@FreeBSD.org>
AuthorDate: 2022-07-15 08:17:23 +0000
Commit:     Peter Holm <pho@FreeBSD.org>
CommitDate: 2022-07-15 08:17:23 +0000

    stress2: Handle "gunion create" error exit
---
 tools/test/stress2/misc/gunion.sh  | 7 +++++--
 tools/test/stress2/misc/gunion2.sh | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/test/stress2/misc/gunion.sh b/tools/test/stress2/misc/gunion.sh
index c7d376e5409e..e72979f2a39a 100755
--- a/tools/test/stress2/misc/gunion.sh
+++ b/tools/test/stress2/misc/gunion.sh
@@ -50,7 +50,10 @@ cp -r ../../stress2 $mp1
 umount $mp1
 
 mdconfig -a -t swap -s 5g -u $md2
-gunion create -v /dev/md$md2 /dev/md$md1
+set +e
+gunion create -v /dev/md$md2 /dev/md$md1; s=$?
+[ $s -ne 0 ] && echo "gunion create returned $s"
+set -e
 mount /dev/md$md2-md$md1.union $mntpoint
 
 export RUNDIR=$mntpoint/stressX
@@ -71,7 +74,7 @@ for i in `jot 6`; do
 done
 fsck_ffs -fyR /dev/md$md2-md$md1.union > $log 2>&1
 grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=2; cat $log; }
-set +e
+set -e
 gunion commit /dev/md$md2-md$md1.union
 gunion list | egrep Block\|Current | egrep -v 0 && s=3
 gunion destroy /dev/md$md2-md$md1.union
diff --git a/tools/test/stress2/misc/gunion2.sh b/tools/test/stress2/misc/gunion2.sh
index a8fe180c48af..2fa7fc451963 100755
--- a/tools/test/stress2/misc/gunion2.sh
+++ b/tools/test/stress2/misc/gunion2.sh
@@ -50,7 +50,10 @@ cp -r ../../stress2 $mp1
 umount $mp1
 
 mdconfig -a -t swap -s 5g -u $md2
-gunion create -v /dev/md$md2 /dev/md$md1
+set +e
+gunion create -v /dev/md$md2 /dev/md$md1; s=$?
+[ $s -ne 0 ] && echo "gunion create returned $s"
+set -e
 mount /dev/md$md2-md$md1.union $mntpoint
 
 export CTRLDIR=$mntpoint/stressX.control
@@ -79,7 +82,7 @@ testcases/swap/swap
 "
 export TESTPROGS=`echo $TESTPROGS | sed 's/\n/ /g'`
 
-set +e
+set -e
 chmod 777 $mntpoint
 su $testuser -c \
 	"(cd $mntpoint/stress2; ./testcases/run/run $TESTPROGS)"