summaryrefslogtreecommitdiff
path: root/test/api/dbustest.sh
blob: e4f00ecfc8526abbeb9b431c87f2654f9b05c73d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/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_LVMLOCKD=1
SKIP_WITH_CLVMD=1

. lib/inittest

# Will default to skip until we can get this reviewed
#skip

aux prepare_pvs 6

# 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

# Start the dbus service
$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
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
$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

echo "Stopping service"
kill $LVM_DBUS_PID || {
	sleep 1
        kill -9 $LVM_DBUS_PID
}
wait

exit ${fail:-"0"}