From: Dan Kegel Date: Thu, 18 Jun 2020 21:24:14 +0000 (-0700) Subject: test/pkgcheck.sh: verify cmake and configure install identical bits (excluding .a... X-Git-Tag: 1.9.9-b1~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a5585c84367b644cfbd151ea0511e9609e481c8;p=thirdparty%2Fzlib-ng.git test/pkgcheck.sh: verify cmake and configure install identical bits (excluding .a and .so for now) Also add workflow to run pkgcheck.sh on one system. --- diff --git a/.github/workflows/pkgcheck.yml b/.github/workflows/pkgcheck.yml new file mode 100644 index 00000000..6084eecd --- /dev/null +++ b/.github/workflows/pkgcheck.yml @@ -0,0 +1,35 @@ +name: CI Pkgcheck +on: [push, pull_request] +jobs: + ci-pkgcheck: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + name: [ + Ubuntu GCC + ] + include: + - name: Ubuntu GCC + os: ubuntu-latest + compiler: gcc + packages: ninja-build + + steps: + - name: Checkout repository + uses: actions/checkout@v1 + + - name: Install packages (Ubuntu) + if: runner.os == 'Linux' && matrix.packages + run: | + sudo apt-get update + sudo apt-get install -y ${{ matrix.packages }} + + - name: Compare output of configure and cmake + run: | + mkdir ${{ matrix.build-dir || '.not-used' }} + cd ${{ matrix.build-dir || '.' }} + sh ${{ matrix.build-src-dir || '.' }}/test/pkgcheck.sh + env: + CC: ${{ matrix.compiler }} diff --git a/test/pkgcheck.sh b/test/pkgcheck.sh new file mode 100644 index 00000000..9a560b54 --- /dev/null +++ b/test/pkgcheck.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# Verify that the various build systems produce identical results on a Unixlike system +set -ex + +# If suffix not set to "", default to -ng +suffix=${suffix--ng} + +# Use same compiler for make and cmake builds +if test "$CC"x = ""x +then + if clang --version + then + export CC=clang + elif gcc --version + then + export CC=gcc + fi +fi + +# New build system +# Happens to delete top-level zconf.h +# (which itself is a bug, https://github.com/madler/zlib/issues/162 ) +# which triggers another bug later in configure, +# https://github.com/madler/zlib/issues/499 +rm -rf btmp2 pkgtmp2 +mkdir btmp2 pkgtmp2 +export DESTDIR=$(pwd)/pkgtmp2 +cd btmp2 + cmake -G Ninja .. + ninja -v + ninja install +cd .. + +# Original build system +rm -rf btmp1 pkgtmp1 +mkdir btmp1 pkgtmp1 +export DESTDIR=$(pwd)/pkgtmp1 +cd btmp1 + case $(uname) in + Darwin) + export LDFLAGS="-Wl,-headerpad_max_install_names" + ;; + Linux) + if grep -i fedora /etc/os-release > /dev/null + then + # Note: Fedora patches cmake to use -O2 in release, which + # does not match the -O3 configure sets :-( + export CFLAGS="-O2 -DNDEBUG" + fi + ;; + esac + ../configure + make + make install +cd .. + +if diff --exclude '*.so*' --exclude '*.a' -Nur pkgtmp1 pkgtmp2 +then + echo pkgcheck-cmake-bits-identical PASS +else + echo pkgcheck-cmake-bits-identical FAIL + exit 1 +fi