From: tasleson Date: Mon, 22 Feb 2016 22:11:06 +0000 (UTC) Subject: master - lvmdbusd: Initial unit test driver script Message-ID: <20160222221106.E651F60F39@fedorahosted.org> List-Id: To: lvm-devel@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=05eb87ca2defb6e7e7bd9759bab566de7cb6e3f0 Commit: 05eb87ca2defb6e7e7bd9759bab566de7cb6e3f0 Parent: ecc040688601ec0f4b35f4250e057db13fd847a0 Author: Tony Asleson AuthorDate: Mon Feb 22 16:05:43 2016 -0600 Committer: Tony Asleson CommitterDate: Mon Feb 22 16:07:54 2016 -0600 lvmdbusd: Initial unit test driver script It's disabled until we can fix it up. Signed-off-by: Tony Asleson --- test/api/dbustest.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 0 deletions(-) diff --git a/test/api/dbustest.sh b/test/api/dbustest.sh new file mode 100644 index 0000000..f33add0 --- /dev/null +++ b/test/api/dbustest.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# Copyright (C) 2016 Red Hat, Inc. All rights reserved. +# +# This file is part of LVM2. +# +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +SKIP_WITH_CLVMD=1 + +. lib/inittest + +# Will default to skip until we can get this reviewed +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" + +# 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 & + +# Give the service some time to start before we try to run the +# unit test +sleep 1 + +LVM_DBUS_PID=$(ps aux | grep lvmdbus[d] | awk '{print $2}') +if [ "CHK${LVM_DBUS_PID}" == "CHK" ];then + echo "Failed to start lsmdbusd daemon" + exit 1 +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 + +# 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