Fix pkg-test tests and run from CI

This commit is contained in:
Jay Berkenbilt 2023-12-23 10:41:55 -05:00
parent 6b8aa1db6f
commit 2f37633b92
7 changed files with 28 additions and 24 deletions

View File

@ -132,6 +132,7 @@ jobs:
matrix:
script:
- build-fuzzer
- pkg-test
- build-linux32
- test-alt-zlib
- test-unsigned-char

View File

@ -532,22 +532,6 @@ When done, the following should happen:
* /tmp/check-abi/new contains new sizes and library
* run check_abi manually to compare
* Run package tests:
(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)
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
```
## CREATING A RELEASE
* Push to main. This will create an artifact called distribution

16
build-scripts/pkg-test Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -e
sudo apt-get update
sudo apt-get -y install \
build-essential cmake \
zlib1g-dev libjpeg-dev libgnutls28-dev libssl-dev
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/tmp/inst
cmake --build build -j$(nproc)
cmake --install build
env PKG_CONFIG_PATH=/tmp/inst/lib/pkgconfig \
LD_LIBRARY_PATH=/tmp/inst/lib \
CMAKE_PREFIX_PATH=/tmp/inst \
PATH=/tmp/inst/bin:$PATH \
./pkg-test/run-all

View File

@ -2,13 +2,16 @@
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.
On a GNU/Linux system, you can run `./pkg-test/run-all` from the top-level directory to run all the tests. For example:
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:
```
cmake -S . -B build
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/tmp/inst
cmake --build build -j$(nproc)
DESTDIR=/tmp/inst cmake --install build
env PKG_CONFIG_PATH=/tmp/inst/usr/local/lib/pkgconfig \
CMAKE_PREFIX_PATH=/tmp/inst/usr/local \
cmake --install build
env PKG_CONFIG_PATH=/tmp/inst/lib/pkgconfig \
LD_LIBRARY_PATH=/tmp/inst/lib \
CMAKE_PREFIX_PATH=/tmp/inst \
PATH=/tmp/inst/bin:$PATH \
./pkg-test/run-all
```

View File

@ -11,7 +11,7 @@ if [ ! -d "$TMP" ]; then
exit 2
fi
WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h)
WANTED_VERSION=$(awk -F'"' '/# *define QPDF_VERSION / {print $2}' include/qpdf/DLL.h | tail -n 1)
qpdf --version | grep -F $WANTED_VERSION
qpdf --help

View File

@ -13,7 +13,7 @@ if [ ! -d "$TMP" ]; then
exit 2
fi
WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h)
WANTED_VERSION=$(awk -F'"' '/# *define QPDF_VERSION / {print $2}' include/qpdf/DLL.h | tail -n 1)
cp pkg-test/qpdf-version.cc pkg-test/CMakeLists.txt $TMP
cd $TMP

View File

@ -12,7 +12,7 @@ if [ ! -d "$TMP" ]; then
exit 2
fi
WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h)
WANTED_VERSION=$(awk -F'"' '/# *define QPDF_VERSION / {print $2}' include/qpdf/DLL.h | tail -n 1)
cp pkg-test/qpdf-version.cc $TMP
cd $TMP