Skip to content

Commit 937569b

Browse files
Test(cmocka, crossover): add unit tests for: LR4 filter, split topology
Add a cmocka-based unit test suite for the crossover audio component. The tests target portable C code only and do not require the full SOF component stack. crossover_lr4_test (7 tests): crossover_split_test (10 tests): Enable CONFIG_COMP_CROSSOVER and CONFIG_MATH_IIR_DF2T in unit_test_defconfig to include the new targets in the build. Signed-off-by: Piotr Hoppe <piotr.hoppe@intel.com>
1 parent 3347ddc commit 937569b

5 files changed

Lines changed: 1282 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
CONFIG_METEORLAKE=y
22
CONFIG_COMP_DRC=y
3+
CONFIG_COMP_CROSSOVER=y
4+
CONFIG_MATH_IIR_DF2T=y

test/cmocka/src/audio/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ endif()
2525
if(CONFIG_COMP_DRC)
2626
add_subdirectory(drc)
2727
endif()
28+
if(CONFIG_COMP_CROSSOVER)
29+
add_subdirectory(crossover)
30+
endif()
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
3+
cmocka_test(crossover_lr4_test
4+
crossover_lr4_test.c
5+
${PROJECT_SOURCE_DIR}/src/math/iir_df1.c
6+
${PROJECT_SOURCE_DIR}/src/math/iir_df1_generic.c
7+
${PROJECT_SOURCE_DIR}/src/math/iir_df1_hifi3.c
8+
${PROJECT_SOURCE_DIR}/src/math/iir_df1_hifi4.c
9+
${PROJECT_SOURCE_DIR}/src/math/iir_df1_hifi5.c
10+
${PROJECT_SOURCE_DIR}/src/math/numbers.c
11+
)
12+
13+
target_link_libraries(crossover_lr4_test PRIVATE m)
14+
15+
# crossover_split_test: tests the split_2way / split_3way / split_4way routing
16+
# topology by compiling crossover_generic.c directly. The FORMAT macros are
17+
# left undefined so that only the split functions (no audio_stream dependency)
18+
# are exercised; audio_stream_copy is stubbed inside crossover_split_test.c.
19+
20+
add_compile_options(-DUNIT_TEST)
21+
22+
cmocka_test(crossover_split_test
23+
crossover_split_test.c
24+
${PROJECT_SOURCE_DIR}/src/audio/crossover/crossover_generic.c
25+
${PROJECT_SOURCE_DIR}/src/math/iir_df1.c
26+
${PROJECT_SOURCE_DIR}/src/math/iir_df1_generic.c
27+
${PROJECT_SOURCE_DIR}/src/math/iir_df1_hifi3.c
28+
${PROJECT_SOURCE_DIR}/src/math/iir_df1_hifi4.c
29+
${PROJECT_SOURCE_DIR}/src/math/iir_df1_hifi5.c
30+
${PROJECT_SOURCE_DIR}/src/math/numbers.c
31+
${PROJECT_SOURCE_DIR}/src/audio/audio_stream.c
32+
)
33+
34+
target_include_directories(crossover_split_test PRIVATE
35+
${PROJECT_SOURCE_DIR}/src/audio/crossover
36+
)
37+
38+
target_link_libraries(crossover_split_test PRIVATE m)

0 commit comments

Comments
 (0)