mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
if [ $(id -u) != 0 ]; then
|
if [ $(id -u) != 0 ]; then
|
||||||
echo "WARNING: You must be root to run this test, test skipped."
|
echo "WARNING: You must be root to run this test, test skipped."
|
||||||
exit 77
|
exit 77
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ format_fail() # expected [forced] [encryption_sector_size]
|
|||||||
echo "PASSED"
|
echo "PASSED"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
if [ $(id -u) != 0 ]; then
|
if [ $(id -u) != 0 ]; then
|
||||||
echo "WARNING: You must be root to run this test, test skipped."
|
echo "WARNING: You must be root to run this test, test skipped."
|
||||||
exit 77
|
exit 77
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ function valgrind_run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
export LANG=C
|
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."
|
[ ! -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
|
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||||
|
|||||||
@@ -217,6 +217,8 @@ function expect_run()
|
|||||||
export LANG=C
|
export LANG=C
|
||||||
valgrind_setup
|
valgrind_setup
|
||||||
|
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
|
|
||||||
# LUKS non-root-tests
|
# LUKS non-root-tests
|
||||||
if [ $(id -u) != 0 ]; then
|
if [ $(id -u) != 0 ]; then
|
||||||
$CRYPTSETUP benchmark -c aes-xts-plain64 >/dev/null 2>&1 || \
|
$CRYPTSETUP benchmark -c aes-xts-plain64 >/dev/null 2>&1 || \
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ function fail()
|
|||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function skip()
|
||||||
|
{
|
||||||
|
[ -n "$1" ] && echo "$1"
|
||||||
|
echo "Test skipped."
|
||||||
|
cleanup
|
||||||
|
exit 77
|
||||||
|
}
|
||||||
|
|
||||||
function valgrind_setup()
|
function valgrind_setup()
|
||||||
{
|
{
|
||||||
command -v valgrind >/dev/null || fail "Cannot find valgrind."
|
command -v valgrind >/dev/null || fail "Cannot find valgrind."
|
||||||
@@ -62,7 +70,7 @@ function exp_pass()
|
|||||||
}
|
}
|
||||||
|
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||||
|
|
||||||
# initial test constructed acccording to current cryptsetup content
|
# initial test constructed acccording to current cryptsetup content
|
||||||
|
|||||||
@@ -281,6 +281,7 @@ function add_scsi_device() {
|
|||||||
|
|
||||||
export LANG=C
|
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."
|
[ $(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."
|
[ -z "$LOOPDEV" ] && skip "WARNING: Cannot find free loop device, test skipped."
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ check_sector_size() # $1 expected sector size
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
if [ $(id -u) != 0 ]; then
|
if [ $(id -u) != 0 ]; then
|
||||||
skip "You must be root to run this test, test skipped."
|
skip "You must be root to run this test, test skipped."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ fail()
|
|||||||
exit 100
|
exit 100
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip()
|
||||||
|
{
|
||||||
|
[ -n "$1" ] && echo "$1"
|
||||||
|
exit 77
|
||||||
|
}
|
||||||
|
|
||||||
add_device() {
|
add_device() {
|
||||||
rmmod scsi_debug >/dev/null 2>&1
|
rmmod scsi_debug >/dev/null 2>&1
|
||||||
if [ -d /sys/module/scsi_debug ] ; then
|
if [ -d /sys/module/scsi_debug ] ; then
|
||||||
@@ -54,6 +60,7 @@ function check_version()
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
if [ $(id -u) != 0 ]; then
|
if [ $(id -u) != 0 ]; then
|
||||||
echo "WARNING: You must be root to run this test, test skipped."
|
echo "WARNING: You must be root to run this test, test skipped."
|
||||||
exit 77
|
exit 77
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ add_device() {
|
|||||||
[ -b $DEV ] || fail "Cannot find $DEV."
|
[ -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."
|
[ $(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 dmsetup >/dev/null || skip "Cannot find dmsetup, test skipped"
|
||||||
command -v keyctl >/dev/null || skip "Cannot find keyctl, test skipped"
|
command -v keyctl >/dev/null || skip "Cannot find keyctl, test skipped"
|
||||||
|
|||||||
@@ -226,6 +226,8 @@ function expect_run()
|
|||||||
expect "$@"
|
expect "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
|
|
||||||
bin_check jq
|
bin_check jq
|
||||||
bin_check sha256sum
|
bin_check sha256sum
|
||||||
bin_check xxd
|
bin_check xxd
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ function valgrind_run()
|
|||||||
INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
|
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
|
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||||
|
|
||||||
command -v jq >/dev/null || skip "Cannot find jq, test skipped."
|
command -v jq >/dev/null || skip "Cannot find jq, test skipped."
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ function fail()
|
|||||||
cleanup 2
|
cleanup 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip()
|
||||||
|
{
|
||||||
|
echo "TEST SKIPPED: $1"
|
||||||
|
cleanup 77
|
||||||
|
}
|
||||||
|
|
||||||
crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
|
crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
|
||||||
{
|
{
|
||||||
DEV2=$DEV_NAME"_x"
|
DEV2=$DEV_NAME"_x"
|
||||||
@@ -95,6 +101,7 @@ crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
|
|||||||
dmremove $DEV2
|
dmremove $DEV2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||||
if [ $(id -u) != 0 ]; then
|
if [ $(id -u) != 0 ]; then
|
||||||
echo "WARNING: You must be root to run this test, test skipped."
|
echo "WARNING: You must be root to run this test, test skipped."
|
||||||
exit 77
|
exit 77
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ check_dump()
|
|||||||
[ "$keyslot_dump" = "$keyslot" ] || fail " keyslot check from dump failed."
|
[ "$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."
|
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
|
||||||
|
|
||||||
# Prevent running dangerous useradd operation by default
|
# Prevent running dangerous useradd operation by default
|
||||||
|
|||||||
Reference in New Issue
Block a user