1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

tests: cleanup msg

This commit is contained in:
Zdenek Kabelac 2017-07-06 11:04:07 +02:00
parent 73bbd5528c
commit 408e3b84f6

View File

@ -52,12 +52,12 @@ create_dlm_conf() {
prepare_dlm() { prepare_dlm() {
if pgrep dlm_controld ; then if pgrep dlm_controld ; then
echo "Cannot run while existing dlm_controld process exists" echo "Cannot run while existing dlm_controld process exists."
exit 1 exit 1
fi fi
if pgrep corosync; then if pgrep corosync; then
echo "Cannot run while existing corosync process exists" echo "Cannot run while existing corosync process exists."
exit 1 exit 1
fi fi
@ -67,14 +67,14 @@ prepare_dlm() {
systemctl start corosync systemctl start corosync
sleep 1 sleep 1
if ! pgrep corosync; then if ! pgrep corosync; then
echo "Failed to start corosync" echo "Failed to start corosync."
exit 1 exit 1
fi fi
systemctl start dlm systemctl start dlm
sleep 1 sleep 1
if ! pgrep dlm_controld; then if ! pgrep dlm_controld; then
echo "Failed to start dlm" echo "Failed to start dlm."
exit 1 exit 1
fi fi
} }
@ -286,7 +286,7 @@ lvmpolld_talk() {
use=socat use=socat
elif echo | not nc -U "$TESTDIR/lvmpolld.socket" ; then elif echo | not nc -U "$TESTDIR/lvmpolld.socket" ; then
echo "WARNING: Neither socat nor nc -U seems to be available." 1>&2 echo "WARNING: Neither socat nor nc -U seems to be available." 1>&2
echo "# failed to contact lvmpolld" echo "## failed to contact lvmpolld."
return 1 return 1
fi fi
@ -302,15 +302,15 @@ lvmpolld_dump() {
} }
prepare_lvmdbusd() { prepare_lvmdbusd() {
local daemon= local daemon
rm -f debug.log_LVMDBUSD_out rm -f debug.log_LVMDBUSD_out
kill_sleep_kill_ LOCAL_LVMDBUSD 0 kill_sleep_kill_ LOCAL_LVMDBUSD 0
# FIXME: This is not correct! Daemon is auto started. # FIXME: This is not correct! Daemon is auto started.
echo "checking lvmdbusd is NOT running..." echo -n "## checking lvmdbusd is NOT running..."
if pgrep -f -l lvmdbusd | grep python3 ; then if pgrep -f -l lvmdbusd | grep python3 ; then
skip "Cannot run while existing lvmdbusd process exists" skip "Cannot run lvmdbusd while existing lvmdbusd process exists"
fi fi
echo ok echo ok
@ -323,7 +323,7 @@ prepare_lvmdbusd() {
else else
daemon=$(which lvmdbusd || :) daemon=$(which lvmdbusd || :)
fi fi
[[ -n "$daemon" && -x "$daemon" ]] || skip "The daemon is missing" test -x "$daemon" || skip "The lvmdbusd daemon is missing"
which python3 >/dev/null || skip "Missing python3" which python3 >/dev/null || skip "Missing python3"
python3 -c "import pyudev, dbus, gi.repository" || skip "Missing python modules" python3 -c "import pyudev, dbus, gi.repository" || skip "Missing python modules"
@ -334,14 +334,14 @@ prepare_lvmdbusd() {
install -m 644 "$abs_top_builddir/scripts/com.redhat.lvmdbus1.conf" /etc/dbus-1/system.d/ install -m 644 "$abs_top_builddir/scripts/com.redhat.lvmdbus1.conf" /etc/dbus-1/system.d/
fi fi
echo "preparing lvmdbusd..." echo "## preparing lvmdbusd..."
lvmconf "global/notify_dbus = 1" lvmconf "global/notify_dbus = 1"
"$daemon" --debug > debug.log_LVMDBUSD_out 2>&1 & "$daemon" --debug > debug.log_LVMDBUSD_out 2>&1 &
local pid=$! local pid=$!
sleep 1 sleep 1
echo "checking lvmdbusd IS running..." echo -n "## checking lvmdbusd IS running..."
if ! pgrep -f -l lvmdbusd | grep python3; then if ! pgrep -f -l lvmdbusd | grep python3; then
echo "Failed to start lvmdbusd daemon" echo "Failed to start lvmdbusd daemon"
return 1 return 1
@ -397,7 +397,7 @@ teardown_devs_prefixed() {
local mounts=( $(grep "$prefix" /proc/mounts | cut -d' ' -f1) ) local mounts=( $(grep "$prefix" /proc/mounts | cut -d' ' -f1) )
if test ${#mounts[@]} -gt 0; then if test ${#mounts[@]} -gt 0; then
test "$stray" -eq 0 || echo "Removing stray mounted devices containing $prefix:" "${mounts[@]}" test "$stray" -eq 0 || echo "## removing stray mounted devices containing $prefix:" "${mounts[@]}"
if umount -fl "${mounts[@]}"; then if umount -fl "${mounts[@]}"; then
udev_wait udev_wait
fi fi
@ -424,7 +424,7 @@ teardown_devs_prefixed() {
local num_remaining_devs=999 local num_remaining_devs=999
while num_devs=$(dm_table | grep -c "$prefix") && \ while num_devs=$(dm_table | grep -c "$prefix") && \
test "$num_devs" -lt "$num_remaining_devs" -a "$num_devs" -ne 0; do test "$num_devs" -lt "$num_remaining_devs" -a "$num_devs" -ne 0; do
test "$stray" -eq 0 || echo "Removing $num_devs stray mapped devices with names beginning with $prefix: " test "$stray" -eq 0 || echo "## removing $num_devs stray mapped devices with names beginning with $prefix: "
# HACK: sort also by minors - so we try to close 'possibly later' created device first # HACK: sort also by minors - so we try to close 'possibly later' created device first
for dm in $(dm_info name --sort open,-minor | grep "$prefix") ; do for dm in $(dm_info name --sort open,-minor | grep "$prefix") ; do
dmsetup remove -f "$dm" || true dmsetup remove -f "$dm" || true
@ -460,7 +460,7 @@ teardown_devs() {
local stray_loops=( $(losetup -a | grep "$COMMON_PREFIX" | cut -d: -f1) ) local stray_loops=( $(losetup -a | grep "$COMMON_PREFIX" | cut -d: -f1) )
test ${#stray_loops[@]} -eq 0 || { test ${#stray_loops[@]} -eq 0 || {
teardown_devs_prefixed "$COMMON_PREFIX" 1 teardown_devs_prefixed "$COMMON_PREFIX" 1
echo "Removing stray loop devices containing $COMMON_PREFIX:" "${stray_loops[@]}" echo "## removing stray loop devices containing $COMMON_PREFIX:" "${stray_loops[@]}"
for i in "${stray_loops[@]}" ; do test ! -b "$i" || losetup -d "$i" || true ; done for i in "${stray_loops[@]}" ; do test ! -b "$i" || losetup -d "$i" || true ; done
# Leave test when udev processed all removed devices # Leave test when udev processed all removed devices
udev_wait udev_wait
@ -501,7 +501,7 @@ kill_tagged_processes() {
rm -f PIDS rm -f PIDS
print_procs_by_tag_ "$@" | while read -r pid wait; do print_procs_by_tag_ "$@" | while read -r pid wait; do
if test -n "$pid" ; then if test -n "$pid" ; then
echo "Killing tagged process: $pid ${wait:0:120}..." echo "## killing tagged process: $pid ${wait:0:120}..."
kill -TERM "$pid" 2>/dev/null || true kill -TERM "$pid" 2>/dev/null || true
fi fi
echo "$pid" >> PIDS echo "$pid" >> PIDS
@ -535,7 +535,7 @@ teardown() {
if test -n "$LVM_TEST_LVMLOCKD_TEST" ; then if test -n "$LVM_TEST_LVMLOCKD_TEST" ; then
echo "" echo ""
echo "stopping lvmlockd in teardown" echo "## stopping lvmlockd in teardown"
killall lvmlockd killall lvmlockd
sleep 1 sleep 1
killall lvmlockd || true killall lvmlockd || true
@ -549,7 +549,7 @@ teardown() {
# Avoid activation of dmeventd if there is no pid # Avoid activation of dmeventd if there is no pid
cfg=$(test -s LOCAL_DMEVENTD || echo "--config activation{monitoring=0}") cfg=$(test -s LOCAL_DMEVENTD || echo "--config activation{monitoring=0}")
if dm_info suspended,name | grep -q "^Suspended:.*$prefix" ; then if dm_info suspended,name | grep -q "^Suspended:.*$prefix" ; then
echo "Skipping vgremove, suspended devices detected." echo "## skipping vgremove, suspended devices detected."
else else
vgremove -ff "$cfg" \ vgremove -ff "$cfg" \
"$vg" "$vg1" "$vg2" "$vg3" "$vg4" &>/dev/null || rm -f debug.log strace.log "$vg" "$vg1" "$vg2" "$vg3" "$vg4" &>/dev/null || rm -f debug.log strace.log
@ -579,7 +579,7 @@ teardown() {
fi fi
test -z "$TEST_LEAKED_DEVICES" || { test -z "$TEST_LEAKED_DEVICES" || {
echo "Unexpected devices left dm table:" echo "## unexpected devices left dm table:"
echo "$TEST_LEAKED_DEVICES" echo "$TEST_LEAKED_DEVICES"
return 1 return 1
} }
@ -1234,7 +1234,7 @@ lvmconf() {
test "$val" = "$i" || { needed=1; break; } test "$val" = "$i" || { needed=1; break; }
done done
test "$needed" -eq 0 && { test "$needed" -eq 0 && {
echo "## LVMCONF: values are already there, skipping." echo "## Skipping reconfiguring for: (" "$@" ")"
return 0 # not needed return 0 # not needed
} }
} }