tests/bsim bt host/misc: Tests scripts cleanup
Ensure we call the common source script before using the BOARD variable; 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. And return !=0 on error. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
parent
769910b3e9
commit
e9c6f37daf
8 changed files with 44 additions and 56 deletions
|
@ -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_misc_disconnect_dut_prj_conf"
|
|
||||||
tester_exe="bs_${BOARD}_tests_bsim_bluetooth_host_misc_disconnect_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}"
|
|
14
tests/bsim/bluetooth/host/misc/disconnect/test_scripts/_compile.sh
Executable file
14
tests/bsim/bluetooth/host/misc/disconnect/test_scripts/_compile.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/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
|
|
@ -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_misc_disconnect_dut_prj_conf"
|
|
||||||
tester_exe="bs_${BOARD}_tests_bsim_bluetooth_host_misc_disconnect_tester_prj_conf"
|
|
||||||
|
|
||||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
test_name="misc_disconnect"
|
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="misc_disconnect"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=30
|
|
||||||
sim_length_us=10e6
|
sim_length_us=10e6
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
@ -46,3 +43,5 @@ for j in {0..1}; do
|
||||||
echo "${BSIM_OUT_PATH}/results/${simulation_id}/Trace_$i.Tx.pcap"
|
echo "${BSIM_OUT_PATH}/results/${simulation_id}/Trace_$i.Tx.pcap"
|
||||||
echo "${BSIM_OUT_PATH}/results/${simulation_id}/Trace_$i.Rx.pcap"
|
echo "${BSIM_OUT_PATH}/results/${simulation_id}/Trace_$i.Rx.pcap"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
exit $exit_code
|
|
@ -1,17 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright 2024 Nordic Semiconductor ASA
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
# Path checks, etc
|
|
||||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
|
||||||
|
|
||||||
# Place yourself in the test's root (i.e. ./../)
|
|
||||||
rm -rf ${BSIM_OUT_PATH}/bin/bs_nrf52_bsim_tests*
|
|
||||||
|
|
||||||
# terminate running simulations (if any)
|
|
||||||
${BSIM_COMPONENTS_PATH}/common/stop_bsim.sh
|
|
||||||
|
|
||||||
bsim_exe=bs_nrf52_bsim_tests_bsim_bluetooth_host_misc_hfc_prj_conf
|
|
||||||
|
|
||||||
west build -b nrf52_bsim && \
|
|
||||||
cp build/zephyr/zephyr.exe ${BSIM_OUT_PATH}/bin/${bsim_exe}
|
|
14
tests/bsim/bluetooth/host/misc/hfc/test_scripts/_compile.sh
Executable file
14
tests/bsim/bluetooth/host/misc/hfc/test_scripts/_compile.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/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)" compile
|
||||||
|
|
||||||
|
wait_for_background_jobs
|
|
@ -1,17 +1,14 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#Copyright (c) 2024 NXP
|
# Copyright 2023 Nordic Semiconductor ASA
|
||||||
#Copyright (c) 2024 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_misc_unregister_conn_cb_prj_conf
|
wait_for_background_jobs
|
||||||
west build -b nrf52_bsim && \
|
|
||||||
cp build/zephyr/zephyr.exe ${BSIM_OUT_PATH}/bin/${bsim_exe}
|
|
||||||
|
|
|
@ -12,12 +12,11 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
#neither flag change can be found, callback function was unregistered as expected
|
#neither flag change can be found, callback function was unregistered as expected
|
||||||
simulation_id="unregister_conn_cb"
|
simulation_id="unregister_conn_cb"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=20
|
|
||||||
|
bsim_exe=./bs_${BOARD}_tests_bsim_bluetooth_host_misc_unregister_conn_cb_prj_conf
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
bsim_exe=./bs_nrf52_bsim_tests_bsim_bluetooth_host_misc_unregister_conn_cb_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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue