aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAri Sundholm <ari@tuxera.com>2017-12-22 00:10:05 +0200
committerEryu Guan <eguan@redhat.com>2017-12-31 20:49:36 +0800
commit79a3bb053fecd883f38dacb44ddca9a3125dfd9d (patch)
tree1cf61b0aaae07eeb501d9a13f1034d675b850f15
parent5525ac5228098683cf9639de2f2cff029eb0db5e (diff)
downloadxfstests-79a3bb053fecd883f38dacb44ddca9a3125dfd9d.tar.gz
common/encrypt: Create an encrypted equivalent of _scratch_mkfs_sized
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. ubifs is not supported in the new helper despite supporting encryption, as _scratch_mkfs_sized has no ubifs support and adding that should be done in a separate patch. Signed-off-by: Ari Sundholm <ari@tuxera.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
-rw-r--r--common/encrypt12
-rwxr-xr-xtests/generic/3993
2 files changed, 13 insertions, 2 deletions
diff --git a/common/encrypt b/common/encrypt
index a6fd89d991..189c59ee9b 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 8f5fcdc6df..70896e4341 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)