Skip to content

Commit

Permalink
tests: bsim: bluetooth: run host tests with twister
Browse files Browse the repository at this point in the history
With added support of running bsim tests with Twister, separate
building command is no longer need as tests can be build and
run with single command.

Signed-off-by: Artur Dobrynin <artur.dobrynin@nordicsemi.no>
  • Loading branch information
ardo-nordic committed Feb 19, 2025
1 parent b44404e commit b1be69e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 37 deletions.
13 changes: 8 additions & 5 deletions scripts/pylib/twister/twisterlib/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,23 @@ def get_scenario(self, name):
d[k] = v

harness_config = copy.deepcopy(self.common.get("harness_config", {}))
if 'harness_config' in self.scenarios[name]:
if "harness_config" in self.scenarios[name]:
if harness_config:
for k, v in self.scenarios[name]['harness_config'].items():
for k, v in self.scenarios[name]["harness_config"].items():
if k in harness_config:
if isinstance(harness_config[k], list):
harness_config[k] += v if isinstance(v, list) else [v]
if d["harness"] == "bsim":
harness_config[k] += v if isinstance(v, list) else [v]
else:
harness_config[k] = v if isinstance(v, list) else [v]
else:
harness_config[k] = v
else:
harness_config[k] = v
else:
harness_config = self.scenarios[name]['harness_config']
harness_config = self.scenarios[name]["harness_config"]

d['harness_config'] = harness_config
d["harness_config"] = harness_config

# Compile conf files in to a single list. The order to apply them is:
# (1) CONF_FILEs extracted from common['extra_args']
Expand Down
6 changes: 3 additions & 3 deletions scripts/pylib/twister/twisterlib/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,9 +1015,9 @@ def clean_exes(self):
self._set_start_time()

try:
for exe_path in [self._get_exe_path(i) for i in range(len(self._exe_paths))]:
if os.path.exists(exe_path):
os.remove(exe_path)
for exe_path in [self._get_exe_path(i) for i in range(len(self._exe_paths))]:
if os.path.exists(exe_path):
os.remove(exe_path)
except Exception as e:
logger.warning(f'Failed to clean up bsim exes: {e}')

Expand Down
1 change: 0 additions & 1 deletion tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpunet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ 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
1 change: 0 additions & 1 deletion tests/bsim/bluetooth/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
# the rest to save a couple of seconds.
run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio/compile.sh
${ZEPHYR_BASE}/tests/bsim/bluetooth/audio_samples/compile.sh
${ZEPHYR_BASE}/tests/bsim/bluetooth/host/compile.sh
${ZEPHYR_BASE}/tests/bsim/bluetooth/ll/compile.sh
${ZEPHYR_BASE}/tests/bsim/bluetooth/mesh/compile.sh
${ZEPHYR_BASE}/tests/bsim/bluetooth/samples/compile.sh
Expand Down
15 changes: 0 additions & 15 deletions tests/bsim/bluetooth/host/compile.sh

This file was deleted.

12 changes: 0 additions & 12 deletions tests/bsim/bluetooth/tests.nrf5340bsim_nrf5340_cpunet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,3 @@
# built in the net core)
# This file is used in CI to select which tests are run
tests/bsim/bluetooth/ll/
tests/bsim/bluetooth/host/att/eatt_notif
tests/bsim/bluetooth/host/misc/disable
tests/bsim/bluetooth/host/misc/unregister_conn_cb
tests/bsim/bluetooth/host/adv/periodic
tests/bsim/bluetooth/host/adv/extended
tests/bsim/bluetooth/host/adv/chain
tests/bsim/bluetooth/host/l2cap/send_on_connect
tests/bsim/bluetooth/host/central
tests/bsim/bluetooth/host/privacy/central
tests/bsim/bluetooth/host/gatt/authorization
tests/bsim/bluetooth/host/gatt/general
tests/bsim/bluetooth/host/gatt/caching
4 changes: 4 additions & 0 deletions tests/bsim/ci.bt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ RESULTS_FILE=${ZEPHYR_BASE}/bsim_out/bsim_results.bt.52.xml \
TESTS_FILE=tests/bsim/bluetooth/tests.nrf52bsim.txt \
tests/bsim/run_parallel.sh

west twister -T ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/ -p nrf52_bsim/native

# nrf5340bsim/nrf5340/cpunet set:
nice tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpunet.sh

Expand All @@ -27,6 +29,8 @@ RESULTS_FILE=${ZEPHYR_BASE}/bsim_out/bsim_results.bt.53_cpunet.xml \
TESTS_FILE=tests/bsim/bluetooth/tests.nrf5340bsim_nrf5340_cpunet.txt \
tests/bsim/run_parallel.sh

west twister -T ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/ -p nrf5340bsim/nrf5340/cpunet

# nrf5340 split stack set:
nice tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh

Expand Down

0 comments on commit b1be69e

Please sign in to comment.