aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2023-12-19 14:46:56 +0100
committerJay Berkenbilt <ejb@ql.org>2023-12-20 21:46:20 +0100
commit10fe5143f4c19fbea73158a4aecded1f9516ed52 (patch)
treea1a4e56addb9745ab2adc325572bac74542423e7
parent4ee393d1fa5424bc25952580b177f572e58920db (diff)
downloadqpdf-10fe5143f4c19fbea73158a4aecded1f9516ed52.tar.zst
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.
-rw-r--r--.github/workflows/main.yml1
-rw-r--r--README-maintainer.md5
-rwxr-xr-xbuild-scripts/test-alt-zlib39
3 files changed, 45 insertions, 0 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 9b635718..b86f3a28 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -133,6 +133,7 @@ jobs:
script:
- build-fuzzer
- build-linux32
+ - test-alt-zlib
- test-unsigned-char
- test-c++-next
steps:
diff --git a/README-maintainer.md b/README-maintainer.md
index c7ae7296..67cbe35a 100644
--- a/README-maintainer.md
+++ b/README-maintainer.md
@@ -7,6 +7,7 @@
* [CHECKING DOCS ON readthedocs](#checking-docs-on-readthedocs)
* [GOOGLE OSS-FUZZ](#google-oss-fuzz)
* [CODING RULES](#coding-rules)
+* [ZLIB COMPATIBILITY](#zlib-compatibility)
* [HOW TO ADD A COMMAND-LINE ARGUMENT](#how-to-add-a-command-line-argument)
* [RELEASE PREPARATION](#release-preparation)
* [CREATING A RELEASE](#creating-a-release)
@@ -272,6 +273,10 @@ Building docs from pull requests is also enabled.
* Avoid attaching too much metadata to objects and object handles
since those have to get copied around a lot.
+## ZLIB COMPATIBILITY
+
+XXX Write this
+
## HOW TO ADD A COMMAND-LINE ARGUMENT
Quick reminder:
diff --git a/build-scripts/test-alt-zlib b/build-scripts/test-alt-zlib
new file mode 100755
index 00000000..41b3bb31
--- /dev/null
+++ b/build-scripts/test-alt-zlib
@@ -0,0 +1,39 @@
+#!/bin/bash
+set -eo pipefail
+sudo apt-get update
+sudo apt-get -y install \
+ build-essential cmake \
+ zlib1g-dev libjpeg-dev libgnutls28-dev libssl-dev
+
+# Build and install zlib-ng
+rm -rf /tmp/zlib-ng
+pushd /tmp
+git clone https://github.com/zlib-ng/zlib-ng
+cd zlib-ng
+cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/inst -DZLIB_COMPAT=ON
+cmake --build build -j$(nproc)
+(cd build; ctest --verbose)
+cmake --install build
+popd
+
+cmake -S . -B build \
+ -DCI_MODE=1 -DBUILD_STATIC_LIBS=0 -DCMAKE_BUILD_TYPE=Release \
+ -DREQUIRE_CRYPTO_OPENSSL=1 -DREQUIRE_CRYPTO_GNUTLS=1 \
+ -DENABLE_QTC=1
+cmake --build build --verbose -j$(nproc) -- -k
+
+# Make sure we can use zlib-ng
+sum1="$(./build/zlib-flate/zlib-flate -compress < README-maintainer.md | sha256sum -)"
+export LD_PRELOAD=/tmp/inst/lib/libz.so.1
+sum2="$(./build/zlib-flate/zlib-flate -compress < README-maintainer.md | sha256sum -)"
+if [ "$sum1" = "$sum2" ]; then
+ # If this happens, see if zlib-ng has become the default. If
+ # that's the case, rework this test to use some other alternaive
+ # zlib, such as the old one or any other API-compatible
+ # implementation.
+ echo "Using zlib-ng didn't change compression output"
+ exit 2
+fi
+
+# If this fails, please see ZLIB COMPATIBILITY in README-maintainer.md.
+(cd build; ctest --verbose)