|
|
|
@ -30,6 +30,7 @@
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
FuPlugin *plugin;
|
|
|
|
|
FuContext *ctx;
|
|
|
|
|
} FuTest;
|
|
|
|
|
|
|
|
|
|
static GMainLoop *_test_loop = NULL;
|
|
|
|
@ -100,7 +101,10 @@ fu_test_compare_lines (const gchar *txt1, const gchar *txt2, GError **error)
|
|
|
|
|
static void
|
|
|
|
|
fu_test_free (FuTest *self)
|
|
|
|
|
{
|
|
|
|
|
g_object_unref (self->plugin);
|
|
|
|
|
if (self->ctx != NULL)
|
|
|
|
|
g_object_unref (self->ctx);
|
|
|
|
|
if (self->plugin != NULL)
|
|
|
|
|
g_object_unref (self->plugin);
|
|
|
|
|
g_free (self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -112,11 +116,11 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuTest, fu_test_free)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_generate_md_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
const gchar *tmp;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autofree gchar *filename = NULL;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(GBytes) data = NULL;
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
@ -133,7 +137,10 @@ fu_engine_generate_md_func (gconstpointer user_data)
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
|
|
|
|
|
/* load engine and check the device was found */
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_REMOTES, &error);
|
|
|
|
|
ret = fu_engine_load (engine,
|
|
|
|
|
FU_ENGINE_LOAD_FLAG_REMOTES |
|
|
|
|
|
FU_ENGINE_LOAD_FLAG_NO_CACHE,
|
|
|
|
|
&error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
fu_device_add_guid (device, "12345678-1234-1234-1234-123456789012");
|
|
|
|
@ -162,7 +169,7 @@ fu_plugin_hash_func (gconstpointer user_data)
|
|
|
|
|
g_autoptr(FuPlugin) plugin = fu_plugin_new (NULL);
|
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NONE, &error);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
|
|
|
|
@ -368,9 +375,9 @@ fu_engine_requirements_client_pass_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_version_require_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -455,9 +462,9 @@ fu_engine_requirements_unsupported_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_child_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) child = fu_device_new ();
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
@ -512,9 +519,9 @@ fu_engine_requirements_child_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_child_fail_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) child = fu_device_new ();
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
@ -609,9 +616,9 @@ fu_engine_requirements_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_device_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -668,9 +675,9 @@ fu_engine_requirements_device_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_device_plain_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -716,9 +723,9 @@ fu_engine_requirements_device_plain_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_version_format_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -768,12 +775,12 @@ fu_engine_requirements_version_format_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_sibling_device_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) unrelated_device3 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) parent = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) unrelated_device3 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) parent = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -873,10 +880,10 @@ fu_engine_requirements_sibling_device_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_other_device_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -939,9 +946,9 @@ fu_engine_requirements_other_device_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_protocol_check_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(GPtrArray) devices = NULL;
|
|
|
|
@ -1028,10 +1035,10 @@ fu_engine_requirements_protocol_check_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_requirements_parent_device_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -1097,10 +1104,10 @@ fu_engine_requirements_parent_device_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_device_parent_guid_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device3 = fu_device_new_with_context (ctx);
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device3 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(XbSilo) silo_empty = xb_silo_new ();
|
|
|
|
|
|
|
|
|
@ -1151,11 +1158,11 @@ fu_engine_device_parent_guid_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_device_parent_id_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device3 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device4 = fu_device_new_with_context (ctx);
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device3 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device4 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(XbSilo) silo_empty = xb_silo_new ();
|
|
|
|
|
|
|
|
|
@ -1221,10 +1228,10 @@ fu_engine_device_parent_id_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_partial_hash_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuPlugin) plugin = fu_plugin_new (NULL);
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
@ -1290,10 +1297,10 @@ fu_engine_partial_hash_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_device_unlock_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autofree gchar *filename = NULL;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(GFile) file = NULL;
|
|
|
|
@ -1302,7 +1309,7 @@ fu_engine_device_unlock_func (gconstpointer user_data)
|
|
|
|
|
g_autoptr(XbSilo) silo = NULL;
|
|
|
|
|
|
|
|
|
|
/* load engine to get FuConfig set up */
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NONE, &error);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
|
|
|
|
@ -1336,10 +1343,10 @@ fu_engine_device_unlock_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_require_hwid_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autofree gchar *filename = NULL;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -1359,7 +1366,7 @@ fu_engine_require_hwid_func (gconstpointer user_data)
|
|
|
|
|
fu_engine_set_silo (engine, silo_empty);
|
|
|
|
|
|
|
|
|
|
/* load engine to get FuConfig set up */
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NONE, &error);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
|
|
|
|
@ -1402,10 +1409,10 @@ fu_engine_require_hwid_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_downgrade_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
FwupdRelease *rel;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
@ -1490,7 +1497,10 @@ fu_engine_downgrade_func (gconstpointer user_data)
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
|
|
|
|
|
g_setenv ("CONFIGURATION_DIRECTORY", TESTDATADIR_SRC, TRUE);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_REMOTES, &error);
|
|
|
|
|
ret = fu_engine_load (engine,
|
|
|
|
|
FU_ENGINE_LOAD_FLAG_REMOTES |
|
|
|
|
|
FU_ENGINE_LOAD_FLAG_NO_CACHE,
|
|
|
|
|
&error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
g_assert_cmpint (fu_engine_get_status (engine), ==, FWUPD_STATUS_IDLE);
|
|
|
|
@ -1582,10 +1592,10 @@ fu_engine_downgrade_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_engine_install_duration_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
FwupdRelease *rel;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuEngineRequest) request = fu_engine_request_new ();
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
@ -1620,7 +1630,10 @@ fu_engine_install_duration_func (gconstpointer user_data)
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
|
|
|
|
|
g_setenv ("CONFIGURATION_DIRECTORY", TESTDATADIR_SRC, TRUE);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_REMOTES, &error);
|
|
|
|
|
ret = fu_engine_load (engine,
|
|
|
|
|
FU_ENGINE_LOAD_FLAG_REMOTES |
|
|
|
|
|
FU_ENGINE_LOAD_FLAG_NO_CACHE,
|
|
|
|
|
&error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
|
|
|
|
@ -1665,9 +1678,8 @@ fu_engine_history_func (gconstpointer user_data)
|
|
|
|
|
g_autofree gchar *device_str_expected = NULL;
|
|
|
|
|
g_autofree gchar *device_str = NULL;
|
|
|
|
|
g_autofree gchar *filename = NULL;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device2 = NULL;
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuHistory) history = NULL;
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -1690,7 +1702,7 @@ fu_engine_history_func (gconstpointer user_data)
|
|
|
|
|
fu_engine_add_plugin (engine, self->plugin);
|
|
|
|
|
|
|
|
|
|
g_setenv ("CONFIGURATION_DIRECTORY", TESTDATADIR_SRC, TRUE);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NONE, &error);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
g_assert_cmpint (fu_engine_get_status (engine), ==, FWUPD_STATUS_IDLE);
|
|
|
|
@ -1800,8 +1812,7 @@ fu_engine_multiple_rels_func (gconstpointer user_data)
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autofree gchar *filename = NULL;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
|
g_autoptr(GBytes) blob_cab = NULL;
|
|
|
|
@ -1820,7 +1831,7 @@ fu_engine_multiple_rels_func (gconstpointer user_data)
|
|
|
|
|
fu_engine_add_plugin (engine, self->plugin);
|
|
|
|
|
|
|
|
|
|
g_setenv ("CONFIGURATION_DIRECTORY", TESTDATADIR_SRC, TRUE);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NONE, &error);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
g_assert_cmpint (fu_engine_get_status (engine), ==, FWUPD_STATUS_IDLE);
|
|
|
|
@ -1876,8 +1887,7 @@ fu_engine_history_inherit (gconstpointer user_data)
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autofree gchar *filename = NULL;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
|
g_autoptr(GBytes) blob_cab = NULL;
|
|
|
|
@ -1894,7 +1904,7 @@ fu_engine_history_inherit (gconstpointer user_data)
|
|
|
|
|
g_setenv ("FWUPD_PLUGIN_TEST", "fail", TRUE);
|
|
|
|
|
fu_engine_add_plugin (engine, self->plugin);
|
|
|
|
|
g_setenv ("CONFIGURATION_DIRECTORY", TESTDATADIR_SRC, TRUE);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NONE, &error);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
g_assert_cmpint (fu_engine_get_status (engine), ==, FWUPD_STATUS_IDLE);
|
|
|
|
@ -1967,7 +1977,7 @@ fu_engine_history_inherit (gconstpointer user_data)
|
|
|
|
|
engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
fu_engine_set_silo (engine, silo_empty);
|
|
|
|
|
fu_engine_add_plugin (engine, self->plugin);
|
|
|
|
|
device = fu_device_new_with_context (ctx);
|
|
|
|
|
device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
fu_device_add_internal_flag (device, FU_DEVICE_INTERNAL_FLAG_INHERIT_ACTIVATION);
|
|
|
|
|
fu_device_set_id (device, "test_device");
|
|
|
|
|
fu_device_add_vendor_id (device, "USB:FFFF");
|
|
|
|
@ -1985,7 +1995,7 @@ fu_engine_history_inherit (gconstpointer user_data)
|
|
|
|
|
engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
fu_engine_set_silo (engine, silo_empty);
|
|
|
|
|
fu_engine_add_plugin (engine, self->plugin);
|
|
|
|
|
device = fu_device_new_with_context (ctx);
|
|
|
|
|
device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
fu_device_set_id (device, "test_device");
|
|
|
|
|
fu_device_add_vendor_id (device, "USB:FFFF");
|
|
|
|
|
fu_device_add_protocol (device, "com.acme");
|
|
|
|
@ -2007,9 +2017,8 @@ fu_engine_history_error_func (gconstpointer user_data)
|
|
|
|
|
g_autofree gchar *device_str_expected = NULL;
|
|
|
|
|
g_autofree gchar *device_str = NULL;
|
|
|
|
|
g_autofree gchar *filename = NULL;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device2 = NULL;
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuEngine) engine = fu_engine_new (FU_APP_FLAGS_NONE);
|
|
|
|
|
g_autoptr(FuHistory) history = NULL;
|
|
|
|
|
g_autoptr(FuInstallTask) task = NULL;
|
|
|
|
@ -2029,7 +2038,7 @@ fu_engine_history_error_func (gconstpointer user_data)
|
|
|
|
|
fu_engine_add_plugin (engine, self->plugin);
|
|
|
|
|
|
|
|
|
|
g_setenv ("CONFIGURATION_DIRECTORY", TESTDATADIR_SRC, TRUE);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NONE, &error);
|
|
|
|
|
ret = fu_engine_load (engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert (ret);
|
|
|
|
|
g_assert_cmpint (fu_engine_get_status (engine), ==, FWUPD_STATUS_IDLE);
|
|
|
|
@ -2151,9 +2160,9 @@ fu_device_list_no_auto_remove_children_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_device_list_delay_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDeviceList) device_list = fu_device_list_new ();
|
|
|
|
|
guint added_cnt = 0;
|
|
|
|
|
guint changed_cnt = 0;
|
|
|
|
@ -2294,10 +2303,10 @@ fu_device_list_replug_auto_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_device_list_replug_user_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDeviceList) device_list = fu_device_list_new ();
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
FuDeviceListReplugHelper helper;
|
|
|
|
@ -2369,9 +2378,9 @@ fu_device_list_replug_user_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_device_list_compatible_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device_old = NULL;
|
|
|
|
|
g_autoptr(FuDeviceList) device_list = fu_device_list_new ();
|
|
|
|
|
g_autoptr(GPtrArray) devices_all = NULL;
|
|
|
|
@ -2451,10 +2460,10 @@ fu_device_list_compatible_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_device_list_remove_chain_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
g_autoptr(FuDeviceList) device_list = fu_device_list_new ();
|
|
|
|
|
g_autoptr(FuDevice) device_child = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device_parent = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device_child = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device_parent = fu_device_new_with_context (self->ctx);
|
|
|
|
|
|
|
|
|
|
guint added_cnt = 0;
|
|
|
|
|
guint changed_cnt = 0;
|
|
|
|
@ -2499,10 +2508,10 @@ fu_device_list_remove_chain_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_device_list_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
g_autoptr(FuDeviceList) device_list = fu_device_list_new ();
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (ctx);
|
|
|
|
|
g_autoptr(FuDevice) device1 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(FuDevice) device2 = fu_device_new_with_context (self->ctx);
|
|
|
|
|
g_autoptr(GPtrArray) devices = NULL;
|
|
|
|
|
g_autoptr(GPtrArray) devices2 = NULL;
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
@ -2851,12 +2860,12 @@ fu_plugin_module_func (gconstpointer user_data)
|
|
|
|
|
static void
|
|
|
|
|
fu_history_func (gconstpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
FuTest *self = (FuTest *) user_data;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
GPtrArray *checksums;
|
|
|
|
|
gboolean ret;
|
|
|
|
|
FuDevice *device;
|
|
|
|
|
FwupdRelease *release;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuDevice) device_found = NULL;
|
|
|
|
|
g_autoptr(FuHistory) history = NULL;
|
|
|
|
|
g_autoptr(GPtrArray) approved_firmware = NULL;
|
|
|
|
@ -2875,7 +2884,7 @@ fu_history_func (gconstpointer user_data)
|
|
|
|
|
g_unlink (filename);
|
|
|
|
|
|
|
|
|
|
/* add a device */
|
|
|
|
|
device = fu_device_new_with_context (ctx);
|
|
|
|
|
device = fu_device_new_with_context (self->ctx);
|
|
|
|
|
fu_device_set_id (device, "self-test");
|
|
|
|
|
fu_device_set_name (device, "ColorHug"),
|
|
|
|
|
fu_device_set_version_format (device, FWUPD_VERSION_FORMAT_TRIPLET);
|
|
|
|
@ -3348,7 +3357,6 @@ main (int argc, char **argv)
|
|
|
|
|
gboolean ret;
|
|
|
|
|
g_autofree gchar *pluginfn = NULL;
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FuContext) ctx = fu_context_new ();
|
|
|
|
|
g_autoptr(FuTest) self = g_new0 (FuTest, 1);
|
|
|
|
|
|
|
|
|
|
g_test_init (&argc, &argv, NULL);
|
|
|
|
@ -3367,8 +3375,14 @@ main (int argc, char **argv)
|
|
|
|
|
/* ensure empty tree */
|
|
|
|
|
fu_self_test_mkroot ();
|
|
|
|
|
|
|
|
|
|
/* do not save silo */
|
|
|
|
|
self->ctx = fu_context_new ();
|
|
|
|
|
ret = fu_context_load_quirks (self->ctx, FU_QUIRKS_LOAD_FLAG_NO_CACHE, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert_true (ret);
|
|
|
|
|
|
|
|
|
|
/* load the test plugin */
|
|
|
|
|
self->plugin = fu_plugin_new (ctx);
|
|
|
|
|
self->plugin = fu_plugin_new (self->ctx);
|
|
|
|
|
pluginfn = g_build_filename (PLUGINBUILDDIR,
|
|
|
|
|
"libfu_plugin_test." G_MODULE_SUFFIX,
|
|
|
|
|
NULL);
|
|
|
|
|