linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fstests: add a _require_scratch_mountopt helper
@ 2020-09-08 15:42 Josef Bacik
  0 siblings, 0 replies; only message in thread
From: Josef Bacik @ 2020-09-08 15:42 UTC (permalink / raw)
  To: linux-btrfs, kernel-team, fstests

I want to add a test that requires a new mount option, so add a helper
to safely _notrun if the kernel doesn't support the new mount option.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 common/rc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/common/rc b/common/rc
index aa5a7409..431855a7 100644
--- a/common/rc
+++ b/common/rc
@@ -3281,6 +3281,19 @@ _require_norecovery()
 	_scratch_unmount
 }
 
+# notrun if we can't mount scratch with the given mount option
+_require_scratch_mountopt()
+{
+	local option=$1
+
+	_require_scratch
+	_scratch_mkfs > /dev/null 2>&1
+
+	_try_scratch_mount "-o $option" > /dev/null 2>&1 || \
+		_notrun "$SCRATCH_DEV $FSTYP does not support -o $option"
+	_scratch_unmount
+}
+
 # Does this filesystem support metadata journaling?
 # We exclude ones here that don't; otherwise we assume that it does, so the
 # test will run, fail, and motivate someone to update this test for a new
-- 
2.26.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-08 19:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 15:42 [PATCH] fstests: add a _require_scratch_mountopt helper Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).