summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:39 +0000
commit289262a517ab91e32d5982dee4c1cdc9c9d7e75a (patch)
tree4fec5a9696c211c3e5cc570327077f5ba290b6d4 /debian/tests
parentAdding upstream version 1.0.1. (diff)
downloadmeson-289262a517ab91e32d5982dee4c1cdc9c9d7e75a.tar.xz
meson-289262a517ab91e32d5982dee4c1cdc9c9d7e75a.zip
Adding debian version 1.0.1-5.debian/1.0.1-5debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests')
-rwxr-xr-xdebian/tests/basicmeson25
-rwxr-xr-xdebian/tests/clangmeson20
-rw-r--r--debian/tests/control16
-rwxr-xr-xdebian/tests/crossbuild23
-rwxr-xr-xdebian/tests/exhaustive12
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