From 43ef01cf89ca9137fa9764f058d69aebe20fda65 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Tue, 6 Dec 2022 10:34:37 +0200 Subject: [PATCH] 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 --- tests/modules/si-node.c | 19 ++++--------------- tests/wp/object-manager.c | 21 ++++++++------------- tests/wp/proxy.c | 17 ++++++----------- 3 files changed, 18 insertions(+), 39 deletions(-) diff --git a/tests/modules/si-node.c b/tests/modules/si-node.c index 997993ed..a116a64a 100644 --- a/tests/modules/si-node.c +++ b/tests/modules/si-node.c @@ -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); diff --git a/tests/wp/object-manager.c b/tests/wp/object-manager.c index 5b174160..668b4196 100644 --- a/tests/wp/object-manager.c +++ b/tests/wp/object-manager.c @@ -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); diff --git a/tests/wp/proxy.c b/tests/wp/proxy.c index ab9e4c2f..5c2b18cc 100644 --- a/tests/wp/proxy.c +++ b/tests/wp/proxy.c @@ -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);