Skip to content

Commit

Permalink
tests: bsim: bluetooth: host: use twister to compile tests
Browse files Browse the repository at this point in the history
Bluetooth host bsim tests are compiled with shell scripts, but it is
possible to use twister, which supports compilation (but not running
at the moment). Copiling with twister provides cleaner interface and
more flexible configuration.

Signed-off-by: Artur Dobrynin <[email protected]>
  • Loading branch information
ardo-nordic committed Nov 27, 2024
1 parent 2879607 commit 7fcc7ef
Show file tree
Hide file tree
Showing 239 changed files with 1,298 additions and 944 deletions.
1 change: 1 addition & 0 deletions tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpunet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export BOARD="${BOARD:-nrf5340bsim/nrf5340/cpunet}"
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source

${ZEPHYR_BASE}/tests/bsim/bluetooth/ll/compile.sh
${ZEPHYR_BASE}/tests/bsim/bluetooth/host/compile.sh

wait_for_background_jobs
11 changes: 11 additions & 0 deletions tests/bsim/bluetooth/host/adv/chain/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tests:
bluetooth.host.adv.chain:
build_only: true
tags:
- bluetooth
platform_allow:
- nrf52_bsim
- nrf5340bsim/nrf5340/cpunet
harness: bsim
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_chain_prj_conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_chain_prj_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -testid=adv

Expand Down
23 changes: 0 additions & 23 deletions tests/bsim/bluetooth/host/adv/compile.sh

This file was deleted.

15 changes: 0 additions & 15 deletions tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/compile.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source

simulation_id="$(guess_test_long_name)"
verbosity_level=2
if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

test_exe="bs_${BOARD_TS}_$(guess_test_long_name)_prj_conf"

cd ${BSIM_OUT_PATH}/bin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests:
bluetooth.host.adv.encrypted.css_sample_data:
build_only: true
tags:
- bluetooth
platform_allow:
- nrf52_bsim
harness: bsim
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_encrypted_css_sample_data_prj_conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_encrypted_ead_sample_prj_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -RealEncryption=1

Expand Down
10 changes: 10 additions & 0 deletions tests/bsim/bluetooth/host/adv/encrypted/ead_sample/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests:
bluetooth.host.adv.encrypted.ead_sample:
build_only: true
tags:
- bluetooth
platform_allow:
- nrf52_bsim
harness: bsim
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_encrypted_ead_sample_prj_conf
20 changes: 20 additions & 0 deletions tests/bsim/bluetooth/host/adv/extended/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
common:
build_only: true
tags:
- bluetooth
platform_allow:
- nrf52_bsim
- nrf5340bsim/nrf5340/cpunet
harness: bsim

tests:
bluetooth.host.adv.extended.advertiser:
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_extended_prj_advertiser_conf
extra_args:
CONF_FILE=prj_advertiser.conf
bluetooth.host.adv.extended.scanner:
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_extended_prj_scanner_conf
extra_args:
CONF_FILE=prj_scanner.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_extended_prj_advertiser_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=ext_adv_advertiser -rs=23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_extended_prj_advertiser_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=ext_adv_conn_advertiser -rs=23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_extended_prj_advertiser_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=ext_adv_conn_advertiser_x5 -rs=23
Expand Down
13 changes: 0 additions & 13 deletions tests/bsim/bluetooth/host/adv/long_ad/compile.sh

This file was deleted.

4 changes: 4 additions & 0 deletions tests/bsim/bluetooth/host/adv/long_ad/test_scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ verbosity_level=2

SIM_LEN_US=$((2 * 1000 * 1000))

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

test_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD_TS}_${test_name}_prj_conf"

cd ${BSIM_OUT_PATH}/bin
Expand Down
10 changes: 10 additions & 0 deletions tests/bsim/bluetooth/host/adv/long_ad/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests:
bluetooth.host.adv.long_ad:
build_only: true
tags:
- bluetooth
platform_allow:
- nrf52_bsim
harness: bsim
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_long_ad_prj_conf
14 changes: 0 additions & 14 deletions tests/bsim/bluetooth/host/adv/periodic/prj_coded.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
CONFIG_BT=y
CONFIG_BT_DEVICE_NAME="test_per_adv"
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_SMP=y
CONFIG_BT_PRIVACY=y

