mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 19:30:04 +01:00
Add valgrind support to more tests.
This commit is contained in:
committed by
Milan Broz
parent
abfb5e374f
commit
429afe8fc3
@@ -9,6 +9,9 @@ KEY_FILE=keyfile
|
||||
|
||||
DEV2=$DEV_NAME"_x"
|
||||
|
||||
CRYPTSETUP_VALGRIND=../.libs/cryptsetup
|
||||
CRYPTSETUP_LIB_VALGRIND=../.libs
|
||||
|
||||
dmremove() { # device
|
||||
udevadm settle >/dev/null 2>&1
|
||||
dmsetup remove --retry $1 >/dev/null 2>&1
|
||||
@@ -35,6 +38,18 @@ skip()
|
||||
cleanup 77
|
||||
}
|
||||
|
||||
function valgrind_setup()
|
||||
{
|
||||
command -v valgrind >/dev/null || fail "Cannot find valgrind."
|
||||
[ ! -f $CRYPTSETUP_VALGRIND ] && fail "Unable to get location of cryptsetup executable."
|
||||
export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
|
||||
}
|
||||
|
||||
function valgrind_run()
|
||||
{
|
||||
INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
|
||||
}
|
||||
|
||||
crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
|
||||
{
|
||||
DEV2=$DEV_NAME"_x"
|
||||
@@ -102,6 +117,7 @@ crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
|
||||
}
|
||||
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||
if [ $(id -u) != 0 ]; then
|
||||
echo "WARNING: You must be root to run this test, test skipped."
|
||||
exit 77
|
||||
|
||||
Reference in New Issue
Block a user