From 4ad6e3d394b158a35d113f62e172dca94c084637 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sat, 15 Feb 2014 15:51:26 +0000 Subject: Add autopkgtest support * Hook up the installed tests to DEP-8 metadata * Add a simple compile/link/run test --- debian/changelog | 2 ++ debian/tests/build | 36 ++++++++++++++++++++++++++++++++++++ debian/tests/control | 5 +++++ debian/tests/installed-tests | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100755 debian/tests/build create mode 100644 debian/tests/control create mode 100755 debian/tests/installed-tests diff --git a/debian/changelog b/debian/changelog index b53503a5..5a5e4ee0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ dbus (1.8.0-2) UNRELEASED; urgency=medium /etc/dbus-1/system.d that calls ReloadConfig on the system dbus-daemon, in case our inotify monitoring isn't completely reliable (see #740139) * Clean debian/tmp-udeb in `debian/rules clean` + * Hook up the installed tests to DEP-8 metadata + * Add a simple compile/link/run test -- Simon McVittie Sat, 15 Feb 2014 13:43:08 +0000 diff --git a/debian/tests/build b/debian/tests/build new file mode 100755 index 00000000..1e27f1a1 --- /dev/null +++ b/debian/tests/build @@ -0,0 +1,36 @@ +#!/bin/sh + +set -e +exec 2>&1 +set -x + +cd "$ADTTMP" + +cat > connect.c < + +#include + +int main (void) +{ + DBusError error; + DBusConnection *connection; + + dbus_error_init(&error); + connection = dbus_bus_get(DBUS_BUS_SESSION, &error); + + if (connection == NULL) { + fprintf(stderr, "%s: %s", error.name, error.message); + dbus_error_free(&error); + return 1; + } + + dbus_connection_unref(connection); + return 0; +} +EOF + +gcc -o connect connect.c $(pkg-config --cflags --libs dbus-1) +test -x connect +dbus-run-session -- ./connect +echo "everything seems OK" diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 00000000..aa14ea06 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,5 @@ +Tests: installed-tests +Depends: dbus, libdbus-1-3, dbus-1-dbg, dpkg-dev + +Tests: build +Depends: libdbus-1-dev, dbus, build-essential diff --git a/debian/tests/installed-tests b/debian/tests/installed-tests new file mode 100755 index 00000000..0d9f1f6f --- /dev/null +++ b/debian/tests/installed-tests @@ -0,0 +1,33 @@ +#!/bin/sh +# installed-tests wrapper for dbus. Outputs TAP format because why not + +set -e + +multiarch="`dpkg-architecture -qDEB_HOST_MULTIARCH`" + +ret=0 +i=0 + +for dir in "/usr/lib/$multiarch/dbus-1.0/test" "/usr/lib/$multiarch/dbus-1.0/debug-build/lib/dbus-1.0/test"; do + for t in "$dir"/test-*; do + i=$(( $i + 1 )) + echo "# $i - $t ..." + echo "x" > "$ADTTMP/result" + ( set +e; $t; echo "$?" > "$ADTTMP/result" ) 2>&1 | sed 's/^/# /' + e="$(cat "$ADTTMP/result")" + case "$e" in + (0) + echo "ok $i - $t" + ;; + (77) + echo "ok $i # SKIP $t" + ;; + (*) + echo "not ok $i - $t ($e)" + ret=1 + ;; + esac + done +done + +exit $ret -- cgit v1.2.3