CONFIG_BT_EXT_ADV=y
CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_ADV_AUX_SET=2
CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=2
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_PER_ADV=y
CONFIG_BT_PER_ADV_SYNC=y
15 changes: 1 addition & 14 deletions tests/bsim/bluetooth/host/adv/periodic/prj_long_data.conf
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
CONFIG_BT=y
CONFIG_BT_DEVICE_NAME="test_per_adv"
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_SMP=y
CONFIG_BT_PRIVACY=y

CONFIG_BT_EXT_ADV=y
CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_ADV_AUX_SET=2
CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=2
CONFIG_BT_CTLR_ADV_AUX_PDU_BACK2BACK=y
CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK=y
CONFIG_BT_PER_ADV=y
CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_PER_ADV_SYNC_BUF_SIZE=1650

CONFIG_BT_PER_ADV_SYNC_BUF_SIZE=1650
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=1650
CONFIG_BT_CTLR_ADV_DATA_CHAIN=y
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=1650
23 changes: 23 additions & 0 deletions tests/bsim/bluetooth/host/adv/periodic/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
common:
build_only: true
tags:
- bluetooth
platform_allow:
- nrf52_bsim
- nrf5340bsim/nrf5340/cpunet
harness: bsim

tests:
bluetooth.host.adv.periodic:
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_periodic_prj_conf
bluetooth.host.adv.periodic.coded:
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_periodic_prj_coded_conf
extra_args:
EXTRA_CONF_FILE=prj_coded.conf
bluetooth.host.adv.periodic.long_data:
harness_config:
bsim_exe_name: tests_bsim_bluetooth_host_adv_periodic_prj_long_data_conf
extra_args:
EXTRA_CONF_FILE=prj_long_data.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_periodic_prj_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=per_adv_advertiser -rs=23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_periodic_prj_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=per_adv_advertiser -rs=23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_periodic_prj_coded_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=per_adv_advertiser_coded_phy -rs=23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_periodic_prj_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=per_adv_conn_advertiser -rs=23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_periodic_prj_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=per_adv_conn_privacy_advertiser -rs=23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ verbosity_level=2

cd ${BSIM_OUT_PATH}/bin

if [ "${BOARD_TS}" = "nrf52_bsim" ]; then
BOARD_TS="${BOARD_TS}_native"
fi

Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_adv_periodic_prj_long_data_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
-testid=per_adv_long_data_advertiser -rs=23
Expand Down
27 changes: 0 additions & 27 deletions tests/bsim/bluetooth/host/att/compile.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
CONFIG_BT_TESTING=y
CONFIG_LOG=y
CONFIG_ASSERT=y

CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
Expand All @@ -9,7 +13,3 @@ CONFIG_BT_L2CAP_ECRED=y
CONFIG_BT_EATT_MAX=5
CONFIG_BT_MAX_CONN=1
CONFIG_BT_EATT_AUTO_CONNECT=n

CONFIG_BT_TESTING=y
CONFIG_LOG=y
CONFIG_ASSERT=y
15 changes: 1 addition & 14 deletions tests/bsim/bluetooth/host/att/eatt/prj_autoconnect.conf
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP=y
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_DEVICE_NAME="EATT test"
CONFIG_BT_EATT=y
CONFIG_BT_L2CAP_ECRED=y
CONFIG_BT_EATT_MAX=5
CONFIG_BT_MAX_CONN=1

CONFIG_BT_TESTING=y
CONFIG_LOG=y
CONFIG_ASSERT=y
CONFIG_BT_EATT_AUTO_CONNECT=y

CONFIG_BT_L2CAP_TX_MTU=200
CONFIG_BT_L2CAP_LOG_LEVEL_DBG=y
Loading

0 comments on commit 7fcc7ef

Please sign in to comment.