Debian Codegraph @

debian/tests/build

raw
1 #!/bin/sh
2
3 set -e
4 exec 2>&1
5 set -u
6
7 if [ -z "${HOME-}" ] || ! [ -w "${HOME}" ]; then
8 export HOME="${AUTOPKGTEST_TMP}"
9 fi
10
11 cd "$AUTOPKGTEST_TMP"
12
13 if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
14 CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
15 else
16 CROSS_COMPILE=
17 fi
18
19 echo "1..1"
20
21 cat > connect.c <<'EOF'
22 #include <stdio.h>
23
24 #include <dbus/dbus.h>
25
26 int main (void)
27 {
28 DBusError error;
29 DBusConnection *connection;
30
31 dbus_error_init(&error);
32 connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
33
34 if (connection == NULL) {
35 fprintf(stderr, "%s: %s", error.name, error.message);
36 dbus_error_free(&error);
37 return 1;
38 }
39
40 dbus_connection_unref(connection);
41 printf ("ok 1\n");
42 return 0;
43 }
44 EOF
45
46 # We don't exercise static linking because libsystemd is not available
47 # as a static library.
48
49 ${CROSS_COMPILE}gcc -o connect connect.c $(${CROSS_COMPILE}pkg-config --cflags --libs dbus-1)
50 test -x connect
51 dbus-run-session -- ./connect
52 echo "# everything seems OK"