Skip to content

Commit

Permalink
Fix tests to support --disable-keyring option.
Browse files Browse the repository at this point in the history
Also remove unused function in test.
  • Loading branch information
mbroz authored and danzatt committed Jan 19, 2024
1 parent 0ba3e30 commit e0eb4da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 2 additions & 0 deletions tests/compat-test2
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down
24 changes: 6 additions & 18 deletions tests/device-test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit e0eb4da

Please sign in to comment.