From 0c211f006029438dfcf04170feb88898c7757310 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 7 Jan 2024 16:38:03 -0300 Subject: [PATCH] Add build-time check and autopkgtest support Closes: #1035174 --- debian/clean | 3 +++ debian/control | 1 + debian/rules | 5 +++++ debian/tests/control | 2 ++ debian/tests/run-tests | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+) create mode 100644 debian/clean create mode 100644 debian/tests/control create mode 100755 debian/tests/run-tests 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 -- 2.30.2