]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
test/pkgcheck.sh: verify cmake and configure install identical bits (excluding .a...
authorDan Kegel <dank@kegel.com>
Thu, 18 Jun 2020 21:24:14 +0000 (14:24 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 19 Jun 2020 08:14:35 +0000 (10:14 +0200)
Also add workflow to run pkgcheck.sh on one system.

.github/workflows/pkgcheck.yml [new file with mode: 0644]
test/pkgcheck.sh [new file with mode: 0644]

diff --git a/.github/workflows/pkgcheck.yml b/.github/workflows/pkgcheck.yml
new file mode 100644 (file)
index 0000000..6084eec
--- /dev/null
@@ -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 (file)
index 0000000..9a560b5
--- /dev/null
@@ -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