From 215aeee7d57ecada051df5f2341d3746e30adf62 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Fri, 12 Sep 2025 17:57:53 +0300 Subject: [PATCH] cmocka: mux_copy and demux_copy: Fix comp_check_eos() checking 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: d472d22b38a2 ("component: Add eos support in components copy function") Signed-off-by: Jyri Sarha --- test/cmocka/src/audio/mux/demux_copy.c | 10 ++++++++++ test/cmocka/src/audio/mux/mux_copy.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/test/cmocka/src/audio/mux/demux_copy.c b/test/cmocka/src/audio/mux/demux_copy.c index 17414b4f7c25..4934ab6dbdaa 100644 --- a/test/cmocka/src/audio/mux/demux_copy.c +++ b/test/cmocka/src/audio/mux/demux_copy.c @@ -157,6 +157,7 @@ static int setup_test_case(void **state) struct processing_module *mod; struct sof_ipc_comp_process *ipc; size_t sample_size = td->format == SOF_IPC_FRAME_S16_LE ? sizeof(int16_t) : sizeof(int32_t); + struct pipeline *dummy_pipe; ipc = create_demux_comp_ipc(td); dev = comp_new((struct sof_ipc_comp *)ipc); @@ -164,6 +165,13 @@ static int setup_test_case(void **state) if (!dev) return -EINVAL; + /* 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; + mod = comp_mod(dev); td->dev = dev; td->mod = mod; @@ -185,6 +193,8 @@ static int teardown_test_case(void **state) for (i = 0; i < MUX_MAX_STREAMS; ++i) free_test_sink(td->sinks[i]); + test_free(td->dev->pipeline); + td->dev->pipeline = NULL; comp_free(td->dev); return 0; diff --git a/test/cmocka/src/audio/mux/mux_copy.c b/test/cmocka/src/audio/mux/mux_copy.c index 2ecc814483bd..97b7be7b9076 100644 --- a/test/cmocka/src/audio/mux/mux_copy.c +++ b/test/cmocka/src/audio/mux/mux_copy.c @@ -179,6 +179,7 @@ static int setup_test_case(void **state) struct processing_module *mod; struct sof_ipc_comp_process *ipc; size_t sample_size = td->format == SOF_IPC_FRAME_S16_LE ? sizeof(int16_t) : sizeof(int32_t); + struct pipeline *dummy_pipe; ipc = create_mux_comp_ipc(td); dev = comp_new((struct sof_ipc_comp *)ipc); @@ -186,6 +187,13 @@ static int setup_test_case(void **state) if (!dev) return -EINVAL; + /* 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; + mod = comp_mod(dev); td->dev = dev; td->mod = mod; @@ -207,6 +215,8 @@ static int teardown_test_case(void **state) free_test_source(td->sources[i]); free_test_sink(td->sink); + test_free(td->dev->pipeline); + td->dev->pipeline = NULL; comp_free(td->dev); return 0; }