From fb59cf7a5824b9c876737dcbf6aac97c29b1444a Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 29 May 2012 15:49:13 -0600 Subject: [PATCH] build: fix testing of augeas files in VPATH builds Without this fix, a VPATH build (such as used by ./autobuild.sh) fails with messages like: make[3]: Entering directory `/home/remote/eblake/libvirt-tmp2/build/daemon' ../../build-aux/augeas-gentest.pl libvirtd.conf ../../daemon/test_libvirtd.aug.in test_libvirtd.aug cannot read libvirtd.conf: No such file or directory at ../../build-aux/augeas-gentest.pl line 38. Since the test files are not part of the tarball, we can generate them into the build dir, but rather than create a subdirectory just for the test file, it is easier to test them directly in libvirt.git/src. * daemon/Makefile.am (AUG_GENTEST): Factor out definition. (test_libvirtd.aug): Look for correct file. * src/Makefile.am (AUG_GENTEST): Use $(PERL). (qemu/test_libvirtd_qemu.aug, lxc/test_libvirtd_lxc.aug) (locking/test_libvirt_sanlock.aug): Rename to avoid subdirectories. (check-augeas-qemu, check-augeas-lxc, check-augeas-sanlock): Reflect location of built tests. * configure.ac (PERL): Substitute perl. --- .gitignore | 1 + configure.ac | 3 +++ daemon/Makefile.am | 8 +++++--- src/Makefile.am | 44 ++++++++++++++++++++++---------------------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 50ff3bf7d2..d535398622 100644 --- a/.gitignore +++ b/.gitignore @@ -109,6 +109,7 @@ /src/remote/*_protocol.[ch] /src/rpc/virkeepaliveprotocol.[ch] /src/rpc/virnetprotocol.[ch] +/src/test_libvirt*.aug /src/util/virkeymaps.h /src/virt-aa-helper /tests/*.log diff --git a/configure.ac b/configure.ac index 59962c5133..7d8d26b1e6 100644 --- a/configure.ac +++ b/configure.ac @@ -2243,6 +2243,9 @@ AM_CONDITIONAL([WITH_PYTHON], [test "$with_python" = "yes"]) AC_SUBST([PYTHON_VERSION]) AC_SUBST([PYTHON_INCLUDES]) +dnl Allow perl overrides +AC_PATH_PROG([PERL], [perl]) + AC_ARG_ENABLE([with-test-suite], AC_HELP_STRING([--with-test-suite], [build test suite by default @<:@default=check@:>@]), [case "${withval}" in diff --git a/daemon/Makefile.am b/daemon/Makefile.am index daf24ea48a..08e37a9db7 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -351,12 +351,14 @@ libvirtd.service: libvirtd.service.in $(top_builddir)/config.status check-local: check-augeas -test_libvirtd.aug: test_libvirtd.aug.in libvirtd.conf - $(AM_V_GEN)$(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl libvirtd.conf $< $@ +AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl + +test_libvirtd.aug: test_libvirtd.aug.in $(srcdir)/libvirtd.conf + $(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/libvirtd.conf $< $@ check-augeas: test_libvirtd.aug $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \ - '$(AUGPARSE)' -I $(srcdir) $(srcdir)/test_libvirtd.aug; \ + '$(AUGPARSE)' -I $(srcdir) test_libvirtd.aug; \ fi diff --git a/src/Makefile.am b/src/Makefile.am index 1fde936971..d7beea6a11 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -782,8 +782,8 @@ libvirt_driver_qemu_impl_la_SOURCES = $(QEMU_DRIVER_SOURCES) conf_DATA += qemu/qemu.conf augeas_DATA += qemu/libvirtd_qemu.aug -augeastest_DATA += qemu/test_libvirtd_qemu.aug -CLEANFILES += qemu/test_libvirtd_qemu.aug +augeastest_DATA += test_libvirtd_qemu.aug +CLEANFILES += test_libvirtd_qemu.aug endif EXTRA_DIST += qemu/qemu.conf qemu/libvirtd_qemu.aug \ @@ -823,8 +823,8 @@ libvirt_driver_lxc_impl_la_SOURCES = $(LXC_DRIVER_SOURCES) conf_DATA += lxc/lxc.conf augeas_DATA += lxc/libvirtd_lxc.aug -augeastest_DATA += lxc/test_libvirtd_lxc.aug -CLEANFILES += lxc/test_libvirtd_lxc.aug +augeastest_DATA += test_libvirtd_lxc.aug +CLEANFILES += test_libvirtd_lxc.aug endif EXTRA_DIST += lxc/lxc.conf lxc/libvirtd_lxc.aug lxc/test_libvirtd_lxc.aug.in @@ -1119,41 +1119,41 @@ check-local: check-augeas check-augeas: check-augeas-qemu check-augeas-lxc check-augeas-sanlock -AUG_GENTEST = $(top_srcdir)/build-aux/augeas-gentest.pl +AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl if WITH_QEMU -qemu/test_libvirtd_qemu.aug: qemu/test_libvirtd_qemu.aug.in qemu/qemu.conf $(AUG_GENTEST) - $(AM_V_GEN)$(AUG_GENTEST) qemu/qemu.conf $< $@ +test_libvirtd_qemu.aug: qemu/test_libvirtd_qemu.aug.in \ + $(srcdir)/qemu/qemu.conf $(AUG_GENTEST) + $(AUG_GENTEST) $(srcdir)/qemu/qemu.conf $< $@ -check-augeas-qemu: qemu/test_libvirtd_qemu.aug +check-augeas-qemu: test_libvirtd_qemu.aug $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \ - '$(AUGPARSE)' -I $(srcdir)/qemu \ - $(srcdir)/qemu/test_libvirtd_qemu.aug; \ + '$(AUGPARSE)' -I $(srcdir)/qemu test_libvirtd_qemu.aug; \ fi else check-augeas-qemu: endif if WITH_LXC -lxc/test_libvirtd_lxc.aug: lxc/test_libvirtd_lxc.aug.in lxc/lxc.conf $(AUG_GENTEST) - $(AM_V_GEN)$(AUG_GENTEST) lxc/lxc.conf $< $@ +test_libvirtd_lxc.aug: lxc/test_libvirtd_lxc.aug.in \ + $(srcdir)/lxc/lxc.conf $(AUG_GENTEST) + $(AUG_GENTEST) $(srcdir)/lxc/lxc.conf $< $@ -check-augeas-lxc: lxc/test_libvirtd_lxc.aug +check-augeas-lxc: test_libvirtd_lxc.aug $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \ - '$(AUGPARSE)' -I $(srcdir)/lxc \ - $(srcdir)/lxc/test_libvirtd_lxc.aug; \ + '$(AUGPARSE)' -I $(srcdir)/lxc test_libvirtd_lxc.aug; \ fi else check-augeas-lxc: endif -locking/test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in locking/qemu-sanlock.conf $(AUG_GENTEST) - $(AM_V_GEN)$(AUG_GENTEST) locking/qemu-sanlock.conf $< $@ +test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \ + locking/qemu-sanlock.conf $(AUG_GENTEST) + $(AUG_GENTEST) locking/qemu-sanlock.conf $< $@ -check-augeas-sanlock: locking/test_libvirt_sanlock.aug +check-augeas-sanlock: test_libvirt_sanlock.aug $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \ - '$(AUGPARSE)' -I $(srcdir)/locking \ - $(srcdir)/locking/test_libvirt_sanlock.aug; \ + '$(AUGPARSE)' -I $(srcdir)/locking test_libvirt_sanlock.aug; \ fi # @@ -1357,8 +1357,8 @@ sanlock_la_LIBADD = -lsanlock_client \ ../gnulib/lib/libgnu.la augeas_DATA += locking/libvirt_sanlock.aug -augeastest_DATA += locking/test_libvirt_sanlock.aug -CLEANFILES += locking/test_libvirt_sanlock.aug +augeastest_DATA += test_libvirt_sanlock.aug +CLEANFILES += test_libvirt_sanlock.aug $(builddir)/locking/%-sanlock.conf: $(srcdir)/locking/sanlock.conf $(AM_V_GEN)$(MKDIR_P) locking ; \ -- GitLab