Skip to content

Commit 8abb2c0

Browse files
committed
qemu: maths: build the math ztests on native_sim
Add the math basic-arithmetic ztests (test_crc32_ztest.c, test_find_*_ztest.c, test_gcd_ztest.c, test_norm_int32_ztest.c) to the SOF boot-test build under zephyr/test/CMakeLists.txt when both CONFIG_SOF_BOOT_TEST_STANDALONE and CONFIG_ZTEST are enabled. The math helpers themselves (find_*_int*, norm_int32) are gated by CONFIG_NUMBERS_VECTOR_FIND / CONFIG_NUMBERS_NORM in src/math/numbers.c and are now enabled per-board in app/boards/native_sim.conf, where CONFIG_ZTEST is set. This keeps the gating clean and explicit per board rather than coupling math source compilation to CONFIG_ZTEST. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 35977ed commit 8abb2c0

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

zephyr/test/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,20 @@ endif()
2626
if(CONFIG_SOF_BOOT_TEST_STANDALONE AND CONFIG_SOF_USERSPACE_LL)
2727
zephyr_library_sources(userspace/test_ll_task.c)
2828
endif()
29+
30+
if(CONFIG_SOF_BOOT_TEST_STANDALONE AND CONFIG_ZTEST)
31+
set(MATH_ZTEST_SOURCES
32+
../../test/ztest/unit/math/basic/arithmetic/test_crc32_ztest.c
33+
../../test/ztest/unit/math/basic/arithmetic/test_find_equal_int16_ztest.c
34+
../../test/ztest/unit/math/basic/arithmetic/test_find_max_abs_int32_ztest.c
35+
../../test/ztest/unit/math/basic/arithmetic/test_find_min_int16_ztest.c
36+
../../test/ztest/unit/math/basic/arithmetic/test_gcd_ztest.c
37+
../../test/ztest/unit/math/basic/arithmetic/test_norm_int32_ztest.c
38+
)
39+
40+
zephyr_library_sources(${MATH_ZTEST_SOURCES})
41+
42+
set_source_files_properties(${MATH_ZTEST_SOURCES}
43+
PROPERTIES COMPILE_DEFINITIONS "CONFIG_NUMBERS_VECTOR_FIND=1;CONFIG_NUMBERS_NORM=1;UNIT_TEST=1"
44+
)
45+
endif()

0 commit comments

Comments
 (0)