From fe9ffdadedbc9006841993a721a10df946536d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Thu, 19 Oct 2023 09:57:18 +0200 Subject: [PATCH] tests: Bluetooth: Mesh: Op_agg coex loopback test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds coexistence Bsim test for Opcode Aggregator models using loopback. The test verifies that the Opcode Aggregator server and client can send messages to each other on the loopback interface. Signed-off-by: Anders Storrø --- tests/bsim/bluetooth/mesh/prj_mesh1d1.conf | 1 + tests/bsim/bluetooth/mesh/src/test_op_agg.c | 18 +++++++++++++++ .../mesh/tests_scripts/op_agg/loopback.sh | 22 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh diff --git a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf index 8bfb3b9e887358..ab6066e01bf48d 100644 --- a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf +++ b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf @@ -25,6 +25,7 @@ CONFIG_BT_MESH_TX_SEG_MAX=32 CONFIG_BT_MESH_RX_SEG_MAX=32 CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 CONFIG_BT_MESH_RX_SEG_MSG_COUNT=10 +CONFIG_BT_MESH_SEG_BUFS=100 CONFIG_BT_MESH_CFG_CLI=y CONFIG_BT_MESH_MODEL_GROUP_COUNT=3 CONFIG_BT_MESH_LOW_POWER=y diff --git a/tests/bsim/bluetooth/mesh/src/test_op_agg.c b/tests/bsim/bluetooth/mesh/src/test_op_agg.c index 85bc1a6ba26013..d8bb50b3fd39b0 100644 --- a/tests/bsim/bluetooth/mesh/src/test_op_agg.c +++ b/tests/bsim/bluetooth/mesh/src/test_op_agg.c @@ -257,6 +257,23 @@ static void test_dut_model_coex(void) PASS(); } +static void test_dut_model_coex_loopback(void) +{ + /* Start an aggregated sequence */ + common_init(SRV_ADDR, SRV_ADDR, true); + + /* Send aggregated sequence to server model over loopback */ + ASSERT_OK(bt_mesh_op_agg_cli_seq_send()); + + /* Confirm incoming sequence messages */ + confirm_agg_seq(); + + /* Confirm status messages for sequence */ + confirm_agg_status(); + + PASS(); +} + #define TEST_CASE(role, name, description) \ { \ .test_id = "op_agg_" #role "_" #name, \ @@ -273,6 +290,7 @@ static const struct bst_test_instance test_op_agg[] = { TEST_CASE(srv, max_len_status_msg_send, "OpAggSrv will respond with a 380 Byte status message. "), TEST_CASE(dut, model_coex, "DUT: Coexistence of OpAggSrv and OpAggCli."), + TEST_CASE(dut, model_coex_loopback, "DUT: Coexistence for OpAggSrv and OpAggCli loopback."), BSTEST_END_MARKER}; diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh new file mode 100755 index 00000000000000..3a4720bdaf4dd8 --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +# Test that an Opcode aggregated message can be sent and received on loopback. +# +# Test procedure: +# 1. The device initializes both Opcode aggregator server and client. +# The device starts an Opcode aggregator sequence and populates the buffer. +# 2. The device starts sending the sequence on loopback. +# 3. The device verifies that the sequence is correctly received by the server model. +# 4. The device confirms that the client model received all status messages. +conf=prj_mesh1d1_conf +RunTest mesh_op_agg_model_coex_loopback \ + op_agg_dut_model_coex_loopback + +conf=prj_mesh1d1_conf +overlay=overlay_psa_conf +RunTest mesh_op_agg_model_coex_loopback \ + op_agg_dut_model_coex_loopback