Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Cmocka: Add unit test for function drc_inv_fixed() #9649

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

singalsu
Copy link
Collaborator

No description provided.

This patch adds to unit tests platform unit_test to be able
to add new Kconfig enables without altering configuration of
of other production platforms.

The used platform for the purpose is MTL to be able to unit
test code for HiFi4. Components/features to test can be
freely added to unit_test_defconfig.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds unit test for the inverse function used in DRC
component. The function is tested with all used Q-formats
for input and output with 500 points in the positive int32_t
range. Negative numbers are not tested since the DRC specific
function inverse function does not need and implement it.

Signed-off-by: Seppo Ingalsuo <[email protected]>
@singalsu
Copy link
Collaborator Author

I'm not sure if test/test-all-defconfigs.sh tests xt-xcc / xt-clang built code. When I intentionally tried to break code, I found that only generic C version of code is tested. But it was in my own development env, not in CI. Does someone know?

@singalsu singalsu marked this pull request as ready for review November 13, 2024 14:18
@singalsu singalsu requested a review from a team November 13, 2024 14:18
@lgirdwood
Copy link
Member

@wszypelt @lrudyX This one is a mock only, not sure if you are testing mocks today ? Good to merge ?

@wszypelt
Copy link

@lgirdwood we are not currently checking the mock, good to merge


x1 = x_start;
while (x1 <= x_end) {
x = (int32_t)x1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would

for (x = x_start; x <= x_end; x += x_step)

also work? Maybe making x 64 bits to avoid wrapping around

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packs three lines into one ... but as you prefer. The loop variable is 64 bits to avoid it to wrap if max int32_t value is not hit exactly. So why not have the above simple type cast code line. I like simple not very packed coding style while I see that you prefer more compact code. Since this is test code I want it to be clear, no worry about performance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I agree - need to be readable by the folks working on these features.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like simple not very packed coding style while I see that you prefer more compact code. Since this is test code I want it to be clear, no worry about performance.

@singalsu sure, if that's your preference - fine this me. This is by no means critical. I just like to fit as much code as possible onto the screen at once, while still keeping some sane restrictions like 1 command per line and single empty lines between blocks. And without making the font too small :-) But - again - that's just my personal preference

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was starting to change it but it got merged, next time then!

@lgirdwood lgirdwood merged commit b826d6c into thesofproject:main Nov 19, 2024
42 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants