1#!/usr/bin/env bash
2# Copyright 2023 Nordic Semiconductor ASA
3# SPDX-License-Identifier: Apache-2.0
4
5source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
6
7test_name='ccc_update'
8test_exe="bs_${BOARD_TS}_tests_bsim_bluetooth_host_security_${test_name}_prj_conf"
9simulation_id="${test_name}"
10verbosity_level=2
11
12cd ${BSIM_OUT_PATH}/bin
13
14if [ "${1}" != 'debug0' ]; then
15  Execute "./${test_exe}" \
16    -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central \
17    -flash="${simulation_id}_client.log.bin" -flash_rm -RealEncryption=1
18fi
19
20if [ "${1}" != 'debug1' ]; then
21  Execute "./${test_exe}" \
22    -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=bad_central \
23    -flash="${simulation_id}_bad_client.log.bin" -flash_rm -RealEncryption=1
24fi
25
26if [ "${1}" != 'debug2' ]; then
27  Execute "./${test_exe}" \
28    -v=${verbosity_level} -s=${simulation_id} -d=2 -testid=peripheral \
29    -flash="${simulation_id}_server.log.bin" -flash_rm -RealEncryption=1
30fi
31
32Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
33  -D=3 -sim_length=60e6
34
35if [ "${1}" == 'debug0' ]; then
36  gdb --args "./${test_exe}" \
37    -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central \
38    -flash="${simulation_id}_client.log.bin" -flash_rm -RealEncryption=1
39fi
40
41if [ "${1}" == 'debug1' ]; then
42  gdb --args "./${test_exe}" \
43    -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=bad_central \
44    -flash="${simulation_id}_bad_client.log.bin" -flash_rm -RealEncryption=1
45fi
46
47if [ "${1}" == 'debug2' ]; then
48  gdb --args "./${test_exe}" \
49    -v=${verbosity_level} -s=${simulation_id} -d=2 -testid=peripheral \
50    -flash="${simulation_id}_server.log.bin" -flash_rm -RealEncryption=1
51fi
52
53wait_for_background_jobs
54