[libvirt] [PATCH] tests: fix building without xattr support

Only compile securityselinuxhelper.c if xattr support was detected to avoid this error: securityselinuxhelper.c:34:24: fatal error: attr/xattr.h: No such file or directory compilation terminated. Since all SELinux tests depend upon the securityselinuxhelper library, these test programs are now only build when xattr support is available. Signed-off-by: Claudio Bley <cbley@av-test.de> --- I'm by no means an automake/SELinux expert and thus I am unsure whether this is the right thing to do. Especially since in commit 95577af442e5 Eric commented that the "Makefile already guaranteed xattr support." which is obviously not the the case, but maybe I'm just missing something... tests/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 9098dec..09144d6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -131,23 +131,23 @@ test_programs = virshtest sockettest \ if WITH_DBUS test_programs += virdbustest \ virsystemdtest endif if WITH_GNUTLS test_programs += virnettlscontexttest virnettlssessiontest endif if WITH_SECDRIVER_SELINUX +if WITH_ATTR test_programs += securityselinuxtest if WITH_QEMU -if WITH_ATTR test_programs += securityselinuxlabeltest endif endif endif if WITH_DRIVER_MODULES test_programs += virdrivermoduletest endif # This is a fake SSH we use from virnetsockettest @@ -702,39 +702,39 @@ virkeyfiletest_LDADD = $(LDADDS) virauthconfigtest_SOURCES = \ virauthconfigtest.c testutils.h testutils.c virauthconfigtest_LDADD = $(LDADDS) seclabeltest_SOURCES = \ seclabeltest.c seclabeltest_LDADD = $(LDADDS) if WITH_SECDRIVER_SELINUX +if WITH_ATTR if WITH_TESTS noinst_LTLIBRARIES += libsecurityselinuxhelper.la else check_LTLIBRARIES += libsecurityselinuxhelper.la endif libsecurityselinuxhelper_la_SOURCES = \ securityselinuxhelper.c libsecurityselinuxhelper_la_LDFLAGS = -module -avoid-version \ -rpath /evil/libtool/hack/to/force/shared/lib/creation securityselinuxtest_SOURCES = \ securityselinuxtest.c testutils.h testutils.c securityselinuxtest_LDADD = $(LDADDS) $(SELINUX_LIBS) securityselinuxtest_DEPENDENCIES = libsecurityselinuxhelper.la \ ../src/libvirt.la if WITH_QEMU -if WITH_ATTR securityselinuxlabeltest_SOURCES = \ securityselinuxlabeltest.c testutils.h testutils.c \ testutilsqemu.h testutilsqemu.c securityselinuxlabeltest_LDADD = $(qemu_LDADDS) $(SELINUX_LIBS) securityselinuxlabeltest_DEPENDENCIES = libsecurityselinuxhelper.la \ ../src/libvirt.la endif endif endif EXTRA_DIST += securityselinuxtest.c securityselinuxlabeltest.c \ -- 1.7.9.5

On Wed, Aug 21, 2013 at 09:28:26AM +0200, Claudio Bley wrote:
Only compile securityselinuxhelper.c if xattr support was detected to avoid this error:
securityselinuxhelper.c:34:24: fatal error: attr/xattr.h: No such file or directory compilation terminated.
Since all SELinux tests depend upon the securityselinuxhelper library, these test programs are now only build when xattr support is available.
Signed-off-by: Claudio Bley <cbley@av-test.de> --- I'm by no means an automake/SELinux expert and thus I am unsure whether this is the right thing to do.
Especially since in commit 95577af442e5 Eric commented that the "Makefile already guaranteed xattr support." which is obviously not the the case, but maybe I'm just missing something...
tests/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ACK, this is right. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

At Wed, 21 Aug 2013 13:55:27 +0100, Daniel P. Berrange wrote:
On Wed, Aug 21, 2013 at 09:28:26AM +0200, Claudio Bley wrote:
Only compile securityselinuxhelper.c if xattr support was detected to avoid this error:
securityselinuxhelper.c:34:24: fatal error: attr/xattr.h: No such file or directory compilation terminated.
Since all SELinux tests depend upon the securityselinuxhelper library, these test programs are now only build when xattr support is available.
Signed-off-by: Claudio Bley <cbley@av-test.de> --- I'm by no means an automake/SELinux expert and thus I am unsure whether this is the right thing to do.
Especially since in commit 95577af442e5 Eric commented that the "Makefile already guaranteed xattr support." which is obviously not the the case, but maybe I'm just missing something...
tests/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ACK, this is right.
Alright, pushed. Thanks! Claudio -- AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany Phone: +49 341 265 310 19 Web:<http://www.av-test.org> Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076) Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern

On 08/21/2013 01:28 AM, Claudio Bley wrote:
Only compile securityselinuxhelper.c if xattr support was detected to avoid this error:
securityselinuxhelper.c:34:24: fatal error: attr/xattr.h: No such file or directory compilation terminated.
Since all SELinux tests depend upon the securityselinuxhelper library, these test programs are now only build when xattr support is available.
Signed-off-by: Claudio Bley <cbley@av-test.de> --- I'm by no means an automake/SELinux expert and thus I am unsure whether this is the right thing to do.
Especially since in commit 95577af442e5 Eric commented that the "Makefile already guaranteed xattr support." which is obviously not the the case, but maybe I'm just missing something...
Ah, there were TWO programs that use the file, and only one of them was guarded in the Makefile. Thanks for beating me to this fix.
if WITH_SECDRIVER_SELINUX +if WITH_ATTR if WITH_TESTS noinst_LTLIBRARIES += libsecurityselinuxhelper.la ...
if WITH_QEMU -if WITH_ATTR securityselinuxlabeltest_SOURCES = \ securityselinuxlabeltest.c testutils.h testutils.c \ testutilsqemu.h testutilsqemu.c securityselinuxlabeltest_LDADD = $(qemu_LDADDS) $(SELINUX_LIBS) securityselinuxlabeltest_DEPENDENCIES = libsecurityselinuxhelper.la \ ../src/libvirt.la endif endif endif
As a followup, it would be nice to take advantage of automake's nesting matching - if you write: endif WITH_QEMU endif WITH_TESTS endif WITH_ATTR in reverse order, then Automake will validate that you correctly nested things. We ought to do that everywhere in our Makefile.am; and that means I ought to write a syntax-check rule to enforce it... guess I know what I'm tackling next... -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Claudio Bley
-
Daniel P. Berrange
-
Eric Blake