tests/bsim bt host/security/*: Test 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. Some of the _compile scripts were rotten => Fix them. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
parent
06326dc8c2
commit
8002730b65
18 changed files with 47 additions and 204 deletions
|
@ -3,18 +3,11 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# Read variable definitions output by _env.sh
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
|
||||
: "${BSIM_COMPONENTS_PATH:?BSIM_COMPONENTS_PATH must be defined}"
|
||||
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
|
||||
|
||||
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
|
||||
BOARD="${BOARD:-nrf52_bsim}"
|
||||
BOARD_ROOT="${BOARD_ROOT:-${ZEPHYR_BASE}}"
|
||||
INCR_BUILD=1
|
||||
mkdir -p ${WORK_DIR}
|
||||
|
||||
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||
app="tests/bsim/bluetooth/$test_name" compile
|
||||
app="$(guess_test_relpath)" _compile
|
||||
|
|
|
@ -1,15 +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]}")")"
|
||||
|
||||
: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"
|
||||
|
||||
test_name="security_bond_overwrite_allowed"
|
||||
bsim_bin="${BSIM_OUT_PATH}/bin"
|
||||
verbosity_level=2
|
||||
BOARD="${BOARD:-nrf52_bsim}"
|
||||
simulation_id="$test_name"
|
||||
central_exe="${bsim_bin}/bs_${BOARD}_tests_bsim_bluetooth_host_${test_name}_prj_conf"
|
||||
peripheral_exe="${central_exe}"
|
|
@ -3,12 +3,13 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||
|
||||
EXECUTE_TIMEOUT=30
|
||||
simulation_id="security_bond_overwrite_allowed"
|
||||
verbosity_level=2
|
||||
|
||||
central_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD}_$(guess_test_long_name)_prj_conf"
|
||||
peripheral_exe="${central_exe}"
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
|
|
|
@ -3,18 +3,10 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# Read variable definitions output by _env.sh
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
|
||||
: "${BSIM_COMPONENTS_PATH:?BSIM_COMPONENTS_PATH must be defined}"
|
||||
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
|
||||
|
||||
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
|
||||
BOARD="${BOARD:-nrf52_bsim}"
|
||||
BOARD_ROOT="${BOARD_ROOT:-${ZEPHYR_BASE}}"
|
||||
INCR_BUILD=1
|
||||
mkdir -p ${WORK_DIR}
|
||||
|
||||
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||
app="tests/bsim/bluetooth/$test_name" compile
|
||||
app="$(guess_test_relpath)" _compile
|
||||
|
|
|
@ -1,30 +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]}")")"
|
||||
|
||||
: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"
|
||||
|
||||
test_name="security_bond_overwrite_denied"
|
||||
bsim_bin="${BSIM_OUT_PATH}/bin"
|
||||
verbosity_level=2
|
||||
BOARD="${BOARD:-nrf52_bsim}"
|
||||
simulation_id="$test_name"
|
||||
central_exe="${bsim_bin}/bs_${BOARD}_tests_bsim_bluetooth_host_${test_name}_prj_conf"
|
||||
peripheral_exe="${central_exe}"
|
||||
|
||||
function print_var {
|
||||
# Print a shell-sourceable variable definition.
|
||||
local var_name="$1"
|
||||
local var_repr="${!var_name@Q}"
|
||||
echo "$var_name=$var_repr"
|
||||
}
|
||||
|
||||
print_var test_name
|
||||
print_var bsim_bin
|
||||
print_var verbosity_level
|
||||
print_var BOARD
|
||||
print_var simulation_id
|
||||
print_var central_exe
|
||||
print_var peripheral_exe
|
|
@ -3,13 +3,13 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# Read variable definitions output by _env.sh
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||
|
||||
EXECUTE_TIMEOUT=30
|
||||
simulation_id="security_bond_overwrite_denied"
|
||||
verbosity_level=2
|
||||
central_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD}_$(guess_test_long_name)_prj_conf"
|
||||
peripheral_exe="${central_exe}"
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
|
|
|
@ -3,18 +3,10 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# Read variable definitions output by _env.sh
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
|
||||
: "${BSIM_COMPONENTS_PATH:?BSIM_COMPONENTS_PATH must be defined}"
|
||||
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
|
||||
|
||||
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
|
||||
BOARD="${BOARD:-nrf52_bsim}"
|
||||
BOARD_ROOT="${BOARD_ROOT:-${ZEPHYR_BASE}}"
|
||||
INCR_BUILD=1
|
||||
mkdir -p ${WORK_DIR}
|
||||
|
||||
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||
app="tests/bsim/bluetooth/$test_name" compile
|
||||
app="$(guess_test_relpath)" _compile
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#!/usr/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="security_bond_per_connection"
|
||||
bsim_bin="${BSIM_OUT_PATH}/bin"
|
||||
verbosity_level=2
|
||||
BOARD="${BOARD:-nrf52_bsim}"
|
||||
simulation_id="$test_name"
|
||||
central_exe="${bsim_bin}/bs_${BOARD}_tests_bsim_bluetooth_host_${test_name}_prj_conf"
|
||||
peripheral_exe="${central_exe}"
|
||||
|
||||
function print_var {
|
||||
# Print a shell-sourceable variable definition.
|
||||
local var_name="$1"
|
||||
local var_repr="${!var_name@Q}"
|
||||
echo "$var_name=$var_repr"
|
||||
}
|
||||
|
||||
print_var test_name
|
||||
print_var bsim_bin
|
||||
print_var verbosity_level
|
||||
print_var BOARD
|
||||
print_var simulation_id
|
||||
print_var central_exe
|
||||
print_var peripheral_exe
|
|
@ -3,13 +3,14 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# Read variable definitions output by _env.sh
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||
|
||||
EXECUTE_TIMEOUT=30
|
||||
verbosity_level=2
|
||||
|
||||
simulation_id="security_bond_per_connection"
|
||||
|
||||
central_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD}_$(guess_test_long_name)_prj_conf"
|
||||
peripheral_exe="${central_exe}"
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
|
|
|
@ -3,12 +3,14 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
|
||||
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
|
||||
INCR_BUILD=1
|
||||
|
||||
west build -b nrf52_bsim -d build_test && \
|
||||
cp -v build_test/zephyr/zephyr.exe "${test_exe}"
|
||||
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||
|
||||
west build -b nrf52_bsim -d build_test_2 -- -DCONF_FILE=prj_2.conf && \
|
||||
cp -v build_test_2/zephyr/zephyr.exe "${test_exe_2}"
|
||||
app="$(guess_test_relpath)" compile
|
||||
app="$(guess_test_relpath)" conf_file=prj_2.conf compile
|
||||
|
||||
wait_for_background_jobs
|
||||
|
|
|
@ -1,16 +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_security_ccc_update_prj_conf"
|
||||
test_exe_2="${bsim_bin}/bs_${BOARD}_tests_bsim_bluetooth_host_security_ccc_update_prj_2_conf"
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2023 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
@ -8,7 +8,6 @@ test_name='ccc_update'
|
|||
test_exe="bs_${BOARD}_tests_bsim_bluetooth_host_security_${test_name}_prj_conf"
|
||||
simulation_id="${test_name}"
|
||||
verbosity_level=2
|
||||
EXECUTE_TIMEOUT=30
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2023 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
@ -8,7 +8,6 @@ test_name='ccc_update'
|
|||
test_exe="bs_${BOARD}_tests_bsim_bluetooth_host_security_${test_name}_prj_2_conf"
|
||||
simulation_id="${test_name}_2"
|
||||
verbosity_level=2
|
||||
EXECUTE_TIMEOUT=30
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
|
|
|
@ -3,22 +3,14 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# Read variable definitions output by _env.sh
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
|
||||
: "${BSIM_COMPONENTS_PATH:?BSIM_COMPONENTS_PATH must be defined}"
|
||||
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
|
||||
|
||||
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
|
||||
BOARD="${BOARD:-nrf52_bsim}"
|
||||
BOARD_ROOT="${BOARD_ROOT:-${ZEPHYR_BASE}}"
|
||||
INCR_BUILD=1
|
||||
mkdir -p ${WORK_DIR}
|
||||
|
||||
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||
|
||||
app="tests/bsim/bluetooth/host/security/$test_name/central" compile
|
||||
app="tests/bsim/bluetooth/host/security/$test_name/peripheral" compile
|
||||
app="$(guess_test_relpath)/central" compile
|
||||
app="$(guess_test_relpath)/peripheral" compile
|
||||
|
||||
wait_for_background_jobs
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
#!/usr/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="id_addr_update"
|
||||
bsim_bin="${BSIM_OUT_PATH}/bin"
|
||||
verbosity_level=2
|
||||
board="${BOARD:-nrf52_bsim}"
|
||||
simulation_id="$test_name"
|
||||
test_path="tests_bsim_bluetooth_host_security_${test_name}"
|
||||
central_exe="${bsim_bin}/bs_${board}_${test_path}_central_prj_conf"
|
||||
peripheral_exe="${bsim_bin}/bs_${board}_${test_path}_peripheral_prj_conf"
|
||||
|
||||
function print_var {
|
||||
# Print a shell-sourceable variable definition.
|
||||
local var_name="$1"
|
||||
local var_repr="${!var_name@Q}"
|
||||
echo "$var_name=$var_repr"
|
||||
}
|
||||
|
||||
print_var test_name
|
||||
print_var bsim_bin
|
||||
print_var verbosity_level
|
||||
print_var board
|
||||
print_var simulation_id
|
||||
print_var central_exe
|
||||
print_var peripheral_exe
|
|
@ -3,13 +3,14 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# Read variable definitions output by _env.sh
|
||||
source "${bash_source_dir}/_env.sh"
|
||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||
|
||||
EXECUTE_TIMEOUT=10
|
||||
verbosity_level=2
|
||||
simulation_id="id_addr_update"
|
||||
|
||||
test_path="$(guess_test_long_name)"
|
||||
central_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD}_${test_path}_central_prj_conf"
|
||||
peripheral_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD}_${test_path}_peripheral_prj_conf"
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
#!/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2023 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -eu
|
||||
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"
|
||||
|
||||
# Terminate running simulations (if any)
|
||||
${BSIM_COMPONENTS_PATH}/common/stop_bsim.sh
|
||||
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
|
||||
INCR_BUILD=1
|
||||
|
||||
test_name='security_changed_callback'
|
||||
|
||||
: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"
|
||||
bsim_bin="${BSIM_OUT_PATH}/bin"
|
||||
BOARD="${BOARD:-nrf52_bsim}"
|
||||
test_exe="${bsim_bin}/bs_${BOARD}_tests_bsim_bluetooth_host_security_${test_name}_prj_conf"
|
||||
|
||||
west build -b nrf52_bsim -d build && \
|
||||
cp -v build/zephyr/zephyr.exe "${test_exe}"
|
||||
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||
app="$(guess_test_relpath)" _compile
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2023 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
@ -8,7 +8,6 @@ test_name='security_changed_callback'
|
|||
test_exe="bs_${BOARD}_tests_bsim_bluetooth_host_security_${test_name}_prj_conf"
|
||||
simulation_id="${test_name}"
|
||||
verbosity_level=2
|
||||
EXECUTE_TIMEOUT=30
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue