Skip to contentSkip to conversation

master - dbustest.sh: Get dbus test to work on buildbot

PATCH tasleson 1 participant 1 message Mar 4, 2016

lore
Share & tools
lore

tasleson

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f94fe2c91fc995e2d57f7689f01d8d15d72858cc
Commit:        f94fe2c91fc995e2d57f7689f01d8d15d72858cc
Parent:        9720898c8ee3a4035858508b38179a143d948f4f
Author:        Marian Csontos <[email protected]>
AuthorDate:    Tue Feb 23 09:13:01 2016 +0100
Committer:     Tony Asleson <[email protected]>
CommitterDate: Fri Mar 4 10:11:03 2016 -0600

dbustest.sh: Get dbus test to work on buildbot

- stdout/stderr for test output
- debug.log* for daemon output
- use install instead of cp for DBus config
- use system bus
- DBus reloads on new file. Better having it created with correct permissions.

Notes:
- Squashed commits from mcsontos development branch
- Still disabled at this time

---
 test/api/dbustest.sh |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)
test/api/dbustest.sh +14 -16
index b4e3964..ba3173e 100644
@@ -21,18 +21,17 @@ skip
 
 aux prepare_pvs 6
 
-# This allows us to run without installing
-# com.redhat.lvmdbus1.conf to /etc/dbus-1/system.d/
-# but in normal operation it needs to be on system bus
-export LVMDBUSD_USE_SESSION="True"
+# Copy the needed file to run on the system bus if it doesn't
+# already exist
+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
 
-# Where should we be logging the output of the daemon when not running as
-# a systemd service
 # Start the dbus service
-$abs_top_builddir/daemons/lvmdbusd/lvmdbusd --debug --udev > /tmp/lvmdbusd.log 2>&1 &
+$abs_top_builddir/daemons/lvmdbusd/lvmdbusd --debug --udev > debug.log_lvmdbusd 2>&1 &
 
 # Give the service some time to start before we try to run the
 # unit test
@@ -45,17 +44,16 @@ if [ "CHK${LVM_DBUS_PID}" == "CHK" ];then
 fi
 
 # Run all the unit tests
-# Are we already logging stdout & stderror?
-$abs_top_builddir/test/dbus/lvmdbustest.py -v > /tmp/lvmdbustest.log 2>&1
+$abs_top_builddir/test/dbus/lvmdbustest.py -v || fail=$?
 
 # We can run individual unit tests by doing this
 # $abs_top_builddir/test/dbus/lvmdbustest.py -v TestDbusService.test_snapshot_merge
 
-# I'm guessing there is a better way to handle this with the built in test env.
-if [ $? -eq 0 ]; then
-	rm -f /tmp/lvmdbusd.log
-	rm -f /tmp/lvmdbustest.log
-fi
-
 echo "Stopping service"
-kill $LVM_DBUS_PID
+kill $LVM_DBUS_PID || {
+	sleep 1
+        kill -9 $LVM_DBUS_PID
+}
+wait
+
+exit ${fail:-"0"}