Skip to content

Commit 2a46561

Browse files
committed
tests: bsim: bluetooth: run host tests with twister
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 <[email protected]>
1 parent 4a994c3 commit 2a46561

File tree

7 files changed

+15
-37
lines changed

7 files changed

+15
-37
lines changed

scripts/pylib/twister/twisterlib/config_parser.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,20 +205,23 @@ def get_scenario(self, name: str) -> dict[str, Any]:
205205
d[k] = v
206206

207207
harness_config = copy.deepcopy(self.common.get("harness_config", {}))
208-
if 'harness_config' in self.scenarios[name]:
208+
if "harness_config" in self.scenarios[name]:
209209
if harness_config:
210-
for k, v in self.scenarios[name]['harness_config'].items():
210+
for k, v in self.scenarios[name]["harness_config"].items():
211211
if k in harness_config:
212212
if isinstance(harness_config[k], list):
213-
harness_config[k] += v if isinstance(v, list) else [v]
213+
if d["harness"] == "bsim":
214+
harness_config[k] += v if isinstance(v, list) else [v]
215+
else:
216+
harness_config[k] = v if isinstance(v, list) else [v]
214217
else:
215218
harness_config[k] = v
216219
else:
217220
harness_config[k] = v
218221
else:
219-
harness_config = self.scenarios[name]['harness_config']
222+
harness_config = self.scenarios[name]["harness_config"]
220223

221-
d['harness_config'] = harness_config
224+
d["harness_config"] = harness_config
222225

223226
# Compile conf files in to a single list. The order to apply them is:
224227
# (1) CONF_FILEs extracted from common['extra_args']

scripts/pylib/twister/twisterlib/harness.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,9 +1015,9 @@ def clean_exes(self):
10151015
self._set_start_time()
10161016

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

tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpunet.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ export BOARD="${BOARD:-nrf5340bsim/nrf5340/cpunet}"
1313
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
1414

1515
${ZEPHYR_BASE}/tests/bsim/bluetooth/ll/compile.sh
16-
${ZEPHYR_BASE}/tests/bsim/bluetooth/host/compile.sh
1716

1817
wait_for_background_jobs

tests/bsim/bluetooth/compile.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
1717
# the rest to save a couple of seconds.
1818
run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio/compile.sh
1919
${ZEPHYR_BASE}/tests/bsim/bluetooth/audio_samples/compile.sh
20-
${ZEPHYR_BASE}/tests/bsim/bluetooth/host/compile.sh
2120
${ZEPHYR_BASE}/tests/bsim/bluetooth/ll/compile.sh
2221
${ZEPHYR_BASE}/tests/bsim/bluetooth/mesh/compile.sh
2322
${ZEPHYR_BASE}/tests/bsim/bluetooth/samples/compile.sh

tests/bsim/bluetooth/host/compile.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/bsim/bluetooth/tests.nrf5340bsim_nrf5340_cpunet.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,3 @@
22
# built in the net core)
33
# This file is used in CI to select which tests are run
44
tests/bsim/bluetooth/ll/
5-
tests/bsim/bluetooth/host/att/eatt_notif
6-
tests/bsim/bluetooth/host/misc/disable
7-
tests/bsim/bluetooth/host/misc/unregister_conn_cb
8-
tests/bsim/bluetooth/host/adv/periodic
9-
tests/bsim/bluetooth/host/adv/extended
10-
tests/bsim/bluetooth/host/adv/chain
11-
tests/bsim/bluetooth/host/l2cap/send_on_connect
12-
tests/bsim/bluetooth/host/central
13-
tests/bsim/bluetooth/host/privacy/central
14-
tests/bsim/bluetooth/host/gatt/authorization
15-
tests/bsim/bluetooth/host/gatt/general
16-
tests/bsim/bluetooth/host/gatt/caching

tests/bsim/ci.bt.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ RESULTS_FILE=${ZEPHYR_BASE}/bsim_out/bsim_results.bt.52.xml \
1919
TESTS_FILE=tests/bsim/bluetooth/tests.nrf52bsim.txt \
2020
tests/bsim/run_parallel.sh
2121

22+
west twister -T ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/ -p nrf52_bsim/native
23+
2224
# nrf5340bsim/nrf5340/cpunet set:
2325
nice tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpunet.sh
2426

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

32+
west twister -T ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/ -p nrf5340bsim/nrf5340/cpunet
33+
3034
# nrf5340 split stack set:
3135
nice tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh
3236

0 commit comments

Comments
 (0)