Commit c115680e7c93b5cd2d3c125756b90fd9f29b7ff3
1 parent
c56edf41
Add smoke tests to AppImage build in CI
Verify runpath for all executables, check to make sure the AppImage works in various intended ways.
Showing
1 changed file
with
33 additions
and
12 deletions
build-scripts/build-appimage
| @@ -5,11 +5,11 @@ | @@ -5,11 +5,11 @@ | ||
| 5 | # described in README-maintainer. | 5 | # described in README-maintainer. |
| 6 | # | 6 | # |
| 7 | set -ex | 7 | set -ex |
| 8 | -cd appimage | 8 | +pushd appimage |
| 9 | docker build -t qpdfbuild . | 9 | docker build -t qpdfbuild . |
| 10 | rm -rf build | 10 | rm -rf build |
| 11 | mkdir build | 11 | mkdir build |
| 12 | -cd .. | 12 | +popd |
| 13 | git clone .git appimage/build/qpdf | 13 | git clone .git appimage/build/qpdf |
| 14 | docker run --privileged --rm \ | 14 | docker run --privileged --rm \ |
| 15 | -v $PWD/appimage/build:/tmp/build ${1+"$@"} qpdfbuild | 15 | -v $PWD/appimage/build:/tmp/build ${1+"$@"} qpdfbuild |
| @@ -19,20 +19,41 @@ cp -p appimage/build/qpdf/appimage/build/qpdf*AppImage* distribution | @@ -19,20 +19,41 @@ cp -p appimage/build/qpdf/appimage/build/qpdf*AppImage* distribution | ||
| 19 | for i in distribution/*; do | 19 | for i in distribution/*; do |
| 20 | mv $i $(echo $i | sed -e 's/\.AppImage/-ci.AppImage/') | 20 | mv $i $(echo $i | sed -e 's/\.AppImage/-ci.AppImage/') |
| 21 | done | 21 | done |
| 22 | +version=$(basename distribution/qpdf*AppImage | cut -d- -f 2) | ||
| 23 | + | ||
| 24 | +# Smoke test the AppImage | ||
| 25 | +app_image=$(echo distribution/qpdf*AppImage) | ||
| 26 | +# Directly invoking the AppImage should behave like qpdf | ||
| 27 | +${app_image} --version | grep -E "^qpdf version $version" | ||
| 28 | +# Invoking the AppImage with a subcommand should behave like the subcommand | ||
| 29 | +${app_image} qpdf --version | grep -E "^qpdf version $version" | ||
| 30 | +${app_image} fix-qdf --version | grep -E "^fix-qdf from qpdf version $version" | ||
| 31 | +${app_image} zlib-flate --version | grep -E "^zlib-flate from qpdf version $version" | ||
| 32 | +# Symlinking a command to the AppImage should invoke as that command | ||
| 33 | +mkdir appimage/build/argv0-test | ||
| 34 | +pushd appimage/build/argv0-test | ||
| 35 | +for i in qpdf fix-qdf zlib-flate; do | ||
| 36 | + ln -s ../../../${app_image} ./$i | ||
| 37 | +done | ||
| 38 | +./qpdf --version | grep -E "^qpdf version $version" | ||
| 39 | +./fix-qdf --version | grep -E "^fix-qdf from qpdf version $version" | ||
| 40 | +./zlib-flate --version | grep -E "^zlib-flate from qpdf version $version" | ||
| 41 | +popd | ||
| 22 | 42 | ||
| 23 | # Extract a standalone copy of binaries and libraries from the | 43 | # Extract a standalone copy of binaries and libraries from the |
| 24 | # AppImage. This is suitable for use in AWS Lambda, docker, or other | 44 | # AppImage. This is suitable for use in AWS Lambda, docker, or other |
| 25 | -# self-contained environments. | ||
| 26 | -version=$(basename distribution/qpdf*AppImage | cut -d- -f 2) | ||
| 27 | -./distribution/qpdf*AppImage --appimage-extract | 45 | +# self-contained environments. We are relying on the AppImage build to |
| 46 | +# create an executable whose runpath is relative to the binary so that | ||
| 47 | +# the extract zip file is relocatable. | ||
| 48 | +${app_image} --appimage-extract | ||
| 28 | D=$PWD/distribution | 49 | D=$PWD/distribution |
| 29 | -if ! (readelf -d squashfs-root/usr/bin/qpdf | \ | ||
| 30 | - grep RUNPATH | grep -q -F ..); then | ||
| 31 | - # We are relying on the AppImage build to create an executable | ||
| 32 | - # whose runpath is relative to the binary so that the extract zip | ||
| 33 | - # file is relocatable. | ||
| 34 | - echo "Standalone linux binary lacks relative RUNPATH" | ||
| 35 | -fi | 50 | +for i in qpdf fix-qdf zlib-flate; do |
| 51 | + if ! (readelf -d squashfs-root/usr/bin/$i | \ | ||
| 52 | + grep RUNPATH | grep -q -F ..); then | ||
| 53 | + echo "Standalone linux binary $i lacks relative RUNPATH" | ||
| 54 | + exit 2 | ||
| 55 | + fi | ||
| 56 | +done | ||
| 36 | (cd squashfs-root/usr; \ | 57 | (cd squashfs-root/usr; \ |
| 37 | zip -9 --symlinks $D/qpdf-$version-bin-linux-x86_64-ci.zip \ | 58 | zip -9 --symlinks $D/qpdf-$version-bin-linux-x86_64-ci.zip \ |
| 38 | bin/{qpdf,fix-qdf,zlib-flate} lib/*) | 59 | bin/{qpdf,fix-qdf,zlib-flate} lib/*) |