Package: libsdl2-mixer-dev Version: 2.0.4+dfsg1-2 Severity: wishlist Tags: patch
While backporting libsdl2-mixer to a Debian derivative I added the attached autopkgtest. It doesn't have much coverage, but it does demonstrate that the -dev package doesn't have missing dependencies and that the library doesn't immediately crash. I've found that smoke tests of this sort are surprisingly effective for detecting regressions. smcv
>From 3c1369c5be0c1ccbe1312a83684129be8f2f448c Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@collabora.com> Date: Tue, 24 Sep 2019 12:30:52 +0100 Subject: [PATCH] Add a superficial autopkgtest for libsdl2-mixer-dev This builds the two example programs, playmus and playwave, and runs them with the dummy audio backend. It doesn't provide much coverage, but does at least demonstrate that the -dev package is working correctly, without missing dependencies. Signed-off-by: Simon McVittie <s...@collabora.com> --- debian/tests/control | 7 +++++++ debian/tests/libsdl2-mixer-dev | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 debian/tests/control create mode 100755 debian/tests/libsdl2-mixer-dev diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..792ed48 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,7 @@ +Tests: libsdl2-mixer-dev +Restrictions: allow-stderr, superficial +Depends: + alsa-utils, + libsdl2-mixer-dev, + xauth, + xvfb, diff --git a/debian/tests/libsdl2-mixer-dev b/debian/tests/libsdl2-mixer-dev new file mode 100755 index 0000000..59318e1 --- /dev/null +++ b/debian/tests/libsdl2-mixer-dev @@ -0,0 +1,32 @@ +#!/bin/sh +# Copyright 2019 Collabora Ltd. +# SPDX-License-Identifier: Zlib +# (see "zlib/libpng" in debian/copyright) + +set -eux + +if [ -n "${AUTOPKGTEST_ARTIFACTS-}" ]; then + WORKDIR="$AUTOPKGTEST_ARTIFACTS" +else + WORKDIR="$(mktemp -d)" + trap 'cd /; rm -fr "$WORKDIR"' 0 INT QUIT ABRT PIPE TERM +fi + +export SDL_AUDIODRIVER=dummy + +cp playmus.c "$WORKDIR" +cp playwave.c "$WORKDIR" + +cd "$WORKDIR" + +# Deliberately word-splitting pkg-config's output: +# shellcheck disable=SC2046 +gcc -oplaymus playmus.c $(pkg-config --cflags --libs SDL2_mixer) +# shellcheck disable=SC2046 +gcc -oplaywave playwave.c $(pkg-config --cflags --libs SDL2_mixer) + +set -- xvfb-run -a + +# This audio file is shipped in the alsa-utils package +"$@" ./playmus /usr/share/sounds/alsa/Front_Center.wav +"$@" ./playwave /usr/share/sounds/alsa/Front_Center.wav -- 2.23.0