diff options
author | Marian Csontos <mcsontos@redhat.com> | 2016-03-08 10:19:36 +0100 |
---|---|---|
committer | Marian Csontos <mcsontos@redhat.com> | 2016-03-08 10:19:36 +0100 |
commit | c6ffcdadbd54dc67da43b6f34366f44301114438 (patch) | |
tree | 17af91ab45fb7332e0caacd81c076884b3fd1b01 | |
parent | c3e97a096701472cf8c0eaec4392de9027acb535 (diff) | |
download | lvm2-dev-mcsontos-test-dbusd-2.tar.gz |
[WIP] test: Add _prepare_lvmdbusddev-mcsontos-test-dbusd-2
-rw-r--r-- | test/api/dbustest.sh | 12 | ||||
-rw-r--r-- | test/lib/aux.sh | 36 |
2 files changed, 44 insertions, 4 deletions
diff --git a/test/api/dbustest.sh b/test/api/dbustest.sh index e4f00ecfc..4df0e0a37 100644 --- a/test/api/dbustest.sh +++ b/test/api/dbustest.sh @@ -30,6 +30,13 @@ fi # Setup the python path so we can run export PYTHONPATH=$abs_top_builddir/daemons +if true; then + +aux _prepare_lvmdbusd +$abs_top_builddir/test/dbus/lvmdbustest.py -v + +else + # Start the dbus service $abs_top_builddir/daemons/lvmdbusd/lvmdbusd --debug --udev > debug.log_lvmdbusd 2>&1 & @@ -39,9 +46,10 @@ 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" + echo "Failed to start lvmdbusd daemon" exit 1 fi +END # Run all the unit tests $abs_top_builddir/test/dbus/lvmdbustest.py -v || fail=$? @@ -57,3 +65,5 @@ kill $LVM_DBUS_PID || { wait exit ${fail:-"0"} + +fi diff --git a/test/lib/aux.sh b/test/lib/aux.sh index ff195f149..f58fc754f 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -304,16 +304,42 @@ lvmpolld_dump() { } _prepare_lvmdbusd() { - rm -f debug.log_lvmdbusd + rm -f debug.log_LVMDBUSD_out + + ps -elf | grep lvmdbus + pgrep lvmdbusd + pgrep -f lvmdbusd + if pgrep lvmdbusd ; then + echo "Cannot run while existing lvmdbusd process exists" + exit 1 + fi + # skip if we don't have our own lvmdbusd... (which lvmdbusd 2>/dev/null | grep "$abs_builddir") || skip kill_sleep_kill_ LOCAL_LVMDBUSD 0 echo "preparing lvmdbusd..." - lvmdbusd -f "$@" -s "$TESTDIR/lvmdbusd.socket" -B "$TESTDIR/lib/lvm" -l all & + $abs_top_builddir/daemons/lvmdbusd/lvmdbusd --debug --udev > debug.log_LVMDBUSD_out 2>&1 & echo $! > LOCAL_LVMDBUSD - while ! test -e "$TESTDIR/lvmdbusd.socket"; do echo -n .; sleep .1; done # wait for the socket + + sleep 1 + ps -elf | grep lvmdbus + pgrep lvmdbusd + pgrep -f lvmdbusd + + # TODO: Is there a better check than wait 1s and check pid? + # NOTE: lvmdbusd will be enabled only on RHEL7+ and F24+ supporting `$(< file)` + if ! ps -p $(< LOCAL_LVMDBUSD) -o comm= >/dev/null || [[ $(ps -p $(< LOCAL_LVMDBUSD) -o comm=) != lvmdbusd ]]; then + rm -f LOCAL_LVMDBUSD + echo "Failed to start lvmdbusd daemon" + return 1 + fi + if ! pgrep lvmdbusd; then + rm -f LOCAL_LVMDBUSD + echo "Failed to start lvmdbusd" + return 1 + fi echo ok } @@ -481,6 +507,10 @@ teardown() { fi } + kill_sleep_kill_ LOCAL_LVMDBUSD ${LVM_VALGRIND_LVMDBUSD:-0} + + echo -n . + kill_sleep_kill_ LOCAL_LVMPOLLD ${LVM_VALGRIND_LVMPOLLD:-0} echo -n . |