Autotest: Check if this D-Bus library knows about file descriptors

Because if it doesn't, then calling dbus_type_is_fixed or is_basic may
result in a failed assertion.

 process 16304: arguments to dbus_type_is_fixed() were incorrect,
 assertion "_dbus_type_is_valid (typecode) || typecode ==
 DBUS_TYPE_INVALID" failed in file dbus-signature.c line 345.

Change-Id: Idf715b895bac4d56b4afffff13db2ed71b1516a5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
This commit is contained in:
Thiago Macieira 2015-05-04 18:20:07 -07:00 committed by Allan Sandfeld Jensen
parent 9f4fb617e2
commit 3545ef4121

View File

@ -87,8 +87,19 @@ static void addFixedTypes()
QTest::newRow("int64") << DBUS_TYPE_INT64_AS_STRING << true << true;
QTest::newRow("uint64") << DBUS_TYPE_UINT64_AS_STRING << true << true;
QTest::newRow("double") << DBUS_TYPE_DOUBLE_AS_STRING << true << true;
#ifdef DBUS_TYPE_UNIX_FD_AS_STRING
QTest::newRow("unixfd") << DBUS_TYPE_UNIX_FD_AS_STRING << true << true;
# ifndef QT_LINKED_LIBDBUS
// We have got the macro from dbus_minimal_p.h, so we need to check if
// the library recognizes this as valid type first.
// The following function was added for Unix FD support, so if it is
// present, so is support for Unix FDs.
bool supportsUnixFds = qdbus_resolve_conditionally("dbus_connection_can_send_type");
# else
bool supportsUnixFds = true;
# endif
if (supportsUnixFds)
QTest::newRow("unixfd") << DBUS_TYPE_UNIX_FD_AS_STRING << true << true;
#endif
}