Repository navigation
Conversation
tmleman
requested review from
dbaluta,
kv2019i,
lbetlej,
lgirdwood,
mmaka1 and
plbossart
as code owners
November 16, 2026 12:34
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the added Zephyr ztest coverage for dft3_32().
No open issues 🎉
What changed in this PR
Adds a Zephyr ztest counterpart to the CMocka test for dft3_32(), preserving reference-data and numerical-tolerance coverage for the 3-point DFT used by FFT plans.
Changes:
- Reuses the CMocka reference vectors and checks maximum absolute and aggregate RMS error.
- Adds compile-time checks for reference-vector sizes.
- Configures a standalone
native_simsuite with the required FFT sources and math-library linkage.
| File | Description |
|---|---|
test/ztest/unit/math/dft3/testcase.yaml |
Registers the suite for execution on native_sim. |
test/ztest/unit/math/dft3/test_dft3_ztest.c |
Implements the reference-vector test with the original error limits. |
test/ztest/unit/math/dft3/prj.conf |
Enables ztest and disables the full SOF application. |
test/ztest/unit/math/dft3/CMakeLists.txt |
Configures sources, shared vector includes, compile definitions, and linkage. |
Review effort: Balanced
Add a ztest suite for dft3_32(), the 3-point DFT used by some FFT plan sizes, covering the same single case as the CMocka test. The reference vectors are included in place from the CMocka tree so both frameworks are driven by identical fixed-point data. dft3_32() is implemented in fft_multi_generic.c (and fft_multi_hifi3.c for Xtensa, gated out on native_sim), so the suite links the same five math sources as the CMocka target. No heap allocation or module-adapter functionality is exercised by this test, so the suite needs no allocator hook. Code coverage testing did not reveal any regression. CMock stats for fft_multi_generic.c - lines: 32.3 % (20/62) - branches: 22.9 % (11/48) Ztest stats for fft_multi_generic.c - lines: 27.3 % (18/66) - branches: 8.3 % (2/24) Both frameworks exercise only dft3_32() in this file; the remaining functions (fft_multi, ifft_multi and their helpers) are covered by the separate fft_multi suite/test, not by dft3. The lower ztest percentage is a smaller denominator effect from clang's finer-grained branch counting for the same source, not a drop in tested behavior: the mutation test below confirms the port's assertions are as strict as the original. Mutation-tested by tightening SOFM_DFT3_MAX_ERROR_RMS from 1.1 to 0.0001, confirming the suite fails, then reverting. Verified clean under --enable-asan --enable-lsan. Assisted-by: Copilot:claude-sonnet-5 Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a ztest suite for dft3_32(), the 3-point DFT used by some FFT plan sizes, covering the same single case as the CMocka test. The reference vectors are included in place from the CMocka tree so both frameworks are driven by identical fixed-point data.
dft3_32() is implemented in fft_multi_generic.c (and fft_multi_hifi3.c for Xtensa, gated out on native_sim), so the suite links the same five math sources as the CMocka target. No heap allocation or module-adapter functionality is exercised by this test, so the suite needs no allocator hook.
Code coverage testing did not reveal any regression.
CMock stats for fft_multi_generic.c
Ztest stats for fft_multi_generic.c
Both frameworks exercise only dft3_32() in this file; the remaining functions (fft_multi, ifft_multi and their helpers) are covered by the separate fft_multi suite/test, not by dft3. The lower ztest percentage is a smaller denominator effect from clang's finer-grained branch counting for the same source, not a drop in tested behavior: the mutation test below confirms the port's assertions are as strict as the original.
Mutation-tested by tightening SOFM_DFT3_MAX_ERROR_RMS from 1.1 to 0.0001, confirming the suite fails, then reverting. Verified clean under --enable-asan --enable-lsan.
Assisted-by: Copilot:claude-sonnet-5