When hostdevs are involved, libvirt needs to poke into sysfs to
collect some information about them; since that pseudo-filesystem
doesn't exist on platforms other than Linux, the corresponding
tests would fail and need to be compiled out.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
tests/qemumemlocktest.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c
index bc0b53e6fa..1e5d06ea96 100644
--- a/tests/qemumemlocktest.c
+++ b/tests/qemumemlocktest.c
@@ -120,12 +120,18 @@ mymain(void)
DO_TEST("pc-hardlimit", 2147483648);
DO_TEST("pc-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
+
+# ifdef __linux__
DO_TEST("pc-hostdev", 2147483648);
+# endif /* __linux */
DO_TEST("pc-hardlimit+locked", 2147483648);
+
+# ifdef __linux__
DO_TEST("pc-hardlimit+hostdev", 2147483648);
DO_TEST("pc-hardlimit+locked+hostdev", 2147483648);
DO_TEST("pc-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
+# endif /* __linux */
qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64);
if (!(qemuCaps = virQEMUCapsNew())) {
@@ -144,12 +150,18 @@ mymain(void)
DO_TEST("pseries-hardlimit", 2147483648);
DO_TEST("pseries-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
+
+# ifdef __linux__
DO_TEST("pseries-hostdev", 4320133120);
+# endif /* __linux */
DO_TEST("pseries-hardlimit+locked", 2147483648);
+
+# ifdef __linux__
DO_TEST("pseries-hardlimit+hostdev", 2147483648);
DO_TEST("pseries-hardlimit+locked+hostdev", 2147483648);
DO_TEST("pseries-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
+# endif /* __linux */
cleanup:
virObjectUnref(qemuCaps);
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Apr 27, 2018 at 05:21:21PM +0200, Andrea Bolognani wrote: > When hostdevs are involved, libvirt needs to poke into sysfs to > collect some information about them; since that pseudo-filesystem > doesn't exist on platforms other than Linux, the corresponding > tests would fail and need to be compiled out. Our test suite isn't supposed to touch /sysfs from the real host at all. Sounds like we either need to mock out the function that's doing that, or provide some fake sysfs data in a tests/ subdirectory to run against with a mock'd open() call. That would make it work even on non-Linux I hope. Same for the other 2 patches following this. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- > tests/qemumemlocktest.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c > index bc0b53e6fa..1e5d06ea96 100644 > --- a/tests/qemumemlocktest.c > +++ b/tests/qemumemlocktest.c > @@ -120,12 +120,18 @@ mymain(void) > > DO_TEST("pc-hardlimit", 2147483648); > DO_TEST("pc-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); > + > +# ifdef __linux__ > DO_TEST("pc-hostdev", 2147483648); > +# endif /* __linux */ > > DO_TEST("pc-hardlimit+locked", 2147483648); > + > +# ifdef __linux__ > DO_TEST("pc-hardlimit+hostdev", 2147483648); > DO_TEST("pc-hardlimit+locked+hostdev", 2147483648); > DO_TEST("pc-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); > +# endif /* __linux */ > > qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64); > if (!(qemuCaps = virQEMUCapsNew())) { > @@ -144,12 +150,18 @@ mymain(void) > > DO_TEST("pseries-hardlimit", 2147483648); > DO_TEST("pseries-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); > + > +# ifdef __linux__ > DO_TEST("pseries-hostdev", 4320133120); > +# endif /* __linux */ > > DO_TEST("pseries-hardlimit+locked", 2147483648); > + > +# ifdef __linux__ > DO_TEST("pseries-hardlimit+hostdev", 2147483648); > DO_TEST("pseries-hardlimit+locked+hostdev", 2147483648); > DO_TEST("pseries-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); > +# endif /* __linux */ > > cleanup: > virObjectUnref(qemuCaps); > -- > 2.14.3 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, 2018-04-27 at 16:35 +0100, Daniel P. Berrangé wrote: > On Fri, Apr 27, 2018 at 05:21:21PM +0200, Andrea Bolognani wrote: > > When hostdevs are involved, libvirt needs to poke into sysfs to > > collect some information about them; since that pseudo-filesystem > > doesn't exist on platforms other than Linux, the corresponding > > tests would fail and need to be compiled out. > > Our test suite isn't supposed to touch /sysfs from the real > host at all. Sounds like we either need to mock out the > function that's doing that, or provide some fake sysfs data > in a tests/ subdirectory to run against with a mock'd open() > call. That would make it work even on non-Linux I hope. Sorry, I should have provided some more context, but I was in a bit of a hurry on Friday when I sent this. We are already mocking (parts of) sysfs through virpcimock, but the contents of that file are compiled out on non-Linux; after removing the #ifdefs, it's fairly easy to solve most of the build issues on FreeBSD (draft patch attached), but there's one I couldn't quite get rid of. Mocking canonicalize_file_name() causes a linking error: ../gnulib/lib/.libs/libgnu.a(canonicalize-lgpl.o): In function `canonicalize_file_name': .../libvirt/gnulib/lib/canonicalize-lgpl.c:417: multiple definition of `canonicalize_file_name' .libs/virpcimock.o:.../libvirt/tests/virpcimock.c:983: first defined here This is not a problem on Linux, where canonicalize_file_name() is provided by libc, but FreeBSD is using the gnulib implementation instead, leading to the issue above. Can you think of a way to make linking of virpcimock work despite the above? That should get us to the point where at least qemumemlocktest and qemuxml2xmltest are working; qemuxml2argvtest will probably need more mocking because of NUMA information. -- Andrea Bolognani / Red Hat / Virtualization-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Apr 30, 2018 at 11:47:33AM +0200, Andrea Bolognani wrote: > On Fri, 2018-04-27 at 16:35 +0100, Daniel P. Berrangé wrote: > > On Fri, Apr 27, 2018 at 05:21:21PM +0200, Andrea Bolognani wrote: > > > When hostdevs are involved, libvirt needs to poke into sysfs to > > > collect some information about them; since that pseudo-filesystem > > > doesn't exist on platforms other than Linux, the corresponding > > > tests would fail and need to be compiled out. > > > > Our test suite isn't supposed to touch /sysfs from the real > > host at all. Sounds like we either need to mock out the > > function that's doing that, or provide some fake sysfs data > > in a tests/ subdirectory to run against with a mock'd open() > > call. That would make it work even on non-Linux I hope. > > Sorry, I should have provided some more context, but I was in a > bit of a hurry on Friday when I sent this. > > We are already mocking (parts of) sysfs through virpcimock, but > the contents of that file are compiled out on non-Linux; after > removing the #ifdefs, it's fairly easy to solve most of the build > issues on FreeBSD (draft patch attached), but there's one I > couldn't quite get rid of. > > Mocking canonicalize_file_name() causes a linking error: > > ../gnulib/lib/.libs/libgnu.a(canonicalize-lgpl.o): In function `canonicalize_file_name': > .../libvirt/gnulib/lib/canonicalize-lgpl.c:417: multiple definition of `canonicalize_file_name' > .libs/virpcimock.o:.../libvirt/tests/virpcimock.c:983: first defined here > > This is not a problem on Linux, where canonicalize_file_name() is > provided by libc, but FreeBSD is using the gnulib implementation > instead, leading to the issue above. AFAIK, the only way is to not link virpcimock.la to gnulib. If we're lucky all the functions it needs would be present in the libvirt.so already, so might just need a few things added to the export list ? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, 2018-04-30 at 10:59 +0100, Daniel P. Berrangé wrote: > On Mon, Apr 30, 2018 at 11:47:33AM +0200, Andrea Bolognani wrote: > > Mocking canonicalize_file_name() causes a linking error: > > > > ../gnulib/lib/.libs/libgnu.a(canonicalize-lgpl.o): In function `canonicalize_file_name': > > .../libvirt/gnulib/lib/canonicalize-lgpl.c:417: multiple definition of `canonicalize_file_name' > > .libs/virpcimock.o:.../libvirt/tests/virpcimock.c:983: first defined here > > > > This is not a problem on Linux, where canonicalize_file_name() is > > provided by libc, but FreeBSD is using the gnulib implementation > > instead, leading to the issue above. > > AFAIK, the only way is to not link virpcimock.la to gnulib. > > If we're lucky all the functions it needs would be present in the libvirt.so > already, so might just need a few things added to the export list ? That compiles fine, but fails at runtime with $ ./tests/qemumemlocktest Missing symbol 'canonicalize_file_name' Abort trap (core dumped) I've tried a different approach: getting rid of the problematic function altogether. Patches are on the list. -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2024 Red Hat, Inc.