tests/bsim bt host/adv: 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. Also, remove all timeouts which were unnecessarily too short Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
parent
0053f03d59
commit
5acc7c4815
16 changed files with 36 additions and 96 deletions
|
@ -8,7 +8,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="adv_chain"
|
simulation_id="adv_chain"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=10
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
#!/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
|
set -eu
|
||||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|
||||||
|
|
||||||
source "${bash_source_dir}/_env.sh"
|
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
|
||||||
|
|
||||||
west build -b nrf52_bsim && \
|
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
|
||||||
cp -v build/zephyr/zephyr.exe "${test_exe}"
|
INCR_BUILD=1
|
||||||
|
|
||||||
|
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||||
|
|
||||||
|
app="$(guess_test_relpath)" compile
|
||||||
|
|
||||||
|
wait_for_background_jobs
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/env bash
|
|
||||||
# Copyright 2023 Nordic Semiconductor ASA
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|
||||||
|
|
||||||
: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"
|
|
||||||
|
|
||||||
test_name="$(basename "$(realpath "$bash_source_dir/..")")"
|
|
||||||
bsim_bin="${BSIM_OUT_PATH}/bin"
|
|
||||||
verbosity_level=2
|
|
||||||
BOARD="${BOARD:-nrf52_bsim}"
|
|
||||||
simulation_id="$test_name"
|
|
||||||
test_exe="${bsim_bin}/bs_${BOARD}_tests_bsim_bluetooth_host_adv_encrypted_${test_name}_prj_conf"
|
|
|
@ -1,67 +1,41 @@
|
||||||
#!/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
|
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|
||||||
|
|
||||||
# Read variable definitions output by _env.sh
|
simulation_id="$(guess_test_long_name)"
|
||||||
source "${bash_source_dir}/_env.sh"
|
verbosity_level=2
|
||||||
|
test_exe="bs_${BOARD}_$(guess_test_long_name)_prj_conf"
|
||||||
process_ids=""
|
|
||||||
exit_code=0
|
|
||||||
|
|
||||||
function Execute() {
|
|
||||||
if [ ! -f $1 ]; then
|
|
||||||
echo -e " \e[91m$(pwd)/$(basename $1) cannot be found (did you forget to\
|
|
||||||
compile it?)\e[39m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
timeout 30 $@ &
|
|
||||||
process_ids="$process_ids $!"
|
|
||||||
}
|
|
||||||
|
|
||||||
: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
data_set=1
|
data_set=1
|
||||||
|
|
||||||
Execute "$test_exe" \
|
Execute ./"$test_exe" \
|
||||||
-v=${verbosity_level} -s="${simulation_id}_${data_set}" -d=0 -testid=central \
|
-v=${verbosity_level} -s="${simulation_id}_${data_set}" -d=0 -testid=central \
|
||||||
-RealEncryption=1 -argstest data-set="${data_set}"
|
-RealEncryption=1 -argstest data-set="${data_set}"
|
||||||
|
|
||||||
Execute "$test_exe" \
|
Execute ./"$test_exe" \
|
||||||
-v=${verbosity_level} -s="${simulation_id}_${data_set}" -d=1 -testid=peripheral \
|
-v=${verbosity_level} -s="${simulation_id}_${data_set}" -d=1 -testid=peripheral \
|
||||||
-RealEncryption=1 -argstest data-set="${data_set}"
|
-RealEncryption=1 -argstest data-set="${data_set}"
|
||||||
|
|
||||||
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s="${simulation_id}_${data_set}" \
|
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s="${simulation_id}_${data_set}" \
|
||||||
-D=2 -sim_length=60e6 $@
|
-D=2 -sim_length=60e6 $@
|
||||||
|
|
||||||
for process_id in $process_ids; do
|
wait_for_background_jobs
|
||||||
wait $process_id || let "exit_code=$?"
|
|
||||||
done
|
|
||||||
process_ids=''
|
|
||||||
|
|
||||||
data_set=2
|
data_set=2
|
||||||
|
|
||||||
Execute "$test_exe" \
|
Execute ./"$test_exe" \
|
||||||
-v=${verbosity_level} -s="${simulation_id}_${data_set}" -d=0 -testid=central \
|
-v=${verbosity_level} -s="${simulation_id}_${data_set}" -d=0 -testid=central \
|
||||||
-RealEncryption=1 -argstest data-set="${data_set}"
|
-RealEncryption=1 -argstest data-set="${data_set}"
|
||||||
|
|
||||||
Execute "$test_exe" \
|
Execute ./"$test_exe" \
|
||||||
-v=${verbosity_level} -s="${simulation_id}_${data_set}" -d=1 -testid=peripheral \
|
-v=${verbosity_level} -s="${simulation_id}_${data_set}" -d=1 -testid=peripheral \
|
||||||
-RealEncryption=1 -argstest data-set="${data_set}"
|
-RealEncryption=1 -argstest data-set="${data_set}"
|
||||||
|
|
||||||
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s="${simulation_id}_${data_set}" \
|
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s="${simulation_id}_${data_set}" \
|
||||||
-D=2 -sim_length=60e6 $@
|
-D=2 -sim_length=60e6 $@
|
||||||
|
|
||||||
for process_id in $process_ids; do
|
wait_for_background_jobs
|
||||||
wait $process_id || let "exit_code=$?"
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ${exit_code} -ne 0 ]; then
|
|
||||||
exit_code=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $exit_code # the last exit code != 0
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="ead_sample"
|
simulation_id="ead_sample"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=30
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="ext_adv"
|
simulation_id="ext_adv"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=10
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="ext_adv_conn"
|
simulation_id="ext_adv_conn"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=10
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="ext_adv_conn_x5"
|
simulation_id="ext_adv_conn_x5"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=10
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="per_adv"
|
simulation_id="per_adv"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=10
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="per_adv_conn"
|
simulation_id="per_adv_conn"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=10
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="per_adv_conn_privacy"
|
simulation_id="per_adv_conn_privacy"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=10
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="per_adv_long_data"
|
simulation_id="per_adv_long_data"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=10
|
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright 2022 Nordic Semiconductor ASA
|
# Copyright 2023 Nordic Semiconductor ASA
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|
||||||
|
|
||||||
# Read variable definitions output by _env.sh
|
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
|
||||||
source "${bash_source_dir}/_env.sh"
|
|
||||||
|
|
||||||
# Place yourself in the test's root (i.e. ./../)
|
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
|
||||||
west build -b nrf52_bsim -d build_test && \
|
INCR_BUILD=1
|
||||||
cp build_test/zephyr/zephyr.exe "${test_exe}"
|
|
||||||
|
|
||||||
west build -b nrf52_bsim -d build_test_2 -- -DCONF_FILE=prj_2.conf && \
|
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||||
cp build_test_2/zephyr/zephyr.exe "${test_2_exe}"
|
|
||||||
|
app="$(guess_test_relpath)" compile
|
||||||
|
app="$(guess_test_relpath)" conf_file=prj_2.conf compile
|
||||||
|
|
||||||
|
wait_for_background_jobs
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright 2022 Nordic Semiconductor ASA
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
set -eu
|
|
||||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|
||||||
|
|
||||||
test_name="$(basename "$(realpath "$bash_source_dir/..")")"
|
|
||||||
bsim_bin="${BSIM_OUT_PATH}/bin"
|
|
||||||
BOARD="${BOARD:-nrf52_bsim}"
|
|
||||||
test_exe="${bsim_bin}/bs_${BOARD}_tests_bsim_bluetooth_host_adv_resume_prj_conf"
|
|
||||||
test_2_exe="${bsim_bin}/bs_${BOARD}_tests_bsim_bluetooth_host_adv_resume_prj_2_conf"
|
|
|
@ -3,14 +3,11 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|
||||||
|
|
||||||
source "${bash_source_dir}/_env.sh"
|
|
||||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="${test_name}"
|
simulation_id="$(guess_test_long_name)"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=30
|
test_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD}_$(guess_test_long_name)_prj_conf"
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,12 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|
||||||
|
|
||||||
source "${bash_source_dir}/_env.sh"
|
|
||||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||||
|
|
||||||
simulation_id="${test_name}_2"
|
simulation_id="$(guess_test_long_name)_2"
|
||||||
verbosity_level=2
|
verbosity_level=2
|
||||||
EXECUTE_TIMEOUT=30
|
test_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD}_$(guess_test_long_name)_prj_conf"
|
||||||
|
test_2_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD}_$(guess_test_long_name)_prj_2_conf"
|
||||||
|
|
||||||
cd ${BSIM_OUT_PATH}/bin
|
cd ${BSIM_OUT_PATH}/bin
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue