Skip to content

Conversation

dkushche
Copy link

The existing ASCS test callback verification functions scale poorly and are not easily reusable across different cases.

This change introduces a more generic approach to expectation checks by adding expect_bt_bap_unicast_server_cb_release_called(_expected_count, _streams) and similar functions, improving readability and maintainability of ASCS unit tests.

Fixes #58034

Copy link

Hello @dkushche, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the ASCS test callback verification functions to use a more generic approach that accepts expected counts and arrays of streams/parameters instead of single values. This improves scalability and reusability across different test scenarios where multiple callbacks or varying numbers of calls need to be verified.

Key changes:

  • Replace single-stream callback verification functions with generic array-based versions
  • Update function signatures to accept expected count and parameter arrays
  • Modify test cases to provide arrays of streams and other parameters

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
tests/bluetooth/audio/mocks/include/bap_stream_expects.h Converted single-instance expectation functions to generic array-based versions supporting multiple streams
tests/bluetooth/audio/ascs/src/test_ase_state_transition.c Updated test calls to use new generic expectation functions with stream arrays
tests/bluetooth/audio/ascs/src/main.c Updated test calls to use new generic expectation functions with stream arrays
tests/bluetooth/audio/ascs/include/bap_unicast_server_expects.h Converted single-instance expectation macros to generic array-based versions supporting multiple streams
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@Thalley Thalley left a comment

Choose a reason for hiding this comment

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

Overall looks good, and no major/blocking comments from me. There are a few comments I'd like you to consider though

Thanks :)

The existing ASCS test callback verification functions scale poorly and are
not easily reusable across different cases.

This change introduces a more generic approach to expectation checks by adding
`expect_bt_bap_unicast_server_cb_release_called(_expected_count, _streams)` and similar
functions, improving readability and maintainability of ASCS unit tests.

Fixes zephyrproject-rtos#58034

Signed-off-by: Dima Kushchevskyi <[email protected]>
@dkushche dkushche force-pushed the refactor-bluetooth-ascs-tests branch from 8a0269f to 67f70d6 Compare October 14, 2025 13:30
@dkushche dkushche requested a review from Thalley October 14, 2025 13:43
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth Audio area: Bluetooth area: Tests Issues related to a particular existing or missing test

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

tests: Bluetooth: ascs: Refactor unit tests to cleanup the code

3 participants