Pino Toscano
2020-Mar-13 11:57 UTC
Re: [Libguestfs] [PATCH libnbd 3/3] build: Test new pkgconf file.
On Thursday, 12 March 2020 23:46:57 CET Richard W.M. Jones wrote:> Unfortunately only tests the ./run version rather than the real one. > ---Is it worth it though? The new pkg-config file won't be deployed to users, and it should (hopefully) not break if the locations of the sources are not changed. Otherwise a small hint: rename it to e.g. local-pkg-config.sh to> diff --git a/tests/Makefile.am b/tests/Makefile.am > index c720988..f0cbc2e 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -1,5 +1,5 @@ > # nbd client library in userspace > -# Copyright (C) 2013-2019 Red Hat Inc. > +# Copyright (C) 2013-2020 Red Hat Inc. > # > # This library is free software; you can redistribute it and/or > # modify it under the terms of the GNU Lesser General Public > @@ -36,6 +36,7 @@ EXTRA_DIST = \ > functions.sh.in \ > make-pki.sh \ > meta-base-allocation.sh \ > + pkgconf.sh.in \As AC_CONFIG_FILES has tests/pkgconf.sh, the .in file is included automatically by autotools in the dist tarballs. Hence, this line is extra.> diff --git a/tests/pkgconf.sh.in b/tests/pkgconf.sh.in > new file mode 100755 > index 0000000..14b513b > --- /dev/null > +++ b/tests/pkgconf.sh.in > @@ -0,0 +1,38 @@ > +#!/usr/bin/env bash > +# nbd client library in userspace > +# @configure_input@ > +# Copyright (C) 2019-2020 Red Hat Inc. > +# > +# This library is free software; you can redistribute it and/or > +# modify it under the terms of the GNU Lesser General Public > +# License as published by the Free Software Foundation; either > +# version 2 of the License, or (at your option) any later version. > +# > +# This library is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +# Lesser General Public License for more details. > +# > +# You should have received a copy of the GNU Lesser General Public > +# License along with this library; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + > +# This is unfortunately only testing the local .pc file (in lib/local) > +# used by the ./run script, rather than the real .pc file (in lib). > +# It's hard to test the latter. XXX > + > +source ./functions.sh > + > +set -x > +set -e > + > +requires pkgconf --versionBetter use pkg-config, so it works with both pkg-config & pkgconf.> + > +aout=compile-pkgconf > +cleanup_fn rm -f $aout > + > +@CC@ @CFLAGS@ $(pkgconf libnbd --cflags) \@CFLAGS@ are the ones you use to build libnbd with, not the ones applications using libnbd need to use (otherwise they would be in Cflags & Libs in the pkg-config file).> + @srcdir@/compile.c \ > + -o $aout $(pkgconf libnbd --libs) > + > +./$aout >Should this test test all the tests/compile*.{c,cpp} sources? -- Pino Toscano
Richard W.M. Jones
2020-Mar-14 14:44 UTC
Re: [Libguestfs] [PATCH libnbd 3/3] build: Test new pkgconf file.
On Fri, Mar 13, 2020 at 12:57:52PM +0100, Pino Toscano wrote:> On Thursday, 12 March 2020 23:46:57 CET Richard W.M. Jones wrote: > > Unfortunately only tests the ./run version rather than the real one. > > --- > > Is it worth it though? The new pkg-config file won't be deployed to > users, and it should (hopefully) not break if the locations of the > sources are not changed. > > Otherwise a small hint: rename it to e.g. local-pkg-config.sh toI think I'll drop this patch. I was kind of hoping that by posting it someone would think of a way to test the real .pc file :-) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Eric Blake
2020-Mar-16 14:21 UTC
Re: [Libguestfs] [PATCH libnbd 3/3] build: Test new pkgconf file.
On 3/14/20 9:44 AM, Richard W.M. Jones wrote:> On Fri, Mar 13, 2020 at 12:57:52PM +0100, Pino Toscano wrote: >> On Thursday, 12 March 2020 23:46:57 CET Richard W.M. Jones wrote: >>> Unfortunately only tests the ./run version rather than the real one. >>> --- >> >> Is it worth it though? The new pkg-config file won't be deployed to >> users, and it should (hopefully) not break if the locations of the >> sources are not changed. >> >> Otherwise a small hint: rename it to e.g. local-pkg-config.sh to > > I think I'll drop this patch. I was kind of hoping that by posting it > someone would think of a way to test the real .pc file :-)Automake produces 'make check' (test the just-built uninstalled binaries) and 'make installcheck' (test the installed binaries). If there is an easy way to set up the test environment so that we use ./run during 'make check' but avoid it during 'make installcheck', then anything you do to test the local-pkg-config during 'make check' will immediately turn into a test of the real .pc file during 'make installcheck'. However, the way we currently do it, by globally setting LOG_COMPILER in tests/Makefile.am, does not distinguish between the two setups, so it would need a tweak, and I don't know offhand what that tweak would look like. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org