mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
Skip cryptsetup tests when cryptsetup is disabled
If configured with --disable-cryptsetup (e.g. if only veritysetup is required), these tests won't be able to run cryptsetup, so they need to be skipped.
This commit is contained in:
@@ -173,6 +173,7 @@ format_plain_fail() # sector size
|
||||
fi
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
if [ $(id -u) != 0 ]; then
|
||||
echo "WARNING: You must be root to run this test, test skipped."
|
||||
exit 77
|
||||
|
||||
@@ -155,6 +155,7 @@ format_fail() # expected [forced] [encryption_sector_size]
|
||||
echo "PASSED"
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
if [ $(id -u) != 0 ]; then
|
||||
echo "WARNING: You must be root to run this test, test skipped."
|
||||
exit 77
|
||||
|
||||
@@ -98,6 +98,7 @@ function valgrind_run()
|
||||
}
|
||||
|
||||
export LANG=C
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
[ ! -d $TST_DIR ] && tar xJSf $srcdir/bitlk-images.tar.xz --no-same-owner 2>/dev/null || skip "Incompatible tar."
|
||||
|
||||
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||
|
||||
@@ -217,6 +217,8 @@ function expect_run()
|
||||
export LANG=C
|
||||
valgrind_setup
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
|
||||
# LUKS non-root-tests
|
||||
if [ $(id -u) != 0 ]; then
|
||||
$CRYPTSETUP benchmark -c aes-xts-plain64 >/dev/null 2>&1 || \
|
||||
|
||||
@@ -25,6 +25,14 @@ function fail()
|
||||
exit 2
|
||||
}
|
||||
|
||||
function skip()
|
||||
{
|
||||
[ -n "$1" ] && echo "$1"
|
||||
echo "Test skipped."
|
||||
cleanup
|
||||
exit 77
|
||||
}
|
||||
|
||||
function valgrind_setup()
|
||||
{
|
||||
command -v valgrind >/dev/null || fail "Cannot find valgrind."
|
||||
@@ -62,7 +70,7 @@ function exp_pass()
|
||||
}
|
||||
|
||||
export LANG=C
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||
|
||||
# initial test constructed acccording to current cryptsetup content
|
||||
|
||||
@@ -281,6 +281,7 @@ function add_scsi_device() {
|
||||
|
||||
export LANG=C
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
|
||||
[ -z "$LOOPDEV" ] && skip "WARNING: Cannot find free loop device, test skipped."
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ check_sector_size() # $1 expected sector size
|
||||
fi
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
if [ $(id -u) != 0 ]; then
|
||||
skip "You must be root to run this test, test skipped."
|
||||
fi
|
||||
|
||||
@@ -21,6 +21,12 @@ fail()
|
||||
exit 100
|
||||
}
|
||||
|
||||
skip()
|
||||
{
|
||||
[ -n "$1" ] && echo "$1"
|
||||
exit 77
|
||||
}
|
||||
|
||||
add_device() {
|
||||
rmmod scsi_debug >/dev/null 2>&1
|
||||
if [ -d /sys/module/scsi_debug ] ; then
|
||||
@@ -54,6 +60,7 @@ function check_version()
|
||||
return 1
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
if [ $(id -u) != 0 ]; then
|
||||
echo "WARNING: You must be root to run this test, test skipped."
|
||||
exit 77
|
||||
|
||||
@@ -115,6 +115,7 @@ add_device() {
|
||||
[ -b $DEV ] || fail "Cannot find $DEV."
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
|
||||
command -v dmsetup >/dev/null || skip "Cannot find dmsetup, test skipped"
|
||||
command -v keyctl >/dev/null || skip "Cannot find keyctl, test skipped"
|
||||
|
||||
@@ -226,6 +226,8 @@ function expect_run()
|
||||
expect "$@"
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
|
||||
bin_check jq
|
||||
bin_check sha256sum
|
||||
bin_check xxd
|
||||
|
||||
@@ -112,6 +112,7 @@ function valgrind_run()
|
||||
INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||
|
||||
command -v jq >/dev/null || skip "Cannot find jq, test skipped."
|
||||
|
||||
@@ -29,6 +29,12 @@ function fail()
|
||||
cleanup 2
|
||||
}
|
||||
|
||||
skip()
|
||||
{
|
||||
echo "TEST SKIPPED: $1"
|
||||
cleanup 77
|
||||
}
|
||||
|
||||
crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
|
||||
{
|
||||
DEV2=$DEV_NAME"_x"
|
||||
@@ -95,6 +101,7 @@ crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
|
||||
dmremove $DEV2
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
if [ $(id -u) != 0 ]; then
|
||||
echo "WARNING: You must be root to run this test, test skipped."
|
||||
exit 77
|
||||
|
||||
@@ -128,6 +128,7 @@ check_dump()
|
||||
[ "$keyslot_dump" = "$keyslot" ] || fail " keyslot check from dump failed."
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
|
||||
|
||||
# Prevent running dangerous useradd operation by default
|
||||
|
||||
Reference in New Issue
Block a user