1#!/usr/bin/env bash
2# Copyright 2023 Nordic Semiconductor ASA
3# SPDX-License-Identifier: Apache-2.0
4
5# Simple selfchecking test for the unicast client/server samples,
6# It relies on the bs_tests hooks to register a test timer callback, which after a deadline
7# will check how many audio packets the unicast client has received, and if over a threshold
8# it considers the test passed
9
10simulation_id="unicast_samples_test"
11verbosity_level=2
12
13source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
14
15EXECUTE_TIMEOUT=100
16
17cd ${BSIM_OUT_PATH}/bin
18
19Execute ./bs_${BOARD_TS}_samples_bluetooth_bap_unicast_server_prj_conf \
20  -v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=1 \
21  -start_offset=2e3
22
23Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_samples_bap_unicast_client_prj_conf \
24  -v=${verbosity_level} -s=${simulation_id} -d=1 -RealEncryption=1 \
25  -testid=unicast_client
26
27Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
28  -D=2 -sim_length=21e6 $@ -argschannel -at=40
29
30wait_for_background_jobs #Wait for all programs in background and return != 0 if any fails
31