public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common/encrypt: Create an encrypted equivalent of _scratch_mkfs_sized
@ 2017-12-20 17:46 Ari Sundholm
  2017-12-21  1:38 ` Dave Chinner
  2017-12-21 22:10 ` [PATCH v2] " Ari Sundholm
  0 siblings, 2 replies; 8+ messages in thread
From: Ari Sundholm @ 2017-12-20 17:46 UTC (permalink / raw)
  To: fstests; +Cc: Ari Sundholm

Test case generic/399 hardcodes "-O encrypt" in MKFS_OPTIONS when
calling _scratch_mkfs_sized, which only works with the mkfs of certain
filesystems. Create a new helper, _scratch_mkfs_sized_encrypted, for
handling the differences between the mkfs tools of different
filesystems. It also allows those filesystems whose mkfs doesn't accept
"-O encrypt" to skip the test gracefully until proper support is added
for them in the helper.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
---
 common/encrypt    | 12 ++++++++++++
 tests/generic/399 |  3 +--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/common/encrypt b/common/encrypt
index a6fd89d..189c59e 100644
--- a/common/encrypt
+++ b/common/encrypt
@@ -81,6 +81,18 @@ _scratch_mkfs_encrypted()
 	esac
 }
 
+_scratch_mkfs_sized_encrypted()
+{
+	case $FSTYP in
+	ext4|f2fs)
+		MKFS_OPTIONS="$MKFS_OPTIONS -O encrypt" _scratch_mkfs_sized $*
+		;;
+	*)
+		_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized_encrypted"
+		;;
+	esac
+}
+
 # Give the invoking shell a new session keyring.  This makes any keys we add to
 # the session keyring scoped to the lifetime of the test script.
 _new_session_keyring()
diff --git a/tests/generic/399 b/tests/generic/399
index 8f5fcdc..70896e4 100755
--- a/tests/generic/399
+++ b/tests/generic/399
@@ -76,8 +76,7 @@ fs_size_in_mb=64
 fs_size=$((fs_size_in_mb * 1024 * 1024))
 dd if=/dev/zero of=$SCRATCH_DEV bs=$((1024 * 1024)) \
 	count=$fs_size_in_mb &>> $seqres.full
-MKFS_OPTIONS="$MKFS_OPTIONS -O encrypt" \
-	_scratch_mkfs_sized $fs_size &>> $seqres.full
+_scratch_mkfs_sized_encrypted $fs_size &>> $seqres.full
 _scratch_mount
 
 keydesc=$(_generate_encryption_key)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-12-22  5:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20 17:46 [PATCH] common/encrypt: Create an encrypted equivalent of _scratch_mkfs_sized Ari Sundholm
2017-12-21  1:38 ` Dave Chinner
2017-12-21 13:52   ` Ari Sundholm
2017-12-21 17:40     ` Ari Sundholm
2017-12-21 21:46     ` Dave Chinner
2017-12-21 22:17       ` Ari Sundholm
2017-12-22  5:09       ` Eryu Guan
2017-12-21 22:10 ` [PATCH v2] " Ari Sundholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox