aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Broz <gmazyland@gmail.com>2024-01-19 11:51:44 +0100
committerDaniel Zaťovič <daniel.zatovic@gmail.com>2024-01-19 13:40:25 +0000
commite0eb4dad957427ed771b80661a49908987dc4c76 (patch)
treeec790eb41bd6445a47973dc159187444222685ca
parent0ba3e3077cb0695f7ca94880a78b519d69647ec1 (diff)
downloadcryptsetup-e0eb4dad957427ed771b80661a49908987dc4c76.tar.gz
Fix tests to support --disable-keyring option.
Also remove unused function in test.
-rwxr-xr-xtests/compat-test22
-rwxr-xr-xtests/device-test24
2 files changed, 8 insertions, 18 deletions
diff --git a/tests/compat-test2 b/tests/compat-test2
index 7a770aee..62d654f0 100755
--- a/tests/compat-test2
+++ b/tests/compat-test2
@@ -175,6 +175,8 @@ function valgrind_run()
function dm_crypt_keyring_support()
{
+ $CRYPTSETUP --version | grep -q KEYRING || return 1
+
VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
[ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
diff --git a/tests/device-test b/tests/device-test
index d35e226e..9aaf03c8 100755
--- a/tests/device-test
+++ b/tests/device-test
@@ -108,21 +108,6 @@ function dm_crypt_features()
DM_PERF_NO_WORKQUEUE=1
}
-function dm_crypt_keyring_support()
-{
- VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
- [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
-
- VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
- VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
-
- # run the test with dm-crypt v1.15.0+ on purpose
- # the fix is in dm-crypt v1.18.1+
- [ $VER_MAJ -gt 1 ] && return 0
- [ $VER_MAJ -lt 1 ] && return 1
- [ $VER_MIN -ge 15 ]
-}
-
format() # format
{
add_image
@@ -287,9 +272,12 @@ else
echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME --disable-keyring || fail
$CRYPTSETUP status $DEV_NAME | grep -q keyring && fail
if [ -n "$DM_KEYRING" ]; then
- echo -n "keyring "
- echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME || fail
- $CRYPTSETUP status $DEV_NAME | grep -q keyring || fail
+ $CRYPTSETUP --version | grep -q KEYRING
+ if [ $? -eq 0 ]; then
+ echo -n "keyring "
+ echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME || fail
+ $CRYPTSETUP status $DEV_NAME | grep -q keyring || fail
+ fi
fi
if [ -n "$DM_PERF_NO_WORKQUEUE" ]; then
echo -n "no_read_workqueue no_write_workqueue"