tests/bsim bt host/l2cap: Tests scripts cleanup

Use the common scripts to perform common functions
and do a cleanup.
Do not set variables to their defaults, set things
closer to were they are needed;
Do not perform unnecesary checks;
And in general avoid unnecessary complexity.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2024-03-20 16:43:10 +01:00 committed by Alberto Escolar
commit 769910b3e9
15 changed files with 98 additions and 113 deletions

View file

@ -1,20 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright 2023 Nordic Semiconductor ASA # Copyright 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
set -eu
# Path checks, etc : "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
# Place yourself in the test's root (i.e. ./../) WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
rm -rf ${BSIM_OUT_PATH}/bin/bs_nrf52_bsim_tests* INCR_BUILD=1
source ${ZEPHYR_BASE}/tests/bsim/compile.source
# terminate running simulations (if any) app="$(guess_test_relpath)" compile
${BSIM_COMPONENTS_PATH}/common/stop_bsim.sh app="$(guess_test_relpath)" conf_file=prj_ecred.conf compile
bsim_exe=bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_credits_prj_conf wait_for_background_jobs
west build -b nrf52_bsim && \
cp build/zephyr/zephyr.exe ${BSIM_OUT_PATH}/bin/${bsim_exe}
bsim_exe=bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_credits_prj_ecred_conf
west build -b nrf52_bsim -d build_ecred -- -DCONF_FILE=prj_ecred.conf && \
cp build_ecred/zephyr/zephyr.exe ${BSIM_OUT_PATH}/bin/${bsim_exe}

View file

@ -5,23 +5,11 @@
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
verbosity_level=2 verbosity_level=2
EXECUTE_TIMEOUT=20 simulation_id=$(guess_test_long_name)
bsim_exe=./bs_${BOARD}_$(guess_test_long_name)_prj_conf
cd ${BSIM_OUT_PATH}/bin cd ${BSIM_OUT_PATH}/bin
simulation_id=bluetooth_host_l2cap_credits_prj_conf
bsim_exe=./bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_credits_prj_conf
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=2 -sim_length=30e6 $@
wait_for_background_jobs
simulation_id=bluetooth_host_l2cap_credits_prj_ecred_conf
bsim_exe=./bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_credits_prj_ecred_conf
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Copyright (c) 2023 Nordic Semiconductor
# SPDX-License-Identifier: Apache-2.0
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
verbosity_level=2
simulation_id=$(guess_test_long_name)_ecred
bsim_exe=./bs_${BOARD}_$(guess_test_long_name)_prj_ecred_conf
cd ${BSIM_OUT_PATH}/bin
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=2 -sim_length=30e6 $@
wait_for_background_jobs

View file

@ -1,23 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright 2023 Nordic Semiconductor ASA # Copyright 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
set -eu
# Usage: Place yourself in the test's root (i.e. ./../) : "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
export BOARD=nrf52_bsim WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
INCR_BUILD=1
source ${ZEPHYR_BASE}/tests/bsim/compile.source
# Path checks, etc app="$(guess_test_relpath)" compile
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source app="$(guess_test_relpath)" conf_file=prj_ecred.conf compile
rm -rf ${BSIM_OUT_PATH}/bin/bs_nrf52_bsim_tests* wait_for_background_jobs
# terminate running simulations (if any)
${BSIM_COMPONENTS_PATH}/common/stop_bsim.sh
bsim_exe=bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_credits_seg_recv_prj_conf
west build -b nrf52_bsim && \
cp build/zephyr/zephyr.exe ${BSIM_OUT_PATH}/bin/${bsim_exe}
bsim_exe=bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_credits_seg_recv_prj_ecred_conf
west build -b nrf52_bsim -d build_ecred -- -DCONF_FILE=prj_ecred.conf && \
cp build_ecred/zephyr/zephyr.exe ${BSIM_OUT_PATH}/bin/${bsim_exe}

View file

@ -5,23 +5,11 @@
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
verbosity_level=2 verbosity_level=2
EXECUTE_TIMEOUT=20 simulation_id=$(guess_test_long_name)
bsim_exe=./bs_${BOARD}_$(guess_test_long_name)_prj_conf
cd ${BSIM_OUT_PATH}/bin cd ${BSIM_OUT_PATH}/bin
simulation_id=bluetooth_host_l2cap_credits_seg_recv_prj_conf
bsim_exe=./bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_credits_seg_recv_prj_conf
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=2 -sim_length=30e6 $@
wait_for_background_jobs
simulation_id=bluetooth_host_l2cap_credits_seg_recv_prj_ecred_conf
bsim_exe=./bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_credits_seg_recv_prj_ecred_conf
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Copyright (c) 2023 Nordic Semiconductor
# SPDX-License-Identifier: Apache-2.0
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
verbosity_level=2
simulation_id=$(guess_test_long_name)_ecred
bsim_exe=./bs_${BOARD}_$(guess_test_long_name)_prj_ecred_conf
cd ${BSIM_OUT_PATH}/bin
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=2 -sim_length=30e6 $@
wait_for_background_jobs

View file

@ -1,16 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright 2024 Nordic Semiconductor ASA # Copyright 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
set -eu
# Path checks, etc : "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
# Place yourself in the test's root (i.e. ./../) WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
rm -rf ${BSIM_OUT_PATH}/bin/bs_nrf52_bsim_tests* INCR_BUILD=1
source ${ZEPHYR_BASE}/tests/bsim/compile.source
# terminate running simulations (if any) app="$(guess_test_relpath)" compile
${BSIM_COMPONENTS_PATH}/common/stop_bsim.sh
bsim_exe=bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_frags_prj_conf wait_for_background_jobs
west build -b nrf52_bsim && \
cp build/zephyr/zephyr.exe ${BSIM_OUT_PATH}/bin/${bsim_exe}

