summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-01-14 16:12:46 -0600
committerDavid Teigland <teigland@redhat.com>2016-02-22 09:36:35 -0600
commit161ae36363f5fa1b1469fd3a42c096c878002b31 (patch)
treedc0eb4eb86edb8bcf9dc30a60989ec46372fc67d
parented5e5c38b5ac4b7c8cb7e809d9d35c72f087e29e (diff)
downloadlvm2-161ae36363f5fa1b1469fd3a42c096c878002b31.tar.gz
test: add make check_lvmlockd_test
Which runs lvmlockd in --test mode, without any lock manager. Also make some adjustments to the check_lvmlockd variations using the lock managds.
-rw-r--r--daemons/lvmlockd/lvmlockd-core.c5
-rw-r--r--test/Makefile.in21
-rw-r--r--test/lib/flavour-udev-lvmlockd-test.sh6
-rw-r--r--test/lib/test-sanlock-conf2
-rw-r--r--test/shell/aa-lvmlockd-dlm-prepare.sh (renamed from test/shell/dlm-prepare.sh)0
-rw-r--r--test/shell/aa-lvmlockd-sanlock-prepare.sh (renamed from test/shell/sanlock-prepare.sh)6
-rw-r--r--test/shell/aa-lvmlockd-test-prepare.sh44
-rw-r--r--test/shell/lvmlockd-lv-types.sh6
-rw-r--r--test/shell/zz-lvmlockd-dlm-remove.sh (renamed from test/shell/dlm-remove.sh)0
-rw-r--r--test/shell/zz-lvmlockd-sanlock-remove.sh (renamed from test/shell/sanlock-remove.sh)6
-rw-r--r--test/shell/zz-lvmlockd-test-remove.sh23
11 files changed, 100 insertions, 19 deletions
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 292d19cc4..76a7650b1 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -3365,6 +3365,11 @@ static void *worker_thread_main(void *arg_in)
int run_sanlock = lm_is_running_sanlock();
int run_dlm = lm_is_running_dlm();
+ if (daemon_test) {
+ run_sanlock = gl_use_sanlock;
+ run_dlm = gl_use_dlm;
+ }
+
if (run_sanlock && run_dlm)
act->result = -EXFULL;
else if (!run_sanlock && !run_dlm)
diff --git a/test/Makefile.in b/test/Makefile.in
index 742399bde..19a02146f 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -74,6 +74,7 @@ help:
@echo " check_lvmpolld Run tests with lvmpolld daemon."
@echo " check_lvmlockd_sanlock Run tests with lvmlockd and sanlock."
@echo " check_lvmlockd_dlm Run tests with lvmlockd and dlm."
+ @echo " check_lvmlockd_test Run tests with lvmlockd --test."
@echo " clean Clean dir."
@echo " help Display callable targets."
@echo -e "\nSupported variables:"
@@ -146,26 +147,21 @@ ifeq ("@BUILD_LVMLOCKD@", "yes")
check_lvmlockd_sanlock: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir results \
- --flavours udev-lvmlockd-sanlock --only shell/sanlock-prepare.sh
- VERBOSE=$(VERBOSE) ./lib/runner \
- --testdir . --outdir results \
- --flavours udev-lvmlockd-sanlock --only $(T) --skip $(S)
- VERBOSE=$(VERBOSE) ./lib/runner \
- --testdir . --outdir results \
- --flavours udev-lvmlockd-sanlock --only shell/sanlock-remove.sh
+ --flavours udev-lvmlockd-sanlock --only shell/aa-lvmlockd-sanlock-prepare.sh,$(T),shell/zz-lvmlockd-sanlock-remove.sh --skip $(S)
endif
ifeq ("@BUILD_LVMLOCKD@", "yes")
check_lvmlockd_dlm: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir results \
- --flavours udev-lvmlockd-dlm --only shell/dlm-prepare.sh
- VERBOSE=$(VERBOSE) ./lib/runner \
- --testdir . --outdir results \
- --flavours udev-lvmlockd-dlm --only $(T) --skip $(S)
+ --flavours udev-lvmlockd-dlm --only shell/aa-lvmlockd-dlm-prepare.sh,$(T),shell/zz-lvmlockd-dlm-remove.sh --skip $(S)
+endif
+
+ifeq ("@BUILD_LVMLOCKD@", "yes")
+check_lvmlockd_test: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir results \
- --flavours udev-lvmlockd-dlm --only shell/dlm-remove.sh
+ --flavours udev-lvmlockd-test --only shell/aa-lvmlockd-test-prepare.sh,$(T),shell/zz-lvmlockd-test-remove.sh --skip $(S)
endif
DATADIR = $(datadir)/lvm2-testsuite
@@ -185,6 +181,7 @@ LIB_FLAVOURS = \
flavour-udev-lvmpolld\
flavour-udev-lvmlockd-sanlock\
flavour-udev-lvmlockd-dlm\
+ flavour-udev-lvmlockd-test\
flavour-udev-vanilla
LIB_LVMLOCKD_CONF = \
diff --git a/test/lib/flavour-udev-lvmlockd-test.sh b/test/lib/flavour-udev-lvmlockd-test.sh
new file mode 100644
index 000000000..60b67b1a8
--- /dev/null
+++ b/test/lib/flavour-udev-lvmlockd-test.sh
@@ -0,0 +1,6 @@
+export LVM_TEST_LOCKING=1
+export LVM_TEST_LVMETAD=1
+export LVM_TEST_LVMPOLLD=1
+export LVM_TEST_LVMLOCKD=1
+export LVM_TEST_LVMLOCKD_TEST=1
+export LVM_TEST_DEVDIR=/dev
diff --git a/test/lib/test-sanlock-conf b/test/lib/test-sanlock-conf
index d1df598b0..6285d6397 100644
--- a/test/lib/test-sanlock-conf
+++ b/test/lib/test-sanlock-conf
@@ -1,2 +1,2 @@
# created by lvm test suite
-SANLOCKOPTS="-U sanlock -G sanlock -w 0"
+use_watchdog=0
diff --git a/test/shell/dlm-prepare.sh b/test/shell/aa-lvmlockd-dlm-prepare.sh
index e1e1a73d0..e1e1a73d0 100644
--- a/test/shell/dlm-prepare.sh
+++ b/test/shell/aa-lvmlockd-dlm-prepare.sh
diff --git a/test/shell/sanlock-prepare.sh b/test/shell/aa-lvmlockd-sanlock-prepare.sh
index aabd9f604..22127adc3 100644
--- a/test/shell/sanlock-prepare.sh
+++ b/test/shell/aa-lvmlockd-sanlock-prepare.sh
@@ -16,7 +16,7 @@ test_description='Set up things to run tests with sanlock'
[ -z "$LVM_TEST_LOCK_TYPE_SANLOCK" ] && skip;
-SANLOCK_CONF="/etc/sysconfig/sanlock"
+SANLOCK_CONF="/etc/sanlock/sanlock.conf"
create_sanlock_conf() {
if test -a $SANLOCK_CONF; then
if ! grep "created by lvm test suite" $SANLOCK_CONF; then
@@ -43,9 +43,7 @@ prepare_lvmlockd_sanlock() {
create_sanlock_conf
- # FIXME: use 'systemctl start sanlock' once we can pass options
- sanlock daemon -U sanlock -G sanlock -w 0 -e testhostname
- sleep 1
+ systemctl start sanlock
if ! pgrep sanlock; then
echo "Failed to start sanlock"
exit 1
diff --git a/test/shell/aa-lvmlockd-test-prepare.sh b/test/shell/aa-lvmlockd-test-prepare.sh
new file mode 100644
index 000000000..99ec86fa9
--- /dev/null
+++ b/test/shell/aa-lvmlockd-test-prepare.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Copyright (C) 2008-2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+test_description='Set up things to run tests with lvmlockd'
+
+. lib/utils
+. lib/inittest
+
+[ -z "$LVM_TEST_LVMLOCKD_TEST" ] && skip;
+
+# TODO: allow this to be configured sanlock/dlm
+LVM_TEST_LVMLOCKD_TEST_DLM=1
+
+prepare_lvmlockd_test() {
+ if pgrep lvmlockd ; then
+ echo "Cannot run while existing lvmlockd process exists"
+ exit 1
+ fi
+
+ if test -n "$LVM_TEST_LVMLOCKD_TEST_SANLOCK"; then
+ lvmlockd --test -g sanlock
+ fi
+
+ if test -n "$LVM_TEST_LVMLOCKD_TEST_DLM"; then
+ lvmlockd --test -g dlm
+ fi
+
+ sleep 1
+ if ! pgrep lvmlockd ; then
+ echo "Failed to start lvmlockd"
+ exit 1
+ fi
+}
+
+prepare_lvmlockd_test
+
diff --git a/test/shell/lvmlockd-lv-types.sh b/test/shell/lvmlockd-lv-types.sh
index 70c856ed2..8e12776fd 100644
--- a/test/shell/lvmlockd-lv-types.sh
+++ b/test/shell/lvmlockd-lv-types.sh
@@ -27,6 +27,12 @@ LOCKARGS2="dlm"
LOCKARGS3="dlm"
fi
+if test -n "$LVM_TEST_LVMLOCKD_TEST" ; then
+LOCKARGS1="dlm"
+LOCKARGS2="dlm"
+LOCKARGS3="dlm"
+fi
+
aux prepare_devs 5
vgcreate --shared $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
diff --git a/test/shell/dlm-remove.sh b/test/shell/zz-lvmlockd-dlm-remove.sh
index 3848c0e4f..3848c0e4f 100644
--- a/test/shell/dlm-remove.sh
+++ b/test/shell/zz-lvmlockd-dlm-remove.sh
diff --git a/test/shell/sanlock-remove.sh b/test/shell/zz-lvmlockd-sanlock-remove.sh
index e22aae8f6..ae5bdefd4 100644
--- a/test/shell/sanlock-remove.sh
+++ b/test/shell/zz-lvmlockd-sanlock-remove.sh
@@ -27,10 +27,12 @@ vgremove --config 'devices { global_filter=["a|GL_DEV|", "r|.*|"] filter=["a|GL_
# sanlock log_dump > sanlock-debug.txt
killall lvmlockd
+sleep 1
killall sanlock
+sleep 1
-killall -9 lvmlockd
-killall -9 sanlock
+killall -9 lvmlockd || true
+killall -9 sanlock || true
# FIXME: dmsetup remove LVMTEST*-lvmlock
diff --git a/test/shell/zz-lvmlockd-test-remove.sh b/test/shell/zz-lvmlockd-test-remove.sh
new file mode 100644
index 000000000..44749f00d
--- /dev/null
+++ b/test/shell/zz-lvmlockd-test-remove.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Copyright (C) 2008-2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+test_description='Remove the dlm test setup'
+
+. lib/inittest
+
+[ -z "$LVM_TEST_LVMLOCKD_TEST" ] && skip;
+
+killall lvmlockd
+sleep 1
+killall lvmlockd || true
+sleep 1
+killall -9 lvmlockd || true
+