From 87da0fb09463beb67361e25c2ec688a4156318c3 Mon Sep 17 00:00:00 2001 From: Hunter Date: Tue, 27 Feb 2024 00:25:18 -0800 Subject: [PATCH] Switched tests to AIFF, My test format + wav_source + -O3 optomization causes error --- 3rdparty/SConscript | 10 +--- debian/copyright | 6 ++ src/tests/roc_sndio/test_backend_sink.cpp | 22 ++++---- src/tests/roc_sndio/test_backend_source.cpp | 62 ++++++++++++++++----- src/tests/roc_sndio/test_pump.cpp | 8 +-- 5 files changed, 69 insertions(+), 39 deletions(-) diff --git a/3rdparty/SConscript b/3rdparty/SConscript index 183a6e30f..2ce2cfe81 100644 --- a/3rdparty/SConscript +++ b/3rdparty/SConscript @@ -236,19 +236,11 @@ elif 'speexdsp' in system_dependencies: # dep: sndfile if 'sndfile' in autobuild_dependencies: - #sndfile_deps = [] - # DELETE? env.BuildThirdParty(thirdparty_versions, 'sndfile') conf = Configure(env, custom_tests=env.CustomTests) - #if not 'alsa' in autobuild_dependencies: - # for lib in [ - # 'asound', - # ]: - # conf.CheckLib(lib) - env = conf.Finish() elif 'sndfile' in system_dependencies: @@ -259,7 +251,7 @@ elif 'sndfile' in system_dependencies: if not is_crosscompiling: if not conf.CheckLibWithHeaderExt( - 'sndfile', 'sndfile.h', 'C'): #fix + 'sndfile', 'sndfile.h', 'C'): env.Die("libsndfile >= 1.0.25 not found (see 'config.log' for details)") else: if not conf.CheckLibWithHeaderExt('sndfile', 'sndfile.h', 'C', run=False): diff --git a/debian/copyright b/debian/copyright index 10de120d7..df48106cb 100644 --- a/debian/copyright +++ b/debian/copyright @@ -68,4 +68,10 @@ Copyright: ForeverASilver JJ Hunter Rick + Pekureda + Anurag Soni + Samad Khan + Alyssa Ross + Arseniy136 + Amandeep Singh License: MPL-2.0 diff --git a/src/tests/roc_sndio/test_backend_sink.cpp b/src/tests/roc_sndio/test_backend_sink.cpp index d0658d07b..656327313 100644 --- a/src/tests/roc_sndio/test_backend_sink.cpp +++ b/src/tests/roc_sndio/test_backend_sink.cpp @@ -43,12 +43,12 @@ TEST_GROUP(backend_sink) { * sink_config.sample_spec.num_channels()); } - bool supports_wav(IBackend & backend) { + bool supports_aiff(IBackend & backend) { bool supports = false; core::Array driver_list(arena); backend.discover_drivers(driver_list); for (size_t n = 0; n < driver_list.size(); n++) { - if (strcmp(driver_list[n].name, "wav") == 0) { + if (strcmp(driver_list[n].name, "aiff") == 0) { supports = true; break; } @@ -62,10 +62,10 @@ TEST(backend_sink, noop) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IDevice* backend_device = backend.open_device( DeviceType_Sink, DriverType_File, NULL, file.path(), sink_config, arena); CHECK(backend_device != NULL); @@ -78,7 +78,7 @@ TEST(backend_sink, error) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } IDevice* backend_device = backend.open_device( @@ -90,9 +90,9 @@ TEST(backend_sink, error) { TEST(backend_sink, has_clock) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } IDevice* backend_device = backend.open_device( @@ -108,9 +108,9 @@ TEST(backend_sink, sample_rate_auto) { sink_config.sample_spec.set_sample_rate(0); for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } IDevice* backend_device = backend.open_device( @@ -127,9 +127,9 @@ TEST(backend_sink, sample_rate_force) { sink_config.sample_spec.set_sample_rate(SampleRate); for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } IDevice* backend_device = backend.open_device( diff --git a/src/tests/roc_sndio/test_backend_source.cpp b/src/tests/roc_sndio/test_backend_source.cpp index ae03955fc..201d4abe0 100644 --- a/src/tests/roc_sndio/test_backend_source.cpp +++ b/src/tests/roc_sndio/test_backend_source.cpp @@ -51,12 +51,12 @@ const core::nanoseconds_t FrameDuration = FrameSize * core::Second core::HeapArena arena; core::BufferFactory buffer_factory(arena, MaxBufSize); -bool supports_wav(IBackend& backend) { +bool supports_aiff(IBackend& backend) { bool supports = false; core::Array driver_list(arena); backend.discover_drivers(driver_list); for (size_t n = 0; n < driver_list.size(); n++) { - if (strcmp(driver_list[n].name, "wav") == 0) { + if (strcmp(driver_list[n].name, "aiff") == 0) { supports = true; break; } @@ -82,11 +82,43 @@ TEST_GROUP(backend_source) { } }; +TEST(backend_source, noop) { + for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); + n_backend++) { + core::TempFile file("test.aiff"); + IBackend& backend = BackendMap::instance().nth_backend(n_backend); + + if (!supports_aiff(backend)) { + continue; + } + + { + test::MockSource mock_source; + IDevice* backend_device = backend.open_device( + DeviceType_Sink, DriverType_File, NULL, file.path(), sink_config, arena); + CHECK(backend_device != NULL); + core::ScopedPtr backend_sink(backend_device->to_sink(), arena); + CHECK(backend_sink != NULL); + + Pump pump(buffer_factory, mock_source, NULL, *backend_sink, FrameDuration, + SampleSpecs, Pump::ModeOneshot); + CHECK(pump.is_valid()); + CHECK(pump.run()); + } + IDevice* backend_device = backend.open_device( + DeviceType_Source, DriverType_File, NULL, file.path(), source_config, arena); + CHECK(backend_device != NULL); + core::ScopedPtr backend_source(backend_device->to_source(), arena); + CHECK(backend_source != NULL); + + } +} + TEST(backend_source, error) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } IDevice* backend_device = backend.open_device( @@ -98,10 +130,10 @@ TEST(backend_source, error) { TEST(backend_source, has_clock) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } @@ -133,10 +165,10 @@ TEST(backend_source, has_clock) { TEST(backend_source, sample_rate_auto) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } @@ -171,10 +203,10 @@ TEST(backend_source, sample_rate_auto) { TEST(backend_source, sample_rate_mismatch) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } @@ -212,10 +244,10 @@ TEST(backend_source, sample_rate_mismatch) { TEST(backend_source, pause_resume) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } @@ -280,10 +312,10 @@ TEST(backend_source, pause_resume) { TEST(backend_source, pause_restart) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } @@ -349,10 +381,10 @@ TEST(backend_source, pause_restart) { TEST(backend_source, eof_restart) { for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++) { - core::TempFile file("test.wav"); + core::TempFile file("test.aiff"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index 47a44d3b2..42230584e 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -47,12 +47,12 @@ const core::nanoseconds_t BufDuration = BufSize * core::Second core::HeapArena arena; core::BufferFactory buffer_factory(arena, BufSize); -bool supports_wav(IBackend& backend) { +bool supports_aiff(IBackend& backend) { bool supports = false; core::Array driver_list(arena); backend.discover_drivers(driver_list); for (size_t n = 0; n < driver_list.size(); n++) { - if (strcmp(driver_list[n].name, "wav") == 0) { + if (strcmp(driver_list[n].name, "aiff") == 0) { supports = true; break; } @@ -89,7 +89,7 @@ TEST(pump, write_read) { IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; } @@ -135,7 +135,7 @@ TEST(pump, write_overwrite_read) { core::TempFile file("test.wav"); IBackend& backend = BackendMap::instance().nth_backend(n_backend); - if (!supports_wav(backend)) { + if (!supports_aiff(backend)) { continue; }