Source: libwacom Version: 0.32-1 Severity: wishlist Tags: patch libwacom doesn't currently have any autopkgtests. One form of test coverage that is very easy to provide is to link an executable against the library that it provides, and check that it can compile, link and run.
This kind of test can detect surprisingly many packaging issues, both in the library under test and in its dependencies, before they become RC bugs: for example, it can detect missing dependencies on the -dev packages of other libraries mentioned in the pkg-config metadata. Please consider the attached patch. (Of course, having non-trivial test coverage for the installed library, perhaps similar to <https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests>, would be even better - but that would require writing a lot more code.) I initially tried to make the test exercise static linking too, but this turns out not to work, because libwacom depends on GLib, which depends on libudev, which is not available as a static library. This might indicate that the static library libwacom.a is not practically useful and could be dropped. smcv
>From 5a0283ebccfa92078ed6f7b8f0226d39da6fa631 Mon Sep 17 00:00:00 2001 From: Simon McVittie <[email protected]> Date: Thu, 22 Aug 2019 11:35:55 +0100 Subject: [PATCH 1/2] d/tests: Add a superficial test for linking with libwacom This ensures that the library and pkg-config metadata are installed correctly. Signed-off-by: Simon McVittie <[email protected]> --- debian/tests/build | 35 +++++++++++++++++++++++++++++++++++ debian/tests/control | 3 +++ 2 files changed, 38 insertions(+) create mode 100755 debian/tests/build create mode 100644 debian/tests/control diff --git a/debian/tests/build b/debian/tests/build new file mode 100755 index 0000000..c8e17a7 --- /dev/null +++ b/debian/tests/build @@ -0,0 +1,35 @@ +#!/bin/sh + +set -e +exec 2>&1 +set -u + +cd "$AUTOPKGTEST_TMP" + +echo "1..1" + +cat > trivial.c <<'EOF' +#include <assert.h> + +#include <libwacom/libwacom.h> + +int main (void) +{ + WacomDeviceDatabase *db; + + db = libwacom_database_new(); + assert(db != NULL); + libwacom_database_destroy(db); + return 0; +} +EOF + +# Deliberately word-splitting, that's how pkg-config works: +# shellcheck disable=SC2046 +gcc -o trivial trivial.c $(pkg-config --cflags --libs libwacom) +test -x trivial +./trivial +echo "ok 1" + +# Static linking not tested here: libwacom depends on libudev which is +# not available as a static library diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..60efa07 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +Tests: build +Depends: build-essential, libwacom-dev +Restrictions: superficial -- 2.23.0

