Skip to content

Commit c86b980

Browse files
piotrhoppeintelkv2019i
authored andcommitted
test: selector: add ztest unit tests
Add native_sim tests for selector format dispatch, sample conversion, saturation, rounding and circular-buffer wrapping. Cover component preparation, IPC4 payload handling, channel propagation, passthrough selection and coefficient-based processing. Signed-off-by: Piotr Hoppe <piotr.hoppe@intel.com>
1 parent 3e62fb6 commit c86b980

6 files changed

Lines changed: 754 additions & 3 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
#
3+
# Copyright(c) 2026 Intel Corporation.
4+
5+
cmake_minimum_required(VERSION 3.20.0)
6+
7+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
8+
project(sof_unit_audio_selector)
9+
10+
set(SOF_ROOT "${PROJECT_SOURCE_DIR}/../../../../../")
11+
set(sof_top_dir ${SOF_ROOT})
12+
13+
include(${SOF_ROOT}/scripts/cmake/misc.cmake)
14+
include(${SOF_ROOT}/scripts/cmake/uuid-registry.cmake)
15+
16+
target_include_directories(app PRIVATE
17+
${SOF_ROOT}/zephyr/include
18+
${SOF_ROOT}/src/include
19+
${SOF_ROOT}/src/kernel/platform/posix/include
20+
${SOF_ROOT}/src/audio
21+
${SOF_ROOT}/tools/rimage/src/include
22+
${PROJECT_BINARY_DIR}/include/generated
23+
)
24+
25+
target_compile_definitions(app PRIVATE
26+
-DCONFIG_ZEPHYR_POSIX=1
27+
-DCONFIG_LIBRARY=1
28+
-DUNIT_TEST=1
29+
)
30+
31+
target_sources(app PRIVATE
32+
selector_ztest.c
33+
${SOF_ROOT}/test/ztest/unit/common/alloc.c
34+
${SOF_ROOT}/test/ztest/unit/common/sof_context.c
35+
${SOF_ROOT}/src/audio/selector/selector.c
36+
${SOF_ROOT}/src/audio/selector/selector_generic.c
37+
${SOF_ROOT}/src/audio/module_adapter/module_adapter.c
38+
${SOF_ROOT}/src/audio/module_adapter/module_adapter_ipc4.c
39+
${SOF_ROOT}/src/audio/module_adapter/module/generic.c
40+
${SOF_ROOT}/src/audio/buffers/comp_buffer.c
41+
${SOF_ROOT}/src/audio/buffers/audio_buffer.c
42+
${SOF_ROOT}/src/audio/source_api_helper.c
43+
${SOF_ROOT}/src/audio/sink_api_helper.c
44+
${SOF_ROOT}/src/audio/sink_source_utils.c
45+
${SOF_ROOT}/src/audio/audio_stream.c
46+
${SOF_ROOT}/src/audio/component.c
47+
${SOF_ROOT}/src/audio/data_blob.c
48+
${SOF_ROOT}/src/module/audio/source_api.c
49+
${SOF_ROOT}/src/module/audio/sink_api.c
50+
${SOF_ROOT}/src/ipc/ipc4/helper.c
51+
${SOF_ROOT}/src/ipc/ipc-common.c
52+
${SOF_ROOT}/src/ipc/ipc-helper.c
53+
${SOF_ROOT}/src/lib/objpool.c
54+
${SOF_ROOT}/src/math/numbers.c
55+
)
56+
57+
target_link_libraries(app PRIVATE
58+
"-Wl,--wrap=rzalloc,--wrap=rfree,--wrap=sof_heap_alloc,--wrap=sof_heap_free,--wrap=sof_sys_user_heap_get"
59+
)
60+
61+
# The standalone target compiles the full IPC4 helper translation unit while
62+
# linking only its format helpers; other helper paths leave one local ID unused.
63+
set_source_files_properties(
64+
${SOF_ROOT}/src/ipc/ipc4/helper.c
65+
PROPERTIES COMPILE_OPTIONS "-Wno-unused-variable"
66+
)
67+
68+
sof_append_relative_path_definitions(app)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CONFIG_ZTEST=y
2+
CONFIG_LOG=y
3+
CONFIG_SOF_FULL_ZEPHYR_APPLICATION=n
4+
CONFIG_LIBRARY=y
5+
CONFIG_IPC_MAJOR_4=y
6+
CONFIG_COMP_SEL=y
7+
CONFIG_STATIC_PIPELINE=n
8+
CONFIG_FORMAT_S16LE=y
9+
CONFIG_FORMAT_S24LE=y
10+
CONFIG_FORMAT_S32LE=y

0 commit comments

Comments
 (0)