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 --version
Better 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