Commit 10fe5143f4c19fbea73158a4aecded1f9516ed52

Authored by Jay Berkenbilt
1 parent 4ee393d1

Add CI for testing with zlib-ng

Add a CI job to test qpdf with other than the default zlib
implementation. This incldues a check that the new zlib really is not
the default, so the new test will fail if the default because zlib-ng.
.github/workflows/main.yml
... ... @@ -133,6 +133,7 @@ jobs:
133 133 script:
134 134 - build-fuzzer
135 135 - build-linux32
  136 + - test-alt-zlib
136 137 - test-unsigned-char
137 138 - test-c++-next
138 139 steps:
... ...
README-maintainer.md
... ... @@ -7,6 +7,7 @@
7 7 * [CHECKING DOCS ON readthedocs](#checking-docs-on-readthedocs)
8 8 * [GOOGLE OSS-FUZZ](#google-oss-fuzz)
9 9 * [CODING RULES](#coding-rules)
  10 +* [ZLIB COMPATIBILITY](#zlib-compatibility)
10 11 * [HOW TO ADD A COMMAND-LINE ARGUMENT](#how-to-add-a-command-line-argument)
11 12 * [RELEASE PREPARATION](#release-preparation)
12 13 * [CREATING A RELEASE](#creating-a-release)
... ... @@ -272,6 +273,10 @@ Building docs from pull requests is also enabled.
272 273 * Avoid attaching too much metadata to objects and object handles
273 274 since those have to get copied around a lot.
274 275  
  276 +## ZLIB COMPATIBILITY
  277 +
  278 +XXX Write this
  279 +
275 280 ## HOW TO ADD A COMMAND-LINE ARGUMENT
276 281  
277 282 Quick reminder:
... ...
build-scripts/test-alt-zlib 0 → 100755
  1 +#!/bin/bash
  2 +set -eo pipefail
  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 +# Build and install zlib-ng
  9 +rm -rf /tmp/zlib-ng
  10 +pushd /tmp
  11 +git clone https://github.com/zlib-ng/zlib-ng
  12 +cd zlib-ng
  13 +cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/inst -DZLIB_COMPAT=ON
  14 +cmake --build build -j$(nproc)
  15 +(cd build; ctest --verbose)
  16 +cmake --install build
  17 +popd
  18 +
  19 +cmake -S . -B build \
  20 + -DCI_MODE=1 -DBUILD_STATIC_LIBS=0 -DCMAKE_BUILD_TYPE=Release \
  21 + -DREQUIRE_CRYPTO_OPENSSL=1 -DREQUIRE_CRYPTO_GNUTLS=1 \
  22 + -DENABLE_QTC=1
  23 +cmake --build build --verbose -j$(nproc) -- -k
  24 +
  25 +# Make sure we can use zlib-ng
  26 +sum1="$(./build/zlib-flate/zlib-flate -compress < README-maintainer.md | sha256sum -)"
  27 +export LD_PRELOAD=/tmp/inst/lib/libz.so.1
  28 +sum2="$(./build/zlib-flate/zlib-flate -compress < README-maintainer.md | sha256sum -)"
  29 +if [ "$sum1" = "$sum2" ]; then
  30 + # If this happens, see if zlib-ng has become the default. If
  31 + # that's the case, rework this test to use some other alternaive
  32 + # zlib, such as the old one or any other API-compatible
  33 + # implementation.
  34 + echo "Using zlib-ng didn't change compression output"
  35 + exit 2
  36 +fi
  37 +
  38 +# If this fails, please see ZLIB COMPATIBILITY in README-maintainer.md.
  39 +(cd build; ctest --verbose)
... ...