From: Rafael Laboissière Date: Sun, 7 Jan 2024 19:38:03 +0000 (-0300) Subject: Add build-time check and autopkgtest support X-Git-Tag: archive/raspbian/8.0.3-2+rpi1^2^2^2~18 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0c211f006029438dfcf04170feb88898c7757310;p=mathgl.git Add build-time check and autopkgtest support Closes: #1035174 --- diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..0d9670e --- /dev/null +++ b/debian/clean @@ -0,0 +1,3 @@ +examples/mgl_example +examples/*.png +sample.png diff --git a/debian/control b/debian/control index aeb7f7b..0aaf860 100644 --- a/debian/control +++ b/debian/control @@ -11,6 +11,7 @@ Build-Depends: debhelper-compat (= 13), desktop-file-utils, dh-sequence-python3, + file, fluid, freeglut3-dev, libfltk1.3-dev, diff --git a/debian/rules b/debian/rules index fb3d742..c4c7c71 100755 --- a/debian/rules +++ b/debian/rules @@ -53,3 +53,8 @@ ifneq (,$(filter $(DEB_BUILD_ARCH),mips mipsel alpha)) override_dh_dwz: @echo bypass dwz that causes build failures endif + +override_dh_auto_test: +ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) + LOCAL=true debian/tests/run-tests +endif diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..6be16ad --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,2 @@ +Test-Command: debian/tests/run-tests +Depends: @, @builddeps@ diff --git a/debian/tests/run-tests b/debian/tests/run-tests new file mode 100755 index 0000000..d03e004 --- /dev/null +++ b/debian/tests/run-tests @@ -0,0 +1,36 @@ +#!/bin/sh + +set -e + +LOCAL=${LOCAL:-false} +CWD=$(pwd) +BUILDDIR=obj-$(dpkg-architecture -qDEB_BUILD_MULTIARCH) + +if [ $LOCAL = true ] ; then + cd $BUILDDIR/examples + make + export PYTHONPATH=$CWD/$BUILDDIR/lang/ + export LD_LIBRARY_PATH=$CWD/$BUILDDIR/src/ +else + cd examples + g++ wnd_samples.cpp full_test.cpp samples.cpp -o mgl_example -lmgl +fi + +check_png() { + FILE=$1.png + echo -n "$FILE: " + file --brief $FILE | grep -q "^PNG image data," + echo ok + rm -f $FILE +} + +NAMES="$(./mgl_example)" +rm -f mgl_example + +for i in $NAMES ; do + check_png $i +done + +cd $CWD +python3 examples/test.py +check_png sample