public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eryu Guan <guaneryu@gmail.com>
Cc: fstests@vger.kernel.org
Subject: [PATCH 2/2] check: wipe scratch devices between tests
Date: Tue, 16 Apr 2019 15:36:28 -0700	[thread overview]
Message-ID: <20190416223628.GB22015@magnolia> (raw)
In-Reply-To: <20190416223459.GA22015@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Wipe the scratch devices in between each test to ensure that tests are
formatting them and not making assumptions about previous contents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 check      |    6 ++++--
 common/rc  |    9 +++++++++
 common/xfs |    1 +
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/check b/check
index 5670e13b..6271d573 100755
--- a/check
+++ b/check
@@ -493,9 +493,8 @@ _check_filesystems()
 	if [ -f ${RESULT_DIR}/require_scratch ]; then
 		_check_scratch_fs || err=true
 		rm -f ${RESULT_DIR}/require_scratch*
-	else
-		_scratch_unmount 2> /dev/null
 	fi
+	_scratch_unmount 2> /dev/null
 }
 
 _expunge_test()
@@ -635,6 +634,8 @@ for section in $HOST_OPTIONS_SECTIONS; do
 	      echo "check: failed to mount \$SCRATCH_DEV using specified options"
 	      status=1
 	      exit
+	  else
+	      _scratch_unmount
 	  fi
 	fi
 
@@ -753,6 +754,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
 			# _check_dmesg depends on this log in dmesg
 			touch ${RESULT_DIR}/check_dmesg
 		fi
+		_try_wipe_scratch_devs > /dev/null 2>&1
 		if [ "$DUMP_OUTPUT" = true ]; then
 			./$seq 2>&1 | tee $tmp.out
 			# Because $? would get tee's return code
diff --git a/common/rc b/common/rc
index 6cbd6040..e0dd3797 100644
--- a/common/rc
+++ b/common/rc
@@ -3991,6 +3991,15 @@ _require_fibmap()
 	rm -f $file
 }
 
+_try_wipe_scratch_devs()
+{
+	test -x "$WIPEFS_PROG" || return 0
+
+	for dev in $SCRATCH_DEV_POOL $SCRATCH_DEV $SCRATCH_LOGDEV $SCRATCH_RTDEV; do
+		test -b $dev && $WIPEFS_PROG -a $dev
+	done
+}
+
 init_rc
 
 ################################################################################
diff --git a/common/xfs b/common/xfs
index 178acefc..4f2ead55 100644
--- a/common/xfs
+++ b/common/xfs
@@ -295,6 +295,7 @@ _require_xfs_db_command()
 	fi
 	command=$1
 
+	_scratch_mkfs_xfs >/dev/null 2>&1
 	_scratch_xfs_db -x -c "help" | grep $command > /dev/null || \
 		_notrun "xfs_db $command support is missing"
 }

  reply	other threads:[~2019-04-16 22:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 22:34 [PATCH 1/2] check: remove require_{test,scratch}* after a test fails Darrick J. Wong
2019-04-16 22:36 ` Darrick J. Wong [this message]
2019-04-17  1:19 ` [PATCH 3/2] check: filter lockdep bugs when scanning dmesg Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190416223628.GB22015@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox