]> sourceware.org Git - lvm2.git/commitdiff
test: Fix lvmdbusd tests to work with installed testsuite
authorMarian Csontos <mcsontos@redhat.com>
Wed, 23 Mar 2016 10:56:25 +0000 (11:56 +0100)
committerMarian Csontos <mcsontos@redhat.com>
Wed, 23 Mar 2016 10:59:04 +0000 (11:59 +0100)
test/Makefile.in
test/api/dbustest.sh
test/lib/aux.sh

index 43e321d76bdb90b3f31f1bc62bd3df09c0d858ff..ded155ddf689af0a3bb6a71836297efd368f5c64 100644 (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
index dd9b23d03c659b76bfc9b241b2e7c3091e952ebd..79e3224c4f7174f15616c2d7fec8cbf98fad25bc 100644 (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
index ed1e3d827888a59d152a2839e0ff82b253bbf615..4f5daaf56b42f46161270529e107a7a45d988ffd 100644 (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...
-       # NOTE: this is always present - additional checks are needed:
-       [[ -x $abs_top_builddir/daemons/lvmdbusd/lvmdbusd ]] || skip
+       if test -z "${installed_testsuite+varset}"; then
+               # NOTE: this is always present - additional checks are needed:
+               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
This page took 0.043307 seconds and 5 git commands to generate.