Skip to content
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

tests: Bluetooth: Add BT Tester GAP smoke test #86146

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Thalley
Copy link
Collaborator

@Thalley Thalley commented Feb 21, 2025

Add a babblesim test of the BT Tester doing a GAP smoke test connecting 2 BT testers using BTP.

The purpose of this is to further increase the test coverage of the BT Tester in CI, as it is only being built, and runtime errors are typically not caught.

fixes #86058

@Thalley Thalley force-pushed the bttester_bsim branch 5 times, most recently from 78d85c5 to 65746a7 Compare February 28, 2025 14:25
@Thalley Thalley force-pushed the bttester_bsim branch 3 times, most recently from 3bdaa4a to f55cd0b Compare March 3, 2025 12:27
Comment on lines +10 to +15
if(CONFIG_SOC_SERIES_BSIM_NRFXX)
zephyr_include_directories(
${BSIM_COMPONENTS_PATH}/libUtilv1/src/
${BSIM_COMPONENTS_PATH}/libPhyComv1/src/
)
endif() # CONFIG_SOC_SERIES_BSIM_NRFXX
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reviewers: Should we just always include this? Would allow us to use IS_ENABLED and include BSIM header files without the guard

Copy link
Member

Choose a reason for hiding this comment

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

I may not have understood the question, but BSIM_COMPONENTS_PATH won't be defined when not building for an nrf*bsim target. So this -I would be pointing to missing directories. And even if it were, users building for other targets may not have a bsim installation so they wouldn't be able to include bsim headers.

@@ -0,0 +1,13 @@
# CONFIG_TEST enforces minimal logging, which we don't want
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reviewers: Should we place the BSIM board files in the test instead of the BT Tester directory?

@@ -87,6 +87,8 @@

#define BTP_STATUS_VAL(err) (err) ? BTP_STATUS_FAILED : BTP_STATUS_SUCCESS

#define BTP_EVENT_OPCODE 0x80
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines 26 to 27
btp_wait_for_evt(BTP_SERVICE_ID_GAP, BTP_GAP_EV_DEVICE_CONNECTED, NULL);
btp_wait_for_evt(BTP_SERVICE_ID_GAP, BTP_GAP_EV_DEVICE_DISCONNECTED, NULL);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reviewers: Should the test use non-generic event waiters? i.e. should we define a btp_wait_gap_ev_device_connected and btp_wait_gap_ev_device_disconnected?

Comment on lines 55 to 57
static inline void btp_gap_start_advertising(uint8_t adv_data_len, uint8_t scan_rsp_len,
const uint8_t adv_sr_data[], uint32_t duration,
uint8_t own_addr_type)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reviewers: Should we define btp_gap.h and others, rather than a single large btp.h file? For now it's assumed that it's going to be a fairly limited amount of commands and events, and not the entire BTP

@Thalley Thalley force-pushed the bttester_bsim branch 3 times, most recently from 58d9fb3 to 56306a6 Compare March 3, 2025 14:26
Add a babblesim test of the BT Tester doing a GAP smoke test
connecting 2 BT testers using BTP.

The purpose of this is to further increase the test coverage
of the BT Tester in CI, as it is only being built, and runtime
errors are typically not caught.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
@Thalley Thalley marked this pull request as ready for review March 4, 2025 09:53
@zephyrbot zephyrbot added area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth Qualification Bluetooth Qualification -related issues and pull requests area: Bluetooth platform: nRF BSIM Nordic Semiconductors, nRF BabbleSim labels Mar 4, 2025
LOG_HEXDUMP_DBG(buf->data, buf->len, "evt");
hdr = net_buf_pull_mem(buf, sizeof(struct btp_hdr));

/* TODO: Verify length of event based on the service and opcode */
Copy link
Member

Choose a reason for hiding this comment

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

did you forget this todo?

Comment on lines +10 to +15
if(CONFIG_SOC_SERIES_BSIM_NRFXX)
zephyr_include_directories(
${BSIM_COMPONENTS_PATH}/libUtilv1/src/
${BSIM_COMPONENTS_PATH}/libPhyComv1/src/
)
endif() # CONFIG_SOC_SERIES_BSIM_NRFXX
Copy link
Member

Choose a reason for hiding this comment

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

I may not have understood the question, but BSIM_COMPONENTS_PATH won't be defined when not building for an nrf*bsim target. So this -I would be pointing to missing directories. And even if it were, users building for other targets may not have a bsim installation so they wouldn't be able to include bsim headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth Qualification Bluetooth Qualification -related issues and pull requests area: Bluetooth platform: nRF BSIM Nordic Semiconductors, nRF BabbleSim
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bluetooth: Tester: Run GAP smoketests on the BT tester in Babblesim
5 participants