. lib/utils
+test -n "$BASH" && set -euE -o pipefail
+
run_valgrind() {
# Execute script which may use $TESTNAME for creating individual
# log files for each execute command
check_daemon_in_builddir dmeventd
lvmconf "activation/monitoring = 1"
- local run_valgrind
+ local run_valgrind=""
test "${LVM_VALGRIND_DMEVENTD:-0}" -eq 0 || run_valgrind="run_valgrind"
echo -n "## preparing dmeventd..."
# LVM_LOG_FILE_EPOCH=DMEVENTD $run_valgrind dmeventd -fddddl "$@" 2>&1 &
prepare_lvmetad() {
check_daemon_in_builddir lvmetad
- local run_valgrind
+ local run_valgrind=""
test "${LVM_VALGRIND_LVMETAD:-0}" -eq 0 || run_valgrind="run_valgrind"
kill_sleep_kill_ LOCAL_LVMETAD "${LVM_VALGRIND_LVMETAD:-0}"
}
teardown() {
- local TEST_LEAKED_DEVICES
+ local TEST_LEAKED_DEVICES=""
echo -n "## teardown..."
unset LVM_LOG_FILE_EPOCH
case "$level" in
"1") coption="--bitmap-chunk" ;;
- "0") unset with_bitmap ;;
+ "0") with_bitmap="" ;;
esac
# Have MD use a non-standard name to avoid colliding with an existing MD device
# - mdadm >= 3.0 requires that non-standard device names be in /dev/md/
disable_dev() {
local dev
- local silent
- local error
- local notify
+ local silent=""
+ local error=""
+ local notify=""
while test -n "$1"; do
if test "$1" = "--silent"; then
enable_dev() {
local dev
- local silent
+ local silent=""
if test "$1" = "--silent"; then
silent=1
# this is a quick way to restore to this table entry
restore_from_devtable() {
local dev
- local silent
+ local silent=""
if test "$1" = "--silent"; then
silent=1
}
local sec
- local last_sec
+ local last_sec=""
# read sequential list and put into associative array
while IFS= read -r v; do
}
lvmconf() {
- unset profile_name
+ local profile_name=""
test $# -eq 0 || {
# Compare if passed args aren't already all in generated lvm.conf
local needed=0
udev_wait() {
pgrep udev >/dev/null || return 0
which udevadm &>/dev/null || return 0
- if test -n "$1" ; then
+ if test -n "${1-}" ; then
udevadm settle --exit-if-exists="$1" || true
else
udevadm settle --timeout=15 || true
wait_for_sync() {
local i
for i in {1..100} ; do
- check in_sync "$1" "$2" "$3" && return
+ check in_sync "$@" && return
sleep .2
done
}
target_at_least dm-thin-pool "$@"
- declare -a CONF
+ declare -a CONF=()
# disable thin_check if not present in system
if test -n "$LVM_TEST_THIN_CHECK_CMD" && test ! -x "$LVM_TEST_THIN_CHECK_CMD"; then
CONF[0]="global/thin_check_executable = \"\""
}
target_at_least dm-cache "$@"
- declare -a CONF
+ declare -a CONF=()
# disable cache_check if not present in system
if test -n "$LVM_TEST_CACHE_CHECK_CMD" -a ! -x "$LVM_TEST_CACHE_CHECK_CMD" ; then
CONF[0]="global/cache_check_executable = \"\""
local retries=${2:-300}
if [ -e LOCAL_LVMPOLLD ]; then
- local lvid
+ local lvid=""
while : ; do
test "$retries" -le 0 && die "Waiting for lvmpolld timed out"
test -n "$lvid" || {
version_at_least "$(uname -r)" "$@"
}
-test -z "$LVM_TEST_AUX_TRACE" || set -x
+test -z "${LVM_TEST_AUX_TRACE-}" || set -x
test -f DEVICES && devs=$(< DEVICES)
PS4='#${BASH_SOURCE[0]##*/}:${LINENO}+ '
export TESTNAME PS4
+LVM_TEST_BACKING_DEVICE=${LVM_TEST_BACKING_DEVICE-}
LVM_TEST_DEVDIR=${LVM_TEST_DEVDIR-}
LVM_TEST_NODEBUG=${LVM_TEST_NODEBUG-}
LVM_TEST_LVM1=${LVM_TEST_LVM1-}
unset CDPATH
+export LVM_TEST_BACKING_DEVICE LVM_TEST_DEVDIR LVM_TEST_NODEBUG
+export LVM_TEST_LVMETAD LVM_TEST_LVMLOCKD LVM_TEST_LVMLOCKD_TEST
+export LVM_TEST_LVMPOLLD LVM_TEST_LOCK_TYPE_DLM LVM_TEST_LOCK_TYPE_SANLOCK
# grab some common utilities
. lib/utils