mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 00:10:04 +01:00
Skip more tests if --disable-cryptsetup is used.
If there is no cryptsetup, some tests returns ok while noting was tested in reality. Just mark them skipped.
This commit is contained in:
@@ -87,7 +87,7 @@ function skip()
|
|||||||
{
|
{
|
||||||
[ -n "$1" ] && echo "$1"
|
[ -n "$1" ] && echo "$1"
|
||||||
remove_mapping
|
remove_mapping
|
||||||
[ -z "$2" ] && exit $2
|
[ -n "$2" ] && exit $2
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ function fail()
|
|||||||
|
|
||||||
function skip()
|
function skip()
|
||||||
{
|
{
|
||||||
|
remove_mapping
|
||||||
[ -n "$1" ] && echo "$1"
|
[ -n "$1" ] && echo "$1"
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
@@ -143,6 +144,7 @@ function check_version()
|
|||||||
|
|
||||||
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
|
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
|
||||||
[ -z "$LOOPDEV" ] && skip "Cannot find free loop device, test skipped."
|
[ -z "$LOOPDEV" ] && skip "Cannot find free loop device, test skipped."
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
command -v uuencode >/dev/null || skip "WARNING: test require uuencode binary, test skipped."
|
command -v uuencode >/dev/null || skip "WARNING: test require uuencode binary, test skipped."
|
||||||
check_version || skip "Probably old kernel, test skipped."
|
check_version || skip "Probably old kernel, test skipped."
|
||||||
|
|
||||||
|
|||||||
@@ -33,19 +33,18 @@ function fail()
|
|||||||
function skip()
|
function skip()
|
||||||
{
|
{
|
||||||
[ -n "$1" ] && echo "$1"
|
[ -n "$1" ] && echo "$1"
|
||||||
echo "Test skipped."
|
|
||||||
remove_mapping
|
remove_mapping
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_one()
|
function test_one()
|
||||||
{
|
{
|
||||||
$CRYPTSETUP benchmark -c "$1" -s "$2" | grep -v "#" || skip
|
$CRYPTSETUP benchmark -c "$1" -s "$2" | grep -v "#" || skip "Cannot use $1/$2, test skipped."
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_required()
|
function test_required()
|
||||||
{
|
{
|
||||||
command -v lsblk >/dev/null || skip "WARNING: lsblk tool required."
|
command -v lsblk >/dev/null || skip "lsblk tool required, test skipped."
|
||||||
|
|
||||||
echo "REQUIRED KDF TEST"
|
echo "REQUIRED KDF TEST"
|
||||||
$CRYPTSETUP benchmark -h whirlpool | grep "N/A" && skip
|
$CRYPTSETUP benchmark -h whirlpool | grep "N/A" && skip
|
||||||
@@ -61,7 +60,7 @@ function test_required()
|
|||||||
}
|
}
|
||||||
|
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
test_required
|
test_required
|
||||||
[ ! -d $TST_DIR ] && tar xJf $srcdir/luks1-images.tar.xz --no-same-owner
|
[ ! -d $TST_DIR ] && tar xJf $srcdir/luks1-images.tar.xz --no-same-owner
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,7 @@ dmremove() { # device
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
for dev in $(dmsetup status --target crypt | sed s/\:\ .*// | grep "^$DEV_NAME"_); do
|
[ -b /dev/mapper/"$DEV_NAME"_tstdev ] && dmremove "$DEV_NAME"_tstdev
|
||||||
dmremove $dev
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
[ -b /dev/mapper/$DEV_NAME ] && dmremove $DEV_NAME
|
[ -b /dev/mapper/$DEV_NAME ] && dmremove $DEV_NAME
|
||||||
losetup -d $LOOPDEV >/dev/null 2>&1
|
losetup -d $LOOPDEV >/dev/null 2>&1
|
||||||
rm -f $HEADER_IMG >/dev/null 2>&1
|
rm -f $HEADER_IMG >/dev/null 2>&1
|
||||||
@@ -138,6 +135,7 @@ dmcrypt()
|
|||||||
|
|
||||||
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
|
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
|
||||||
[ -z "$LOOPDEV" ] && skip "Cannot find free loop device, test skipped."
|
[ -z "$LOOPDEV" ] && skip "Cannot find free loop device, test skipped."
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
|
|
||||||
add_device
|
add_device
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ function fail()
|
|||||||
function skip()
|
function skip()
|
||||||
{
|
{
|
||||||
[ -n "$1" ] && echo "$1"
|
[ -n "$1" ] && echo "$1"
|
||||||
echo "Test skipped."
|
|
||||||
remove_mapping
|
remove_mapping
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,7 @@ function test_kdf() # hash
|
|||||||
|
|
||||||
function test_required()
|
function test_required()
|
||||||
{
|
{
|
||||||
command -v lsblk >/dev/null || skip "WARNING: lsblk tool required."
|
command -v lsblk >/dev/null || skip "lsblk tool required, test skipped."
|
||||||
|
|
||||||
echo "REQUIRED KDF TEST"
|
echo "REQUIRED KDF TEST"
|
||||||
test_kdf sha256
|
test_kdf sha256
|
||||||
@@ -101,7 +100,7 @@ function test_required()
|
|||||||
test_one camellia xts 512 camellia
|
test_one camellia xts 512 camellia
|
||||||
test_one kuznyechik xts 512 kuznyechik
|
test_one kuznyechik xts 512 kuznyechik
|
||||||
|
|
||||||
ls $TST_DIR/[tv]c* >/dev/null 2>&1 || skip "No remaining images."
|
ls $TST_DIR/[tv]c* >/dev/null 2>&1 || skip "No remaining images, test skipped."
|
||||||
}
|
}
|
||||||
|
|
||||||
function valgrind_setup()
|
function valgrind_setup()
|
||||||
@@ -117,6 +116,7 @@ function valgrind_run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
[ ! -d $TST_DIR ] && tar xJf $srcdir/tcrypt-images.tar.xz --no-same-owner
|
[ ! -d $TST_DIR ] && tar xJf $srcdir/tcrypt-images.tar.xz --no-same-owner
|
||||||
|
|
||||||
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||||
|
|||||||
Reference in New Issue
Block a user