diff options
author | Simon McVittie <smcv@debian.org> | 2014-02-15 15:51:26 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2014-02-26 13:10:09 +0000 |
commit | 4ad6e3d394b158a35d113f62e172dca94c084637 (patch) | |
tree | 87876684e35a363382667d3943ef1c5393969831 | |
parent | 51ccc8bd96baa1b75d5601d36a1862008c4dbb9c (diff) | |
download | dbus-4ad6e3d394b158a35d113f62e172dca94c084637.tar.gz |
Add autopkgtest support
* Hook up the installed tests to DEP-8 metadata
* Add a simple compile/link/run test
-rw-r--r-- | debian/changelog | 2 | ||||
-rwxr-xr-x | debian/tests/build | 36 | ||||
-rw-r--r-- | debian/tests/control | 5 | ||||
-rwxr-xr-x | debian/tests/installed-tests | 33 |
4 files changed, 76 insertions, 0 deletions
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 <smcv@debian.org> 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 <<EOF +#include <stdio.h> + +#include <dbus/dbus.h> + +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 |