From 400dc652f6422b4907baeeaa836d280a0d88f8a5 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Tue, 25 Apr 2023 16:41:15 +0200 Subject: [PATCH] Skip a couple more tests when a backend can't use audio input --- test/test_duplex.cpp | 6 ++++-- test/test_loopback.cpp | 14 +++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/test/test_duplex.cpp b/test/test_duplex.cpp index 81efcd3..1eb661e 100644 --- a/test/test_duplex.cpp +++ b/test/test_duplex.cpp @@ -204,15 +204,17 @@ TEST(cubeb, duplex_collection_change_no_unregister) r = common_init(&ctx, "Cubeb duplex example with collection change"); ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library"; - std::unique_ptr 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)) { + cubeb_destroy(ctx); return; } + std::unique_ptr cleanup_cubeb_at_exit( + ctx, [](cubeb * p) noexcept { EXPECT_DEATH(cubeb_destroy(p), ""); }); + duplex_collection_change_impl(ctx); } diff --git a/test/test_loopback.cpp b/test/test_loopback.cpp index e2c8343..bbb9409 100644 --- a/test/test_loopback.cpp +++ b/test/test_loopback.cpp @@ -346,6 +346,10 @@ void run_loopback_separate_streams_test(bool is_float) std::unique_ptr cleanup_cubeb_at_exit(ctx, cubeb_destroy); + 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; @@ -429,6 +433,10 @@ void run_loopback_silence_test(bool is_float) std::unique_ptr cleanup_cubeb_at_exit(ctx, cubeb_destroy); + 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; @@ -489,13 +497,13 @@ void run_loopback_device_selection_test(bool is_float) r = common_init(&ctx, "Cubeb loopback example: device selection, separate streams"); ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library"; + std::unique_ptr + cleanup_cubeb_at_exit(ctx, cubeb_destroy); + if (!can_run_audio_input_test(ctx)) { return; } - std::unique_ptr - cleanup_cubeb_at_exit(ctx, cubeb_destroy); - r = cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection); if (r == CUBEB_ERROR_NOT_SUPPORTED) { fprintf(stderr, "Device enumeration not supported"