Commit 2f37633b923e0294acd894454a95d2a9ee1d36a9

Authored by Jay Berkenbilt
1 parent 6b8aa1db

Fix pkg-test tests and run from CI

.github/workflows/main.yml
... ... @@ -132,6 +132,7 @@ jobs:
132 132 matrix:
133 133 script:
134 134 - build-fuzzer
  135 + - pkg-test
135 136 - build-linux32
136 137 - test-alt-zlib
137 138 - test-unsigned-char
... ...
README-maintainer.md
... ... @@ -532,22 +532,6 @@ When done, the following should happen:
532 532 * /tmp/check-abi/new contains new sizes and library
533 533 * run check_abi manually to compare
534 534  
535   -* Run package tests:
536   -
537   - (Note: can't use DESTDIR because pkg-config won't know about it.)
538   -
539   -```
540   -\rm -rf /tmp/inst build.tmp
541   -cmake -S . -B build.tmp \
542   - -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/tmp/inst
543   -cmake --build build.tmp -j$(nproc)
544   -cmake --install build.tmp
545   -env PKG_CONFIG_PATH=/tmp/inst/lib/pkgconfig \
546   - LD_LIBRARY_PATH=/tmp/inst/lib \
547   - CMAKE_PREFIX_PATH=/tmp/inst \
548   - ./pkg-test/run-all
549   -```
550   -
551 535 ## CREATING A RELEASE
552 536  
553 537 * Push to main. This will create an artifact called distribution
... ...
build-scripts/pkg-test 0 → 100755
  1 +#!/bin/bash
  2 +set -e
  3 +sudo apt-get update
  4 +sudo apt-get -y install \
  5 + build-essential cmake \
  6 + zlib1g-dev libjpeg-dev libgnutls28-dev libssl-dev
  7 +
  8 +cmake -S . -B build \
  9 + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/tmp/inst
  10 +cmake --build build -j$(nproc)
  11 +cmake --install build
  12 +env PKG_CONFIG_PATH=/tmp/inst/lib/pkgconfig \
  13 + LD_LIBRARY_PATH=/tmp/inst/lib \
  14 + CMAKE_PREFIX_PATH=/tmp/inst \
  15 + PATH=/tmp/inst/bin:$PATH \
  16 + ./pkg-test/run-all
... ...
pkg-test/README.md
... ... @@ -2,13 +2,16 @@
2 2  
3 3 The files in this directory are called by autopkgtest in the debian package but can be used by any packager to verify installed packages. Each test-* script should be run from the top of the source tree and takes an empty directory as its single argument. The test passes if the script exits with a zero exit status. Note that these tests write to stderr because they use set -x in the shell.
4 4  
5   -On a GNU/Linux system, you can run `./pkg-test/run-all` from the top-level directory to run all the tests. For example:
  5 +On a GNU/Linux system, you can run `./pkg-test/run-all` from the top-level directory to run all the tests. Note that you have to specify an altrenative install prefix rather than using DESTDIR since, otherwise, pkg-config won't find the packages. For example:
6 6  
7 7 ```
8   -cmake -S . -B build
  8 +cmake -S . -B build \
  9 + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/tmp/inst
9 10 cmake --build build -j$(nproc)
10   -DESTDIR=/tmp/inst cmake --install build
11   -env PKG_CONFIG_PATH=/tmp/inst/usr/local/lib/pkgconfig \
12   - CMAKE_PREFIX_PATH=/tmp/inst/usr/local \
  11 +cmake --install build
  12 +env PKG_CONFIG_PATH=/tmp/inst/lib/pkgconfig \
  13 + LD_LIBRARY_PATH=/tmp/inst/lib \
  14 + CMAKE_PREFIX_PATH=/tmp/inst \
  15 + PATH=/tmp/inst/bin:$PATH \
13 16 ./pkg-test/run-all
14 17 ```
... ...
pkg-test/test-cli
... ... @@ -11,7 +11,7 @@ if [ ! -d "$TMP" ]; then
11 11 exit 2
12 12 fi
13 13  
14   -WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h)
  14 +WANTED_VERSION=$(awk -F'"' '/# *define QPDF_VERSION / {print $2}' include/qpdf/DLL.h | tail -n 1)
15 15  
16 16 qpdf --version | grep -F $WANTED_VERSION
17 17 qpdf --help
... ...
pkg-test/test-cmake
... ... @@ -13,7 +13,7 @@ if [ ! -d "$TMP" ]; then
13 13 exit 2
14 14 fi
15 15  
16   -WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h)
  16 +WANTED_VERSION=$(awk -F'"' '/# *define QPDF_VERSION / {print $2}' include/qpdf/DLL.h | tail -n 1)
17 17  
18 18 cp pkg-test/qpdf-version.cc pkg-test/CMakeLists.txt $TMP
19 19 cd $TMP
... ...
pkg-test/test-pkg-config
... ... @@ -12,7 +12,7 @@ if [ ! -d "$TMP" ]; then
12 12 exit 2
13 13 fi
14 14  
15   -WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h)
  15 +WANTED_VERSION=$(awk -F'"' '/# *define QPDF_VERSION / {print $2}' include/qpdf/DLL.h | tail -n 1)
16 16  
17 17 cp pkg-test/qpdf-version.cc $TMP
18 18 cd $TMP
... ...