-
Notifications
You must be signed in to change notification settings - Fork 8.4k
tests: Bluetooth: Classic: Add test suites gap_discovery #100491
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
base: main
Are you sure you want to change the base?
tests: Bluetooth: Classic: Add test suites gap_discovery #100491
Conversation
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.
Pull request overview
This PR adds comprehensive test suites for Bluetooth Classic GAP (Generic Access Profile) discovery functionality, testing both general and limited discovery modes for central and peripheral roles.
- Implements test cases for GAP central device performing discovery operations
- Implements test cases for GAP peripheral device advertising and being discovered
- Adds automation script to orchestrate two-device testing using virtual Bluetooth controllers
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/bluetooth/classic/gap_discovery/tests_scripts/gap_discovery_run.sh | Bash script that sets up virtual HCI devices, builds and runs both central and peripheral test executables |
| tests/bluetooth/classic/gap_discovery/testcase.yaml | Test configuration defining platform support (native_sim), tags, timeout, and harness type |
| tests/bluetooth/classic/gap_discovery/src/test_peripheral.c | Peripheral role test implementation with general and limited discovery test cases |
| tests/bluetooth/classic/gap_discovery/src/test_central.c | Central role test implementation with general and limited discovery test cases |
| tests/bluetooth/classic/gap_discovery/prj.conf | Project configuration enabling Bluetooth Classic, logging, and test-specific settings |
| tests/bluetooth/classic/gap_discovery/README.rst | Documentation describing test purpose, requirements, building/running instructions, and sample output |
| tests/bluetooth/classic/gap_discovery/Kconfig | Configuration options for GAP role selection and device address configuration |
| tests/bluetooth/classic/gap_discovery/CMakeLists.txt | Build configuration conditionally including central or peripheral test sources based on Kconfig |
Comments suppressed due to low confidence (2)
tests/bluetooth/classic/gap_discovery/tests_scripts/gap_discovery_run.sh:238
- Shell command execution issue: The build command is stored as a string and then executed directly with
$build_cmd. This approach doesn't properly handle the command with its arguments and quoted parameters. Useeval $build_cmdinstead to properly execute the command string, or better yet, execute the command directly without storing it in a variable:
if ! west build -b native_sim tests/bluetooth/classic/gap_discovery -d "$build_dir" -DCONFIG_TEST_GAP_PERIPHERAL=y -DCONFIG_TEST_GAP_CENTRAL_ADDRESS=\"${virtual_addresses[1]}\"; then if ! $build_cmd; then
tests/bluetooth/classic/gap_discovery/tests_scripts/gap_discovery_run.sh:369
- Shell command execution issue: The build command is stored as a string and then executed directly with
$build_cmd. This approach doesn't properly handle the command with its arguments and quoted parameters. Useeval $build_cmdinstead to properly execute the command string, or better yet, execute the command directly without storing it in a variable.
if ! $build_cmd; then
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/bluetooth/classic/gap_discovery/tests_scripts/gap_discovery_run.sh
Outdated
Show resolved
Hide resolved
tests/bluetooth/classic/gap_discovery/tests_scripts/gap_discovery_run.sh
Outdated
Show resolved
Hide resolved
tests/bluetooth/classic/gap_discovery/tests_scripts/gap_discovery_run.sh
Outdated
Show resolved
Hide resolved
024e1a1 to
75366c1
Compare
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.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/bluetooth/classic/sim/gap_discovery/tests_scripts/gap_discovery_run.sh
Outdated
Show resolved
Hide resolved
tests/bluetooth/classic/gap_discovery/tests_scripts/gap_discovery_run.sh
Outdated
Show resolved
Hide resolved
| fi | ||
|
|
||
| # Start btvirt asynchronously and get PID, redirect output to file | ||
| sudo btvirt -d -l2 > gap_discovery/btvirt_output.log 2>&1 & |
Copilot
AI
Dec 4, 2025
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.
The script runs sudo commands for btvirt, btmon, hciconfig, and test executables without checking if the user has sudo privileges. If sudo requires a password or fails, the script may hang or fail unexpectedly. Consider adding a sudo privilege check at the beginning or handling sudo failures more gracefully.
tests/bluetooth/classic/sim/gap_discovery/tests_scripts/gap_discovery_run.sh
Show resolved
Hide resolved
6725f1a to
8a47f0e
Compare
|
Hi @jhedberg , This PR is used to add a new test suite for Bluetooth Classic in simulation platform and simulation controller. My goal is for it to become part of CI/CV for Bluetooth Classic PR inspection. What do I need to do to achieve this goal? |
8a47f0e to
7664ad1
Compare
5653a05 to
5cd36bc
Compare
c09c30b to
7a3d1f0
Compare
| wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5/zephyr-sdk-0.16.5_linux-x86_64.tar.xz | ||
| wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5/sha256.sum | shasum --check --ignore-missing | ||
| tar xvf zephyr-sdk-0.16.5_linux-x86_64.tar.xz | ||
| cd zephyr-sdk-0.16.5 |
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 such an old version of the SDK? The latest one is 0.17.4. You might also want to factor out the version to a single updatable variable, and maybe also consider using the west sdk install command.
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.
Thanks. Will update it.
fdb6d60 to
6bc0d85
Compare
Add test cases gap_central.test_01_gap_central_general_discovery and gap_central.test_02_gap_central_limited_discovery. Add test cases gap_peripheral.test_01_gap_peripheral_general_discovery and gap_peripheral.test_02_gap_peripheral_limited_discovery. Signed-off-by: Lyle Zhu <[email protected]>
6bc0d85 to
76898e2
Compare
Add Bluetooth classic simulation CI entry script. Add github workflow for Bluetooth Classic. Signed-off-by: Lyle Zhu <[email protected]>
76898e2 to
73c7656
Compare
|



Add test cases gap_central.test_01_gap_central_general_discovery and gap_central.test_02_gap_central_limited_discovery.
Add test cases gap_peripheral.test_01_gap_peripheral_general_discovery and gap_peripheral.test_02_gap_peripheral_limited_discovery.