View file

@ -5,13 +5,11 @@
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
verbosity_level=2 verbosity_level=2
EXECUTE_TIMEOUT=20 simulation_id=$(guess_test_long_name)
bsim_exe=./bs_${BOARD}_$(guess_test_long_name)_prj_conf
cd ${BSIM_OUT_PATH}/bin cd ${BSIM_OUT_PATH}/bin
simulation_id=bluetooth_host_l2cap_frags_prj_conf
bsim_exe=./bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_frags_prj_conf
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=420
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=100

View file

@ -22,8 +22,6 @@ Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
wait_for_background_jobs wait_for_background_jobs
simulation_id="l2cap_send_on_connect_ecred" simulation_id="l2cap_send_on_connect_ecred"
verbosity_level=2
EXECUTE_TIMEOUT=120
cd ${BSIM_OUT_PATH}/bin cd ${BSIM_OUT_PATH}/bin

View file

@ -1,18 +0,0 @@
#!/usr/bin/env bash
# Copyright 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# Path checks, etc
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
BOARD="${BOARD:-nrf52_bsim}"
dut_exe="bs_${BOARD}_tests_bsim_bluetooth_host_l2cap_split_dut_prj_conf"
tester_exe="bs_${BOARD}_tests_bsim_bluetooth_host_l2cap_split_tester_prj_conf"
# terminate running simulations (if any)
${BSIM_COMPONENTS_PATH}/common/stop_bsim.sh
west build -b ${BOARD} -d build_dut dut && \
cp build_dut/zephyr/zephyr.exe "${BSIM_OUT_PATH}/bin/${dut_exe}" &&
west build -b ${BOARD} -d build_tester tester && \
cp build_tester/zephyr/zephyr.exe "${BSIM_OUT_PATH}/bin/${tester_exe}"

View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Copyright 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
set -eu
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
INCR_BUILD=1
source ${ZEPHYR_BASE}/tests/bsim/compile.source
app="$(guess_test_relpath)"/dut compile
app="$(guess_test_relpath)"/tester compile
wait_for_background_jobs

View file

@ -2,16 +2,13 @@
# Copyright 2023 Nordic Semiconductor ASA # Copyright 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
BOARD="${BOARD:-nrf52_bsim}"
dut_exe="bs_${BOARD}_tests_bsim_bluetooth_host_l2cap_split_dut_prj_conf"
tester_exe="bs_${BOARD}_tests_bsim_bluetooth_host_l2cap_split_tester_prj_conf"
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
test_name="l2cap_split" dut_exe="bs_${BOARD}_$(guess_test_long_name)_dut_prj_conf"
simulation_id="${test_name}" tester_exe="bs_${BOARD}_$(guess_test_long_name)_tester_prj_conf"
simulation_id="l2cap_split"
verbosity_level=2 verbosity_level=2
EXECUTE_TIMEOUT=30
sim_length_us=30e6 sim_length_us=30e6
cd ${BSIM_OUT_PATH}/bin cd ${BSIM_OUT_PATH}/bin

View file

@ -1,17 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright 2023 Nordic Semiconductor ASA # Copyright 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
set -eu
# Path checks, etc : "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
# Place yourself in the test's root (i.e. ./../) WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
rm -rf ${BSIM_OUT_PATH}/bin/bs_nrf52_bsim_tests* INCR_BUILD=1
source ${ZEPHYR_BASE}/tests/bsim/compile.source
# terminate running simulations (if any) app="$(guess_test_relpath)" compile
${BSIM_COMPONENTS_PATH}/common/stop_bsim.sh app="$(guess_test_relpath)" conf_file=prj_syswq.conf compile
bsim_exe=bs_nrf52_bsim_tests_bsim_bluetooth_host_l2cap_stress_prj_conf wait_for_background_jobs
west build -b nrf52_bsim && \
cp build/zephyr/zephyr.exe ${BSIM_OUT_PATH}/bin/${bsim_exe}

View file

@ -9,10 +9,10 @@ simulation_id="l2cap_stress"
verbosity_level=2 verbosity_level=2
EXECUTE_TIMEOUT=240 EXECUTE_TIMEOUT=240
cd ${BSIM_OUT_PATH}/bin
bsim_exe=./bs_${BOARD}_tests_bsim_bluetooth_host_l2cap_stress_prj_conf bsim_exe=./bs_${BOARD}_tests_bsim_bluetooth_host_l2cap_stress_prj_conf
cd ${BSIM_OUT_PATH}/bin
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=43 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=43
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=42 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=42

View file

@ -7,12 +7,12 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
# EATT test # EATT test
simulation_id="l2cap_stress_syswq" simulation_id="l2cap_stress_syswq"
verbosity_level=2 verbosity_level=2
EXECUTE_TIMEOUT=120 EXECUTE_TIMEOUT=240
cd ${BSIM_OUT_PATH}/bin
bsim_exe=./bs_${BOARD}_tests_bsim_bluetooth_host_l2cap_stress_prj_syswq_conf bsim_exe=./bs_${BOARD}_tests_bsim_bluetooth_host_l2cap_stress_prj_syswq_conf
cd ${BSIM_OUT_PATH}/bin
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=43 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=43
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=42 Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=42