tests: stop using fake{sink,src} to avoid skipping tests

fakesink/fakesrc are not installed by default with pipewire;
use audiotestsrc and null-sink instead, which are always available
This commit is contained in:
George Kiagiadakis 2022-12-06 10:34:37 +02:00
parent 7a808c0202
commit 43ef01cf89
3 changed files with 18 additions and 39 deletions

View file

@ -30,8 +30,6 @@ test_si_node_setup (TestFixture * f, gconstpointer user_data)
g_autoptr (WpTestServerLocker) lock =
wp_test_server_locker_new (&f->base.server);
g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context,
"fake*", "test/libspa-test"), ==, 0);
g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context,
"audiotestsrc", "audiotestsrc/libspa-audiotestsrc"), ==, 0);
g_assert_nonnull (pw_context_load_module (f->base.server.context,
@ -188,11 +186,8 @@ main (gint argc, gchar *argv[])
/* data */
const TestData fakesink_data = {
"fakesink", "fakesink0", "Fake/Sink", "Fake/Sink", WP_DIRECTION_INPUT
};
const TestData fakesrc_data = {
"fakesrc", "fakesrc0", "Fake/Source", "Fake/Source", WP_DIRECTION_OUTPUT
const TestData nullsink_data = {
"support.null-audio-sink", "nullsink0", "Fake/Sink", "Fake/Sink", WP_DIRECTION_INPUT
};
const TestData audiotestsrc_data = {
"audiotestsrc", "audiotestsrc0", "Audio/Source", "Audio/Source", WP_DIRECTION_OUTPUT
@ -200,14 +195,8 @@ main (gint argc, gchar *argv[])
/* configure-activate */
g_test_add ("/modules/si-node/configure-activate/fakesink",
TestFixture, &fakesink_data,
test_si_node_setup,
test_si_node_configure_activate,
test_si_node_teardown);
g_test_add ("/modules/si-node/configure-activate/fakesrc",
TestFixture, &fakesrc_data,
g_test_add ("/modules/si-node/configure-activate/nullsink",
TestFixture, &nullsink_data,
test_si_node_setup,
test_si_node_configure_activate,
test_si_node_teardown);

View file

@ -31,28 +31,23 @@ test_om_interest_on_pw_props (TestFixture *f, gconstpointer user_data)
g_autoptr (WpNode) node = NULL;
g_autoptr (WpObjectManager) om = NULL;
/* load audiotestsrc on the server side */
/* load modules on the server side */
{
g_autoptr (WpTestServerLocker) lock =
wp_test_server_locker_new (&f->base.server);
g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context,
"fake*", "test/libspa-test"), ==, 0);
if (!test_is_spa_lib_installed (&f->base, "fakesink")) {
g_test_skip ("The pipewire fakesink factory was not found");
return;
}
"audiotestsrc", "audiotestsrc/libspa-audiotestsrc"), ==, 0);
g_assert_nonnull (pw_context_load_module (f->base.server.context,
"libpipewire-module-spa-node-factory", NULL, NULL));
"libpipewire-module-adapter", NULL, NULL));
}
/* export node on the client core */
node = wp_node_new_from_factory (f->base.client_core,
"spa-node-factory",
"adapter",
wp_properties_new (
"factory.name", "fakesink",
"node.name", "Fakesink",
"factory.name", "audiotestsrc",
"node.name", "Test Source",
"test.answer", "42",
NULL));
g_assert_nonnull (node);
@ -68,7 +63,7 @@ test_om_interest_on_pw_props (TestFixture *f, gconstpointer user_data)
/* request that node from the base core */
om = wp_object_manager_new ();
wp_object_manager_add_interest (om, WP_TYPE_NODE,
WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY, "node.name", "=s", "Fakesink",
WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY, "node.name", "=s", "Test Source",
WP_CONSTRAINT_TYPE_PW_PROPERTY, "test.answer", "=s", "42",
NULL);
test_ensure_object_manager_is_installed (om, f->base.core, f->base.loop);
@ -79,7 +74,7 @@ test_om_interest_on_pw_props (TestFixture *f, gconstpointer user_data)
/* request "test.answer" to be absent... this will not match */
om = wp_object_manager_new ();
wp_object_manager_add_interest (om, WP_TYPE_NODE,
WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY, "node.name", "=s", "Fakesink",
WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY, "node.name", "=s", "Test Source",
WP_CONSTRAINT_TYPE_PW_PROPERTY, "test.answer", "-",
NULL);
test_ensure_object_manager_is_installed (om, f->base.core, f->base.loop);

View file

@ -262,21 +262,16 @@ test_enum_params_error (TestFixture *f, gconstpointer data)
wp_test_server_locker_new (&f->base.server);
g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context,
"fake*", "test/libspa-test"), ==, 0);
if (!test_is_spa_lib_installed (&f->base, "fakesink")) {
g_test_skip ("The pipewire fakesink factory was not found");
return;
}
"audiotestsrc", "audiotestsrc/libspa-audiotestsrc"), ==, 0);
g_assert_nonnull (pw_context_load_module (f->base.server.context,
"libpipewire-module-spa-node-factory", NULL, NULL));
"libpipewire-module-adapter", NULL, NULL));
}
node = wp_node_new_from_factory (f->base.core,
"spa-node-factory",
"adapter",
wp_properties_new (
"factory.name", "fakesink",
"node.name", "Fakesink",
"factory.name", "audiotestsrc",
"node.name", "audiotestsrc",
NULL));
g_assert_nonnull (node);
@ -284,7 +279,7 @@ test_enum_params_error (TestFixture *f, gconstpointer data)
NULL, (GAsyncReadyCallback) test_object_activate_finish_cb, f);
g_main_loop_run (f->base.loop);
/* EnumRoute doesn't exist on fakesink, obviously */
/* EnumRoute doesn't exist on audiotestsrc, obviously */
wp_pipewire_object_enum_params (WP_PIPEWIRE_OBJECT (node), "EnumRoute", NULL,
NULL, (GAsyncReadyCallback) enum_params_error_cb, f);
g_main_loop_run (f->base.loop);