From 38cd94bec852b621c6af11efcbea4e51e403ca54 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 10 Sep 2022 09:24:12 -0400 Subject: [PATCH] Strengthen pkg-test * Define POINTERHOLDER_TRANSITION * Make sure we are getting the intended version of qpdf --- README-maintainer | 13 +++++++++---- pkg-test/qpdf-version.cc | 4 ++++ pkg-test/test-cli | 4 +++- pkg-test/test-cmake | 8 +++++++- pkg-test/test-pkg-config | 11 +++++++++-- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/README-maintainer b/README-maintainer index e7f525d9..166b1744 100644 --- a/README-maintainer +++ b/README-maintainer @@ -382,11 +382,16 @@ pytest -n auto * Run package tests: -cmake -S . -B build.tmp -DCMAKE_BUILD_TYPE=RelWithDebInfo +(Note: can't use DESTDIR because pkg-config won't know about it.) + +\rm -rf /tmp/inst build.tmp +cmake -S . -B build.tmp \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/tmp/inst cmake --build build.tmp -j$(nproc) -DESTDIR=/tmp/inst cmake --install build.tmp -env PKG_CONFIG_PATH=/tmp/inst/usr/local/lib/pkgconfig \ - CMAKE_PREFIX_PATH=/tmp/inst/usr/local \ +cmake --install build.tmp +env PKG_CONFIG_PATH=/tmp/inst/lib/pkgconfig \ + LD_LIBRARY_PATH=/tmp/inst/lib \ + CMAKE_PREFIX_PATH=/tmp/inst \ ./pkg-test/run-all diff --git a/pkg-test/qpdf-version.cc b/pkg-test/qpdf-version.cc index ab78cede..419b302f 100644 --- a/pkg-test/qpdf-version.cc +++ b/pkg-test/qpdf-version.cc @@ -1,3 +1,7 @@ +#ifndef POINTERHOLDER_TRANSITION +# define POINTERHOLDER_TRANSITION 4 +#endif + #include #include diff --git a/pkg-test/test-cli b/pkg-test/test-cli index 6b1c1d88..f69e546a 100755 --- a/pkg-test/test-cli +++ b/pkg-test/test-cli @@ -11,7 +11,9 @@ if [ ! -d "$TMP" ]; then exit 2 fi -qpdf --version +WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h) + +qpdf --version | grep -F $WANTED_VERSION qpdf --help qpdf --check qpdf/qtest/qpdf/minimal.pdf qpdf qpdf/qtest/qpdf/minimal.pdf --encrypt u o 256 -- $TMP/out.pdf diff --git a/pkg-test/test-cmake b/pkg-test/test-cmake index 4fd5846b..ab986f8e 100755 --- a/pkg-test/test-cmake +++ b/pkg-test/test-cmake @@ -11,8 +11,14 @@ if [ ! -d "$TMP" ]; then echo 1>&2 "Usage: $0 tmp-dir" exit 2 fi + +WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h) + cp pkg-test/qpdf-version.cc pkg-test/CMakeLists.txt $TMP cd $TMP cmake -S . -B build cmake --build build -./build/qpdf-version +if [ "$(./build/qpdf-version)" != "$WANTED_VERSION" ]; then + echo 1>&2 "Failed to get correct qpdf version from cmake test" + exit 2 +fi diff --git a/pkg-test/test-pkg-config b/pkg-test/test-pkg-config index 3624030a..ea469f1b 100755 --- a/pkg-test/test-pkg-config +++ b/pkg-test/test-pkg-config @@ -13,11 +13,18 @@ if [ ! -d "$TMP" ]; then exit 2 fi +WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h) + cp pkg-test/qpdf-version.cc $TMP cd $TMP -pkg-config libqpdf --modversion +if [ "$(pkg-config libqpdf --modversion)" != "$WANTED_VERSION" ]; then + echo 1>&2 "Failed to get correct qpdf version from pkg-config --modversion" +fi pkg-config libqpdf --libs --static g++ qpdf-version.cc -o qpdf-version \ $(pkg-config libqpdf --cflags) \ $(pkg-config libqpdf --libs) -./qpdf-version +if [ "$(./qpdf-version)" != "$WANTED_VERSION" ]; then + echo 1>&2 "Failed to get correct qpdf version from pkg-config test" + exit 2 +fi