Skip to content

Conversation

@lylezhu2012
Copy link
Contributor

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.

Copilot AI review requested due to automatic review settings December 4, 2025 05:18
@zephyrbot zephyrbot added area: Bluetooth area: Tests Issues related to a particular existing or missing test area: Bluetooth Classic Bluetooth Classic (BR/EDR) labels Dec 4, 2025
Copy link

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 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. Use eval $build_cmd instead 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. Use eval $build_cmd instead 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.

@lylezhu2012 lylezhu2012 force-pushed the classic_add_test_suites_gap_discovery branch 3 times, most recently from 024e1a1 to 75366c1 Compare December 4, 2025 06:15
@lylezhu2012 lylezhu2012 requested a review from Copilot December 4, 2025 06:21
Copy link

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

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.

fi

# Start btvirt asynchronously and get PID, redirect output to file
sudo btvirt -d -l2 > gap_discovery/btvirt_output.log 2>&1 &
Copy link

Copilot AI Dec 4, 2025

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.

Copilot uses AI. Check for mistakes.
@lylezhu2012 lylezhu2012 force-pushed the classic_add_test_suites_gap_discovery branch 2 times, most recently from 6725f1a to 8a47f0e Compare December 4, 2025 06:49
@lylezhu2012
Copy link
Contributor Author

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?

@lylezhu2012 lylezhu2012 marked this pull request as draft December 5, 2025 05:19
@lylezhu2012 lylezhu2012 force-pushed the classic_add_test_suites_gap_discovery branch from 8a47f0e to 7664ad1 Compare December 5, 2025 05:50
@lylezhu2012 lylezhu2012 force-pushed the classic_add_test_suites_gap_discovery branch 3 times, most recently from 5653a05 to 5cd36bc Compare December 5, 2025 08:51
@lylezhu2012 lylezhu2012 force-pushed the classic_add_test_suites_gap_discovery branch 13 times, most recently from c09c30b to 7a3d1f0 Compare December 5, 2025 12:05
Comment on lines 108 to 111
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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Will update it.

@lylezhu2012 lylezhu2012 force-pushed the classic_add_test_suites_gap_discovery branch 5 times, most recently from fdb6d60 to 6bc0d85 Compare December 9, 2025 11:11
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]>
@lylezhu2012 lylezhu2012 force-pushed the classic_add_test_suites_gap_discovery branch from 6bc0d85 to 76898e2 Compare December 9, 2025 11:58
Add Bluetooth classic simulation CI entry script.
Add github workflow for Bluetooth Classic.

Signed-off-by: Lyle Zhu <[email protected]>
@lylezhu2012 lylezhu2012 force-pushed the classic_add_test_suites_gap_discovery branch from 76898e2 to 73c7656 Compare December 10, 2025 01:38
@sonarqubecloud
Copy link

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

Labels

area: Bluetooth Classic Bluetooth Classic (BR/EDR) area: Bluetooth area: Continuous Integration area: Tests Issues related to a particular existing or missing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants