-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Bluetooth: Audio: Add tests for the CAP cancel command #82315
base: main
Are you sure you want to change the base?
Conversation
This adds unittests and babblesim tests for the CAP cancel command Signed-off-by: Andries Kruithof <[email protected]>
52d27e8
to
e3f730a
Compare
|
||
void set_skip_add_src(int nr_to_skip); | ||
|
||
LOG_MODULE_REGISTER(bt_cancel, CONFIG_BT_CAP_COMMANDER_LOG_LEVEL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are registering a log here? Seems unused
for (size_t i = 0; i < ARRAY_SIZE(fixture->conns); i++) { | ||
err = bt_cap_commander_discover(&fixture->conns[i]); | ||
zassert_equal(0, err, "Unexpected return value %d", err); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cap_commander_test_cancel_fixture_init
also does discovery - Should remove one of them
err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); | ||
zassert_equal(0, err, "Could not start CAP procedure: %d", err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there value in testing the cancel for the other CAP Commander procedures too, and not just the broadcast reception start?
if (add_src_skip != 0) { | ||
add_src_skip--; | ||
|
||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand this feature correctly:
We can set a value, add_src_skip
, that effectively delays the response from the server indefinitely, thus causing the procedure to never finish on it's own, which allows us to cancel it?
If so, then it's a creative solution. Could this have been done with the mocked k_work implementation we have?
Two comments about the design of this:
- In some ways, it's a bit odd that we skip the first N callbacks, and not the last N callbacks, but the result will be the same
- This is not a very scalable solution if we want to do the commander cancel test for the remaining CAP commander procedures. On the top of my head, I don't have a general solution for this though.
static int add_src_skip; | ||
|
||
void set_skip_add_src(int setting) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static int add_src_skip; | |
void set_skip_add_src(int setting) | |
static unsigned int add_src_skip; | |
void set_skip_add_src(unsigned int setting) |
int new_volume; | ||
|
||
UNSET_FLAG(flag_volume_changed); | ||
new_volume = init_change_volume(); | ||
WAIT_FOR_FLAG(flag_volume_changed); | ||
printk("Volume changed to %u\n", param.volume); | ||
|
||
printk("Volume changed to %u\n", new_volume); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of adding the return value? On error FAIL
is already called
#Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \ | ||
# -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=cap_acceptor_broadcast_reception \ | ||
# -RealEncryption=1 -rs=69 -D=${NR_OF_DEVICES} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \ | |
# -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=cap_acceptor_broadcast_reception \ | |
# -RealEncryption=1 -rs=69 -D=${NR_OF_DEVICES} |
|
||
|
||
|
||
|
||
|
||
# Simulation time should be larger than the WAIT_TIME in common.h | ||
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \ | ||
-D=${NR_OF_DEVICES} -sim_length=60e6 $@ | ||
|
||
|
||
|
||
wait_for_background_jobs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Simulation time should be larger than the WAIT_TIME in common.h | |
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \ | |
-D=${NR_OF_DEVICES} -sim_length=60e6 $@ | |
wait_for_background_jobs | |
# Simulation time should be larger than the WAIT_TIME in common.h | |
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \ | |
-D=${NR_OF_DEVICES} -sim_length=60e6 $@ | |
wait_for_background_jobs |
|
||
cd ${BSIM_OUT_PATH}/bin | ||
|
||
printf "\n\n======== Running CAP commander broadcast reception start and stop test =========\n\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf "\n\n======== Running CAP commander broadcast reception start and stop test =========\n\n" | |
printf "\n\n======== Running CAP commander cancel test =========\n\n" |
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
SIMULATION_ID="cap_broadcast_reception" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIMULATION_ID="cap_broadcast_reception" | |
SIMULATION_ID="cap_commander_cancel" |
This adds unittests and babblesim tests for the CAP cancel command
Fixes #71424