mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-15 20:31:59 +00:00
Validate that the dbus system bus is available before running libfwupd tests
In a chroot (or buildd) environment dbus isn't necessarily available so this test will always fail.
This commit is contained in:
parent
661cd75b41
commit
e6e445ee4c
@ -193,6 +193,19 @@ fwupd_client_updates_func (void)
|
|||||||
g_assert_cmpstr (fwupd_result_get_device_id (res), !=, NULL);
|
g_assert_cmpstr (fwupd_result_get_device_id (res), !=, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
valid_dbus(void)
|
||||||
|
{
|
||||||
|
GDBusConnection *conn;
|
||||||
|
conn = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
|
||||||
|
if (conn != NULL) {
|
||||||
|
g_object_unref (conn);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
g_debug("D-Bus system bus unavailable, skipping tests.");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -204,8 +217,9 @@ main (int argc, char **argv)
|
|||||||
/* tests go here */
|
/* tests go here */
|
||||||
g_test_add_func ("/fwupd/enums", fwupd_enums_func);
|
g_test_add_func ("/fwupd/enums", fwupd_enums_func);
|
||||||
g_test_add_func ("/fwupd/result", fwupd_result_func);
|
g_test_add_func ("/fwupd/result", fwupd_result_func);
|
||||||
|
if (valid_dbus()) {
|
||||||
g_test_add_func ("/fwupd/client{devices}", fwupd_client_devices_func);
|
g_test_add_func ("/fwupd/client{devices}", fwupd_client_devices_func);
|
||||||
g_test_add_func ("/fwupd/client{updates}", fwupd_client_updates_func);
|
g_test_add_func ("/fwupd/client{updates}", fwupd_client_updates_func);
|
||||||
|
}
|
||||||
return g_test_run ();
|
return g_test_run ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user