Skip to content

Commit 3609c26

Browse files
cvinayaknordicjm
authored andcommitted
[nrf fromtree] tests: bsim: Bluetooth: Conditionally compile Controller Privacy
Conditionally compile Controller Privacy testing and enable advertising test for nRF54L15bsim. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]> (cherry picked from commit 7a1e7c9fbaa061a9150210a2870b59ee151ff6bf) Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 570aede commit 3609c26

File tree

6 files changed

+68
-38
lines changed

6 files changed

+68
-38
lines changed

tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export BOARD="${BOARD:-nrf54l15bsim/nrf54l15/cpuapp}"
1313

1414
source ${ZEPHYR_BASE}/tests/bsim/compile.source
1515

16+
app=tests/bsim/bluetooth/ll/advx compile
17+
app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-ticker_expire_info.conf compile
18+
app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-scan_aux_use_chains.conf compile
1619
app=tests/bsim/bluetooth/ll/throughput compile
1720
app=tests/bsim/bluetooth/ll/throughput conf_overlay=overlay-no_phy_update.conf compile
1821
app=tests/bsim/bluetooth/ll/multiple_id compile

tests/bsim/bluetooth/ll/advx/src/main.c

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@
2929
#define EVT_PROP_TXP BIT(6)
3030
#define ADV_INTERVAL 0x20 /* 20 ms advertising interval */
3131
#define ADV_WAIT_MS 10 /* 10 ms wait loop */
32+
#if defined(CONFIG_BT_CTLR_PRIVACY)
33+
#define OWN_ADDR_TYPE BT_HCI_OWN_ADDR_RPA_OR_RANDOM
34+
#else /* !CONFIG_BT_CTLR_PRIVACY */
3235
#define OWN_ADDR_TYPE BT_HCI_OWN_ADDR_RANDOM
36+
#endif /* !CONFIG_BT_CTLR_PRIVACY */
3337
#define PEER_ADDR_TYPE BT_HCI_OWN_ADDR_RANDOM
3438
#define PEER_ADDR peer_addr
3539
#define ADV_CHAN_MAP 0x07
@@ -675,28 +679,32 @@ static void test_advx_main(void)
675679

676680
k_sleep(K_MSEC(1000));
677681

678-
printk("Add to resolving list...");
679-
bt_addr_le_t peer_id_addr = {
680-
.type = BT_ADDR_LE_RANDOM,
681-
.a = {
682-
.val = {0xc6, 0xc7, 0xc8, 0xc9, 0xc1, 0xcb}
683-
}
684-
};
685-
uint8_t pirk[16] = {0x00, };
686-
uint8_t lirk[16] = {0x01, };
682+
if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) {
683+
printk("Add to resolving list...");
684+
bt_addr_le_t peer_id_addr = {
685+
.type = BT_ADDR_LE_RANDOM,
686+
.a = {
687+
.val = {0xc6, 0xc7, 0xc8, 0xc9, 0xc1, 0xcb}
688+
}
689+
};
690+
uint8_t pirk[16] = {0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA,
691+
0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA};
692+
uint8_t lirk[16] = {0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21,
693+
0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21};
687694

688-
err = ll_rl_add(&peer_id_addr, pirk, lirk);
689-
if (err) {
690-
goto exit;
691-
}
692-
printk("success.\n");
695+
err = ll_rl_add(&peer_id_addr, pirk, lirk);
696+
if (err) {
697+
goto exit;
698+
}
699+
printk("success.\n");
693700

694-
printk("Enable resolving list...");
695-
err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE);
696-
if (err) {
697-
goto exit;
701+
printk("Enable resolving list...");
702+
err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE);
703+
if (err) {
704+
goto exit;
705+
}
706+
printk("success.\n");
698707
}
699-
printk("success.\n");
700708

701709
printk("Enabling extended...");
702710
err = ll_adv_enable(handle, 1, 0, 0);
@@ -1716,28 +1724,46 @@ static void test_scanx_main(void)
17161724
}
17171725
printk("done.\n");
17181726

1719-
printk("Add to resolving list...");
17201727
bt_addr_le_t peer_id_addr = {
17211728
.type = BT_ADDR_LE_RANDOM,
17221729
.a = {
17231730
.val = {0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5}
17241731
}
17251732
};
1726-
uint8_t pirk[16] = {0x01, };
1727-
uint8_t lirk[16] = {0x00, };
17281733

1729-
err = ll_rl_add(&peer_id_addr, pirk, lirk);
1730-
if (err) {
1731-
goto exit;
1732-
}
1733-
printk("success.\n");
1734+
if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) {
1735+
printk("Add to resolving list...");
1736+
bt_addr_le_t some_id_addr = {
1737+
.type = BT_ADDR_LE_RANDOM,
1738+
.a = {
1739+
.val = {0x78, 0x87, 0x78, 0x87, 0x78, 0x87}
1740+
}
1741+
};
1742+
uint8_t pirk[16] = {0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21,
1743+
0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21};
1744+
uint8_t lirk[16] = {0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC,
1745+
0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC};
1746+
1747+
/* some_id_addr with swapped peer IRK and local IRK */
1748+
err = ll_rl_add(&some_id_addr, lirk, pirk);
1749+
if (err) {
1750+
goto exit;
1751+
}
17341752

1735-
printk("Enable resolving list...");
1736-
err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE);
1737-
if (err) {
1738-
goto exit;
1753+
/* peer_id_addr with correct peer IRK and local IRK */
1754+
err = ll_rl_add(&peer_id_addr, pirk, lirk);
1755+
if (err) {
1756+
goto exit;
1757+
}
1758+
printk("success.\n");
1759+
1760+
printk("Enable resolving list...");
1761+
err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE);
1762+
if (err) {
1763+
goto exit;
1764+
}
1765+
printk("success.\n");
17391766
}
1740-
printk("success.\n");
17411767

17421768
printk("Add device to periodic advertising list...");
17431769
err = bt_le_per_adv_list_add(&peer_id_addr, per_sid);

tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120
1313
cd ${BSIM_OUT_PATH}/bin
1414

1515
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf \
16-
-v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx
16+
-v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx
1717

1818
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf\
19-
-v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx
19+
-v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx
2020

2121
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
2222
-D=2 -sim_length=60e6 $@

tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120
1313
cd ${BSIM_OUT_PATH}/bin
1414

1515
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-scan_aux_use_chains_conf \
16-
-v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx
16+
-v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx
1717

1818
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-scan_aux_use_chains_conf \
19-
-v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx
19+
-v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx
2020

2121
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
2222
-D=2 -sim_length=60e6 $@

tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120
1313
cd ${BSIM_OUT_PATH}/bin
1414

1515
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-ticker_expire_info_conf \
16-
-v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx
16+
-v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx
1717

1818
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-ticker_expire_info_conf \
19-
-v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx
19+
-v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx
2020

2121
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
2222
-D=2 -sim_length=60e6 $@

tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Search paths(s) for tests which will be run in the nrf54l15 app core
22
# This file is used in CI to select which tests are run
3+
tests/bsim/bluetooth/ll/advx/
34
tests/bsim/bluetooth/ll/throughput/
45
tests/bsim/bluetooth/ll/multiple_id/
56
tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_interleaved.sh

0 commit comments

Comments
 (0)