Commit 484c489a authored by Julian Bouzas's avatar Julian Bouzas
Browse files

tests: fix coverity scan side effect in assertion issues

parent 7bbfcfad
Pipeline #346996 passed with stages
in 1 minute and 12 seconds
......@@ -112,8 +112,8 @@ test_si_audio_endpoint_export (TestFixture * f, gconstpointer user_data)
G_CALLBACK (g_main_loop_quit), f->base.loop);
wp_core_install_object_manager (f->base.core, clients_om);
g_main_loop_run (f->base.loop);
g_assert_nonnull (self_client =
wp_object_manager_lookup (clients_om, WP_TYPE_CLIENT, NULL));
self_client = wp_object_manager_lookup (clients_om, WP_TYPE_CLIENT, NULL);
g_assert_nonnull (self_client);
/* create endpoint */
......@@ -144,10 +144,10 @@ test_si_audio_endpoint_export (TestFixture * f, gconstpointer user_data)
g_autoptr (WpEndpoint) ep = NULL;
g_autoptr (WpProperties) props = NULL;
g_assert_nonnull (
ep = wp_session_item_get_associated_proxy (endpoint, WP_TYPE_ENDPOINT));
g_assert_nonnull (
props = wp_pipewire_object_get_properties (WP_PIPEWIRE_OBJECT (ep)));
ep = wp_session_item_get_associated_proxy (endpoint, WP_TYPE_ENDPOINT);
g_assert_nonnull (ep);
props = wp_pipewire_object_get_properties (WP_PIPEWIRE_OBJECT (ep));
g_assert_nonnull (props);
g_assert_cmpstr (wp_endpoint_get_name (ep), ==, "endpoint");
g_assert_cmpstr (wp_endpoint_get_media_class (ep), ==,
......
......@@ -137,7 +137,8 @@ test_si_node_configure_activate (TestFixture * f, gconstpointer user_data)
WpProxy *port;
g_assert_true (wp_iterator_next (it, &val));
g_assert_nonnull (port = g_value_get_object (&val));
port = g_value_get_object (&val);
g_assert_nonnull (port);
g_assert_cmpuint (port_id, ==, wp_proxy_get_bound_id (port));
}
}
......
......@@ -144,12 +144,14 @@ test_si_standard_link_main (TestFixture * f, gconstpointer user_data)
test_ensure_object_manager_is_installed (om, f->base.core,
f->base.loop);
g_assert_nonnull (out_node = wp_object_manager_lookup (om, WP_TYPE_NODE,
out_node = wp_object_manager_lookup (om, WP_TYPE_NODE,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "node.name", "=s", "audiotestsrc",
NULL));
g_assert_nonnull (in_node = wp_object_manager_lookup (om, WP_TYPE_NODE,
NULL);
g_assert_nonnull (out_node);
in_node = wp_object_manager_lookup (om, WP_TYPE_NODE,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "node.name", "=s", "support.null-audio-sink",
NULL));
NULL);
g_assert_nonnull (in_node);
g_assert_cmpuint (wp_object_manager_get_n_objects (om), ==, 8);
it = wp_object_manager_new_filtered_iterator (om, WP_TYPE_LINK, NULL);
......@@ -162,14 +164,16 @@ test_si_standard_link_main (TestFixture * f, gconstpointer user_data)
&in_pt_id);
g_assert_cmpuint (out_nd_id, ==, wp_proxy_get_bound_id (WP_PROXY (out_node)));
g_assert_cmpuint (in_nd_id, ==, wp_proxy_get_bound_id (WP_PROXY (in_node)));
g_assert_nonnull (out_port = wp_object_manager_lookup (om, WP_TYPE_PORT,
out_port = wp_object_manager_lookup (om, WP_TYPE_PORT,
WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", out_pt_id,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "node.id", "=u", out_nd_id,
NULL));
g_assert_nonnull (in_port = wp_object_manager_lookup (om, WP_TYPE_PORT,
NULL);
g_assert_nonnull (out_port);
in_port = wp_object_manager_lookup (om, WP_TYPE_PORT,
WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", in_pt_id,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "node.id", "=u", in_nd_id,
NULL));
NULL);
g_assert_nonnull (in_port);
total_links++;
}
g_assert_cmpuint (total_links, ==, 2);
......@@ -195,19 +199,24 @@ test_si_standard_link_main (TestFixture * f, gconstpointer user_data)
test_ensure_object_manager_is_installed (om, f->base.core,
f->base.loop);
g_assert_nonnull (out_node = wp_object_manager_lookup (om, WP_TYPE_NODE,
out_node = wp_object_manager_lookup (om, WP_TYPE_NODE,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "node.name", "=s", "audiotestsrc",
NULL));
g_assert_nonnull (in_node = wp_object_manager_lookup (om, WP_TYPE_NODE,
NULL);
g_assert_nonnull (out_node);
in_node = wp_object_manager_lookup (om, WP_TYPE_NODE,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "node.name", "=s", "support.null-audio-sink",
NULL));
g_assert_nonnull (out_port = wp_object_manager_lookup (om, WP_TYPE_PORT,
NULL);
g_assert_nonnull (in_node);
out_port = wp_object_manager_lookup (om, WP_TYPE_PORT,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "port.direction", "=s", "out",
NULL));
g_assert_nonnull (in_port = wp_object_manager_lookup (om, WP_TYPE_PORT,
NULL);
g_assert_nonnull (out_port);
in_port = wp_object_manager_lookup (om, WP_TYPE_PORT,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "port.direction", "=s", "in",
NULL));
g_assert_null (link = wp_object_manager_lookup (om, WP_TYPE_LINK, NULL));
NULL);
g_assert_nonnull (in_port);
link = wp_object_manager_lookup (om, WP_TYPE_LINK, NULL);
g_assert_null (link);
g_assert_cmpuint (wp_object_manager_get_n_objects (om), ==, 6);
}
}
......
......@@ -543,7 +543,8 @@ test_endpoint_with_props (TestEndpointFixture *fixture, gconstpointer data)
g_assert_nonnull (iterator);
g_assert_true (wp_iterator_next (iterator, &item));
g_assert_nonnull ((pod = g_value_dup_boxed (&item)));
pod = g_value_dup_boxed (&item);
g_assert_nonnull (pod);
g_assert_true (wp_spa_pod_get_object (pod, NULL,
"volume", "f", &float_value,
......
......@@ -104,7 +104,8 @@ test_node_enum_params_done (WpPipewireObject *node, GAsyncResult *res,
for (; wp_iterator_next (params, &item); g_value_unset (&item)) {
WpSpaPod *pod = NULL;
g_assert_cmpuint (G_VALUE_TYPE (&item), ==, WP_TYPE_SPA_POD);
g_assert_nonnull (pod = g_value_get_boxed (&item));
pod = g_value_get_boxed (&item);
g_assert_nonnull (pod);
g_assert_true (wp_spa_pod_is_object (pod));
g_assert_cmpuint (wp_spa_type_from_name ("Spa:Pod:Object:Param:PropInfo"),
==, wp_spa_pod_get_spa_type (pod));
......@@ -151,24 +152,26 @@ test_node (TestFixture *f, gconstpointer data)
/* info */
{
g_assert_nonnull (info = wp_pipewire_object_get_native_info (proxy));
info = wp_pipewire_object_get_native_info (proxy);
g_assert_nonnull (info);
g_assert_cmpint (wp_proxy_get_bound_id (WP_PROXY (proxy)), ==, info->id);
}
/* properties */
{
const gchar *id;
g_assert_nonnull(id =
wp_pipewire_object_get_property (proxy, PW_KEY_OBJECT_ID));
const gchar *id = wp_pipewire_object_get_property (proxy, PW_KEY_OBJECT_ID);
g_assert_nonnull (id);
g_assert_cmpint (info->id, ==, atoi(id));
}
{
const char *id;
g_autoptr (WpProperties) props = wp_pipewire_object_get_properties (proxy);
g_autoptr (WpProperties) props = NULL;
props = wp_pipewire_object_get_properties (proxy);
g_assert_nonnull (props);
g_assert_true (wp_properties_peek_dict (props) == info->props);
g_assert_nonnull (id = wp_properties_get (props, PW_KEY_OBJECT_ID));
id = wp_properties_get (props, PW_KEY_OBJECT_ID);
g_assert_nonnull (id);
g_assert_cmpint (info->id, ==, atoi(id));
}
......
......@@ -52,6 +52,7 @@ test_wpipc_protocol ()
g_assert_true (wpipc_protocol_is_reply_ok (b, sizeof(b)));
const struct spa_pod *value = NULL;
g_assert_true (wpipc_protocol_parse_reply_ok (b, sizeof(b), &value));
g_assert_nonnull (value);
g_assert_true (spa_pod_is_none (value));
}
......
......@@ -265,7 +265,8 @@ test_wplua_construct ()
g_assert_cmpint (lua_getglobal (L, "o"), ==, LUA_TUSERDATA);
g_assert_true (wplua_checkobject (L, -1, TEST_TYPE_OBJECT));
g_assert_nonnull ((obj = wplua_toobject (L, -1)));
obj = wplua_toobject (L, -1);
g_assert_nonnull (obj);
g_object_ref (obj);
g_assert_cmpint (obj->ref_count, ==, 2);
......@@ -298,7 +299,8 @@ test_wplua_properties ()
g_assert_cmpint (lua_getglobal (L, "o"), ==, LUA_TUSERDATA);
g_assert_true (wplua_checkobject (L, -1, TEST_TYPE_OBJECT));
g_assert_nonnull ((obj = wplua_toobject (L, -1)));
obj = wplua_toobject (L, -1);
g_assert_nonnull (obj);
g_assert_cmpstr (obj->test_string, ==, "string from lua");
g_assert_cmpint (obj->test_int, ==, -15);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment