From b52496b7af37d8fbf358655b0e7c46e398ad9682 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Thu, 6 May 2010 18:54:51 +0000 Subject: [PATCH] Add some basic provisions for automated testing of dmeventd. --- test/Makefile.in | 5 +++++ test/test-utils.sh | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/test/Makefile.in b/test/Makefile.in index 3c1230f58..9bd8b0bdd 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -78,7 +78,11 @@ init.sh: $(srcdir)/Makefile.in .bin-dir-stamp bin/not bin/check bin/harness $(SC echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@-t echo 'PATH=$$abs_top_builddir/test/bin:$$PATH' >> $@-t LDLPATH="\$$abs_top_builddir/libdm"; \ + LDLPATH="$$LDLPATH:\$$abs_top_builddir/tools"; \ LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd"; \ + LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd/plugins/lvm2"; \ + LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd/plugins/mirror"; \ + LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd/plugins/snapshot"; \ echo "export LD_LIBRARY_PATH=\"$$LDLPATH\"" >> $@-t echo 'abs_srcdir=$(abs_srcdir)' >> $@-t echo 'abs_builddir=$(abs_builddir)' >> $@-t @@ -99,6 +103,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status done ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" bin/clvmd + ln -s "$(abs_top_builddir)/daemons/dmeventd/dmeventd" bin/dmeventd touch $@ lvm-wrapper: Makefile diff --git a/test/test-utils.sh b/test/test-utils.sh index 2f0b1dab6..3825137df 100644 --- a/test/test-utils.sh +++ b/test/test-utils.sh @@ -72,6 +72,22 @@ prepare_clvmd() { LOCAL_CLVMD="$!" } +prepare_dmeventd() { + if pgrep dmeventd ; then + echo "Cannot test dmeventd with real dmeventd ($(pgrep clvmd)) running." + exit 200 + fi + + # skip if we don't have our own dmeventd... + (which dmeventd | grep $abs_builddir) || exit 200 + + trap_teardown + + dmeventd -d & + LOCAL_DMEVENTD="$!" + strace -p $LOCAL_DMEVENTD & +} + prepare_testroot() { OLDPWD="`pwd`" PREFIX="LVMTEST$$" @@ -127,6 +143,8 @@ teardown() { kill -9 "$LOCAL_CLVMD" || true } + test -n "$LOCAL_DMEVENTD" && kill -9 "$LOCAL_DMEVENTD" + teardown_devs test -n "$TESTDIR" && { -- 2.43.5