[pulseaudio-discuss] [PATCH v2 06/14] tests: Add tests for mix special-case code

Peter Meerwald pmeerw at pmeerw.net
Wed Sep 10 07:40:07 PDT 2014


Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/tests/cpu-mix-test.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/tests/cpu-mix-test.c b/src/tests/cpu-mix-test.c
index 2facaae..ab53c6c 100644
--- a/src/tests/cpu-mix-test.c
+++ b/src/tests/cpu-mix-test.c
@@ -23,6 +23,7 @@
 
 #include <check.h>
 
+#include <pulsecore/cpu.h>
 #include <pulsecore/cpu-arm.h>
 #include <pulsecore/random.h>
 #include <pulsecore/macro.h>
@@ -30,10 +31,6 @@
 
 #include "runtime-test-util.h"
 
-/* Only ARM NEON has mix tests, so disable the related functions for other
- * architectures for now to avoid compiler warnings about unused functions. */
-#if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
-
 #define SAMPLES 1028
 #define TIMES 1000
 #define TIMES2 100
@@ -149,7 +146,29 @@ static void run_mix_test(
 
     pa_mempool_free(pool);
 }
-#endif /* defined (__arm__) && defined (__linux__) && defined (HAVE_NEON) */
+
+START_TEST (mix_special_test) {
+    pa_cpu_info cpu_info = { PA_CPU_UNDEFINED, {}, false };
+    pa_do_mix_func_t orig_func, special_func;
+
+    cpu_info.force_generic_code = true;
+    pa_mix_func_init(&cpu_info);
+    orig_func = pa_get_mix_func(PA_SAMPLE_S16NE);
+
+    cpu_info.force_generic_code = false;
+    pa_mix_func_init(&cpu_info);
+    special_func = pa_get_mix_func(PA_SAMPLE_S16NE);
+
+    pa_log_debug("Checking special mix (s16, stereo)");
+    run_mix_test(special_func, orig_func, 7, 2, true, true);
+
+    pa_log_debug("Checking special mix (s16, 4-channel)");
+    run_mix_test(special_func, orig_func, 7, 4, true, true);
+
+    pa_log_debug("Checking special mix (s16, mono)");
+    run_mix_test(special_func, orig_func, 7, 1, true, true);
+}
+END_TEST
 
 #if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
 START_TEST (mix_neon_test) {
@@ -185,6 +204,7 @@ int main(int argc, char *argv[]) {
     s = suite_create("CPU");
 
     tc = tcase_create("mix");
+    tcase_add_test(tc, mix_special_test);
 #if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
     tcase_add_test(tc, mix_neon_test);
 #endif
-- 
1.9.1



More information about the pulseaudio-discuss mailing list