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

test: Fix lvmdbusd tests to work with installed testsuite

This commit is contained in:
Marian Csontos 2016-03-23 11:56:25 +01:00
parent c1d376b1ab
commit bb93a28bc1
3 changed files with 17 additions and 9 deletions

View File

@ -205,6 +205,7 @@ install: .tests-stamp lib/paths-installed
$(INSTALL_DATA) shell/*.sh $(DATADIR)/shell
$(INSTALL_DATA) api/*.sh $(DATADIR)/api
$(INSTALL_PROGRAM) api/*.{t,py} $(DATADIR)/api
$(INSTALL_PROGRAM) dbus/*.py $(DATADIR)/dbus/
$(INSTALL_DATA) lib/paths-installed $(DATADIR)/lib/paths
cd lib && $(INSTALL_DATA) \
$(LIB_FLAVOURS) \
@ -274,12 +275,14 @@ lib/paths-installed: lib/paths-common
$(RM) $@-t
cat lib/paths-common > $@-t
echo 'installed_testsuite=1' >> $@-t
echo 'test_data_dir="@datadir@/lvm2-testsuite"' >> $@-t
echo 'export PATH=@libexecdir@/lvm2-testsuite:@datadir@/lvm2-testsuite/lib:@datadir@/lvm2-testsuite/api:$$PATH' >> $@-t
mv $@-t $@
lib/paths: lib/paths-common
$(RM) $@-t
cat lib/paths-common > $@-t
echo 'test_data_dir="$(abs_top_builddir)/test"' >> $@-t
echo 'top_srcdir="$(top_srcdir)"' >> $@-t
echo 'abs_top_builddir="$(abs_top_builddir)"' >> $@-t
echo 'abs_top_srcdir="$(abs_top_srcdir)"' >> $@-t

View File

@ -27,8 +27,5 @@ if [ ! -f /etc/dbus-1/system.d/com.redhat.lvmdbus1.conf ]; then
install -m 644 $abs_top_builddir/scripts/com.redhat.lvmdbus1.conf /etc/dbus-1/system.d/.
fi
# Setup the python path so we can run
export PYTHONPATH=$abs_top_builddir/daemons
aux prepare_lvmdbusd
$abs_top_builddir/test/dbus/lvmdbustest.py -v
$test_data_dir/dbus/lvmdbustest.py -v

View File

@ -301,8 +301,11 @@ lvmpolld_dump() {
}
prepare_lvmdbusd() {
local daemon=
rm -f debug.log_LVMDBUSD_out
kill_sleep_kill_ LOCAL_LVMDBUSD 0
echo "checking lvmdbusd is NOT running..."
if ps -elf | grep lvmdbusd | grep python3; then
echo "Cannot run while existing lvmdbusd process exists"
@ -311,16 +314,21 @@ prepare_lvmdbusd() {
echo ok
# skip if we don't have our own lvmdbusd...
if test -z "${installed_testsuite+varset}"; then
# NOTE: this is always present - additional checks are needed:
[[ -x $abs_top_builddir/daemons/lvmdbusd/lvmdbusd ]] || skip
daemon="$abs_top_builddir/daemons/lvmdbusd/lvmdbusd"
# Setup the python path so we can run
export PYTHONPATH=$abs_top_builddir/daemons
else
daemon="$(which lvmdbusd)"
fi
[[ -n $daemon && -x $daemon ]] || skip "The daemon is missing"
which python3 >/dev/null || skip "Missing python3"
python3 -c "import pyudev, dbus, gi.repository" || skip "Missing python modules"
kill_sleep_kill_ LOCAL_LVMDBUSD 0
echo "preparing lvmdbusd..."
$abs_top_builddir/daemons/lvmdbusd/lvmdbusd --debug --udev > debug.log_LVMDBUSD_out 2>&1 &
"$daemon" --debug --udev > debug.log_LVMDBUSD_out 2>&1 &
local pid=$!
sleep 1