aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2023-04-25 16:15:16 +0200
committerPaul Adenot <[email protected]>2023-04-26 14:28:46 +0200
commit0e7f41d6ef4579901faac04662780d1855b6b2ff (patch)
treea562e9b7ac76578ef627e63e737c0e3a69c29558 /test
parentd478bff5fb4f44616dd620d27a2e80b5ca8464ed (diff)
downloadcubeb-0e7f41d6ef4579901faac04662780d1855b6b2ff.tar.gz
cubeb-0e7f41d6ef4579901faac04662780d1855b6b2ff.zip
Don't run test_loopback and test_duplex on backends that can't open audio input
Diffstat (limited to 'test')
-rw-r--r--test/test_duplex.cpp12
-rw-r--r--test/test_loopback.cpp6
2 files changed, 18 insertions, 0 deletions
diff --git a/test/test_duplex.cpp b/test/test_duplex.cpp
index 5eda95f..81efcd3 100644
--- a/test/test_duplex.cpp
+++ b/test/test_duplex.cpp
@@ -184,6 +184,12 @@ TEST(cubeb, duplex_collection_change)
std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(
ctx, cubeb_destroy);
+ /* This test needs an available input device, skip it if this host does not
+ * have one. */
+ if (!can_run_audio_input_test(ctx)) {
+ return;
+ }
+
duplex_collection_change_impl(ctx);
r = cubeb_register_device_collection_changed(
ctx, static_cast<cubeb_device_type>(CUBEB_DEVICE_TYPE_INPUT), nullptr,
@@ -201,6 +207,12 @@ TEST(cubeb, duplex_collection_change_no_unregister)
std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(
ctx, [](cubeb * p) noexcept { EXPECT_DEATH(cubeb_destroy(p), ""); });
+ /* This test needs an available input device, skip it if this host does not
+ * have one. */
+ if (!can_run_audio_input_test(ctx)) {
+ return;
+ }
+
duplex_collection_change_impl(ctx);
}
diff --git a/test/test_loopback.cpp b/test/test_loopback.cpp
index ce29d6e..e2c8343 100644
--- a/test/test_loopback.cpp
+++ b/test/test_loopback.cpp
@@ -267,6 +267,12 @@ void run_loopback_duplex_test(bool is_float)
std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);
+ /* This test needs an available input device, skip it if this host does not
+ * have one. */
+ if (!can_run_audio_input_test(ctx)) {
+ return;
+ }
+
input_params.format = is_float ? CUBEB_SAMPLE_FLOAT32NE : CUBEB_SAMPLE_S16LE;
input_params.rate = SAMPLE_FREQUENCY;
input_params.channels = 1;