cmocka: mux_copy and demux_copy: Fix comp_check_eos() checking#10239
cmocka: mux_copy and demux_copy: Fix comp_check_eos() checking#10239kv2019i merged 1 commit intothesofproject:mainfrom
Conversation
After comp_check_eos() checks were added mux_copy and demux_copy started crashing. Add dummy pipeline with expect_eos = false to bypass the tests. Fixes: d472d22 ("component: Add eos support in components copy function") Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes test crashes in mux_copy and demux_copy tests that occurred after EOS (End of Stream) checking was added to component copy functions. The fix creates dummy pipeline structures with expect_eos = false to bypass the problematic EOS checks during testing.
- Adds dummy pipeline initialization in test setup functions
- Ensures proper cleanup of allocated pipeline structures in teardown functions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/cmocka/src/audio/mux/mux_copy.c | Adds dummy pipeline setup and cleanup to fix mux copy test crashes |
| test/cmocka/src/audio/mux/demux_copy.c | Adds dummy pipeline setup and cleanup to fix demux copy test crashes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| /* Add dummy pipeline to bypass comp_check_eos() */ | ||
| dummy_pipe = test_malloc(sizeof(*dummy_pipe)); | ||
| if (!dummy_pipe) | ||
| return -ENOMEM; | ||
| dummy_pipe->expect_eos = false; | ||
| dev->pipeline = dummy_pipe; |
There was a problem hiding this comment.
The dummy pipeline is only partially initialized. Consider using memset or calloc to zero-initialize the entire structure to avoid potential issues with uninitialized fields.
| /* Add dummy pipeline to bypass comp_check_eos() */ | ||
| dummy_pipe = test_malloc(sizeof(*dummy_pipe)); | ||
| if (!dummy_pipe) | ||
| return -ENOMEM; | ||
| dummy_pipe->expect_eos = false; | ||
| dev->pipeline = dummy_pipe; |
There was a problem hiding this comment.
The dummy pipeline is only partially initialized. Consider using memset or calloc to zero-initialize the entire structure to avoid potential issues with uninitialized fields.
There was a problem hiding this comment.
the failing cmocka test https://github.com/thesofproject/sof/actions/runs/17617615782/job/50054789968 after merging #10143 which this PR fixes
softwarecki
left a comment
There was a problem hiding this comment.
ugh. How that PR get through CI test? Sorry for introducing a defect.
After comp_check_eos() checks were added mux_copy and demux_copy started crashing. Add dummy pipeline with expect_eos = false to bypass the tests.
Fixes: d472d22 ("component: Add eos support in components copy function")