diff options
Diffstat (limited to 'debian/tests')
-rwxr-xr-x | debian/tests/basicmeson | 25 | ||||
-rwxr-xr-x | debian/tests/clangmeson | 20 | ||||
-rw-r--r-- | debian/tests/control | 16 | ||||
-rwxr-xr-x | debian/tests/crossbuild | 23 | ||||
-rwxr-xr-x | debian/tests/exhaustive | 12 |
5 files changed, 96 insertions, 0 deletions
diff --git a/debian/tests/basicmeson b/debian/tests/basicmeson new file mode 100755 index 0000000..1dd3a7f --- /dev/null +++ b/debian/tests/basicmeson @@ -0,0 +1,25 @@ +#!/bin/sh + +set -eu + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > meson.build +project('debian package test', 'c') +e = executable('prog', 'prog.c') +test('debtest', e) +EOF +cat <<EOF > prog.c +int main(int argc, char **argv) { + return 0; +} +EOF +mkdir build +CC=gcc meson build +cd build +ninja test +# Test that conf tools and build regeneration works. +meson introspect . --tests > /dev/null +meson configure -Dbuildtype=debugoptimized +ninja test diff --git a/debian/tests/clangmeson b/debian/tests/clangmeson new file mode 100755 index 0000000..a5f1348 --- /dev/null +++ b/debian/tests/clangmeson @@ -0,0 +1,20 @@ +#!/bin/sh + +set -eu + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > meson.build +project('debian clang package test', 'c') +e = executable('prog', 'prog.c') +test('debtest', e) +EOF +cat <<EOF > prog.c +int main(int argc, char **argv) { + return 0; +} +EOF +mkdir build +CC=clang meson build +ninja -C build test diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..9d5c596 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,16 @@ +Tests: basicmeson +Depends: meson, g++ + +Tests: clangmeson +Depends: meson, clang + +# At the time of writing the packaging machinery does not put @builddeps@ into +# autopkg deps. The tests are only automatically run when packages explicitly +# listed as Depends are uploaded. List a few major ones to make sure those +# tests are run and thus block broken uploads. +Tests: exhaustive +Depends: meson, @builddeps@, valac, rustc, ldc [!s390x !ppc64el] + +Tests: crossbuild +Depends: meson, g++, g++-arm-linux-gnueabihf +Restrictions: skip-not-installable diff --git a/debian/tests/crossbuild b/debian/tests/crossbuild new file mode 100755 index 0000000..e2796b6 --- /dev/null +++ b/debian/tests/crossbuild @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +cd "${AUTOPKGTEST_TMP:-/tmp}" +mkdir testproject +cd testproject +cat >meson.build <<EOF +project('crosstest', 'c') +executable('demo', 'main.c') +EOF +cat >main.c <<EOF +#include<stdio.h> +int main(int argc, char **argv) { + printf("Hello there.\n"); + return 0; +} +EOF +mkdir build +cd build +/usr/share/meson/debcrossgen --arch armhf -o cross-file.txt +meson --cross-file cross-file.txt .. +ninja diff --git a/debian/tests/exhaustive b/debian/tests/exhaustive new file mode 100755 index 0000000..541ff2a --- /dev/null +++ b/debian/tests/exhaustive @@ -0,0 +1,12 @@ +#!/bin/sh + +# Autopkgtests will raise an error if any +# text is written to stderr by the test. +# +# This is stupid, because many test frameworks +# such as Python's unittest, write status +# information to stderr. The only thing we can +# do is to forward it all to stdout, since +# the test runner will return a non zero +# exit code if any actual errors happened. +MESON_EXE=/usr/bin/meson ./run_tests.py 2>&1 |