Bluetooth: Host: Add test for issue #42306
Checks that only CONFIG_BT_EATT_MAX EATT bearers get connected.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
diff --git a/tests/bluetooth/bsim_bt/bsim_test_eatt/prj_multiple_conn.conf b/tests/bluetooth/bsim_bt/bsim_test_eatt/prj_multiple_conn.conf
new file mode 100644
index 0000000..e157d2c
--- /dev/null
+++ b/tests/bluetooth/bsim_bt/bsim_test_eatt/prj_multiple_conn.conf
@@ -0,0 +1,14 @@
+CONFIG_BT=y
+CONFIG_BT_CENTRAL=y
+CONFIG_BT_PERIPHERAL=y
+CONFIG_BT_SMP=y
+CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
+CONFIG_BT_DEVICE_NAME="EATT test"
+CONFIG_BT_EATT=y
+CONFIG_BT_L2CAP_ECRED=y
+CONFIG_BT_EATT_MAX=5
+CONFIG_BT_MAX_CONN=2
+
+CONFIG_BT_TESTING=y
+CONFIG_BT_DEBUG_LOG=y
+CONFIG_ASSERT=y
diff --git a/tests/bluetooth/bsim_bt/bsim_test_eatt/tests_scripts/multiple_conn.sh b/tests/bluetooth/bsim_bt/bsim_test_eatt/tests_scripts/multiple_conn.sh
new file mode 100755
index 0000000..7c385c6
--- /dev/null
+++ b/tests/bluetooth/bsim_bt/bsim_test_eatt/tests_scripts/multiple_conn.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+# Copyright (c) 2022 Nordic Semiconductor
+# SPDX-License-Identifier: Apache-2.0
+
+simulation_id="multiple_conn"
+verbosity_level=2
+process_ids=""; exit_code=0
+
+function Execute(){
+ if [ ! -f $1 ]; then
+ echo -e " \e[91m`pwd`/`basename $1` cannot be found (did you forget to\
+ compile it?)\e[39m"
+ exit 1
+ fi
+ timeout 120 $@ & process_ids="$process_ids $!"
+}
+
+: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"
+
+#Give a default value to BOARD if it does not have one yet:
+BOARD="${BOARD:-nrf52_bsim}"
+
+cd ${BSIM_OUT_PATH}/bin
+
+Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_eatt_prj_multiple_conn_conf \
+ -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central
+
+Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_eatt_prj_multiple_conn_conf \
+ -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral
+
+Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
+ -D=2 -sim_length=200e6 $@
+
+for process_id in $process_ids; do
+ wait $process_id || let "exit_code=$?"
+done
+exit $exit_code #the last exit code != 0
diff --git a/tests/bluetooth/bsim_bt/compile.sh b/tests/bluetooth/bsim_bt/compile.sh
index f6443dd..1ab58a4 100755
--- a/tests/bluetooth/bsim_bt/compile.sh
+++ b/tests/bluetooth/bsim_bt/compile.sh
@@ -22,6 +22,7 @@
app=tests/bluetooth/bsim_bt/bsim_test_eatt conf_file=prj_encryption.conf compile
app=tests/bluetooth/bsim_bt/bsim_test_eatt conf_file=prj_collision.conf compile
+app=tests/bluetooth/bsim_bt/bsim_test_eatt conf_file=prj_multiple_conn.conf compile
app=tests/bluetooth/bsim_bt/bsim_test_app conf_file=prj_split.conf \
compile
app=tests/bluetooth/bsim_bt/bsim_test_app conf_file=prj_split_privacy.conf \