[pulseaudio-discuss] [PATCH 05/13] tests: Add tests for mix special-case code

Peter Meerwald pmeerw at pmeerw.net
Thu Apr 24 09:50:57 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 1808556..80cde11 100644
--- a/src/tests/cpu-mix-test.c
+++ b/src/tests/cpu-mix-test.c
@@ -18,6 +18,7 @@
 
 #include <check.h>
 
+#include <pulsecore/cpu.h>
 #include <pulsecore/cpu-arm.h>
 #include <pulsecore/random.h>
 #include <pulsecore/macro.h>
@@ -25,10 +26,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
@@ -144,7 +141,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) {
@@ -180,6 +199,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.7.9.5



More information about the pulseaudio-discuss mailing list