Skip to content

test: ztest: mux: add regression test for processing with no source #11589

Todo

Description

@tmleman

Sub-issue of #10110 (follow-up after the CMocka to ztest migration).

Problem

demux_process() and mux_process() in src/audio/mux/mux.c return early when the module has no active sources or sinks:

/* if there are no sources or sinks active, then there is nothing to do */
if (num_of_sources == 0 || num_of_sinks == 0) {

The guard in demux_process() was fixed in #11284 (the old check dereferenced a NULL source array). No unit test exercises this path: every case in the ztest suite test/ztest/unit/audio/mux (mux_copy, demux_copy) creates a source before calling comp_copy(), so a regression of the guard would not be caught.

Requested in review: #11284 (comment)

Proposed change

Add regression cases to test/ztest/unit/audio/mux:

  • demux: process with no bound source, expect return value 0 and untouched sink data
  • mux: the same for the equivalent guard in mux_process()

Acceptance criteria

  • New case(s) fail when the guard is removed or reverted to the old check
  • Suite passes on native_sim, also with ASan/LSan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions