tests: Bluetooth: Mesh: Test SAR with slowest possible timings
Add test that sends longest possible PDU with slowest possible timings and default retransmission values. Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
This commit is contained in:
parent
37386552d5
commit
e2086c22bc
2 changed files with 79 additions and 7 deletions
|
@ -56,6 +56,23 @@ static struct bt_mesh_sar_rx test_sar_rx = {
|
||||||
.ack_retrans_count = 3,
|
.ack_retrans_count = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct bt_mesh_sar_tx test_sar_slow_tx = {
|
||||||
|
.seg_int_step = 15,
|
||||||
|
.unicast_retrans_count = CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_COUNT,
|
||||||
|
.unicast_retrans_without_prog_count =
|
||||||
|
CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_WITHOUT_PROG_COUNT,
|
||||||
|
.unicast_retrans_int_step = 15,
|
||||||
|
.unicast_retrans_int_inc = 15,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct bt_mesh_sar_rx test_sar_slow_rx = {
|
||||||
|
.seg_thresh = 0x1f,
|
||||||
|
.ack_delay_inc = 7,
|
||||||
|
.discard_timeout = CONFIG_BT_MESH_SAR_RX_DISCARD_TIMEOUT,
|
||||||
|
.rx_seg_int_step = 15,
|
||||||
|
.ack_retrans_count = CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
static struct bt_mesh_prov prov;
|
static struct bt_mesh_prov prov;
|
||||||
static struct bt_mesh_cfg_cli cfg_cli;
|
static struct bt_mesh_cfg_cli cfg_cli;
|
||||||
static struct bt_mesh_sar_cfg_cli sar_cli;
|
static struct bt_mesh_sar_cfg_cli sar_cli;
|
||||||
|
@ -139,7 +156,9 @@ static const struct bt_mesh_comp comp = {
|
||||||
.elem_count = ARRAY_SIZE(elements),
|
.elem_count = ARRAY_SIZE(elements),
|
||||||
};
|
};
|
||||||
|
|
||||||
static void prov_and_conf(uint16_t addr)
|
static void prov_and_conf(uint16_t addr,
|
||||||
|
struct bt_mesh_sar_rx *sar_rx_config,
|
||||||
|
struct bt_mesh_sar_tx *sar_tx_config)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
|
@ -160,8 +179,8 @@ static void prov_and_conf(uint16_t addr)
|
||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(bt_mesh_sar_cfg_cli_transmitter_set(0, addr, &test_sar_tx, &tx_rsp));
|
ASSERT_OK(bt_mesh_sar_cfg_cli_transmitter_set(0, addr, sar_tx_config, &tx_rsp));
|
||||||
ASSERT_OK(bt_mesh_sar_cfg_cli_receiver_set(0, addr, &test_sar_rx, &rx_rsp));
|
ASSERT_OK(bt_mesh_sar_cfg_cli_receiver_set(0, addr, sar_rx_config, &rx_rsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void array_random_fill(uint8_t array[], uint16_t len, int seed)
|
static void array_random_fill(uint8_t array[], uint16_t len, int seed)
|
||||||
|
@ -173,11 +192,12 @@ static void array_random_fill(uint8_t array[], uint16_t len, int seed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_cli_max_len_sdu_send(void)
|
static void cli_max_len_sdu_send(struct bt_mesh_sar_rx *sar_rx_config,
|
||||||
|
struct bt_mesh_sar_tx *sar_tx_config)
|
||||||
{
|
{
|
||||||
bt_mesh_test_cfg_set(NULL, WAIT_TIME);
|
bt_mesh_test_cfg_set(NULL, WAIT_TIME);
|
||||||
bt_mesh_device_setup(&prov, &comp);
|
bt_mesh_device_setup(&prov, &comp);
|
||||||
prov_and_conf(CLI_ADDR);
|
prov_and_conf(CLI_ADDR, sar_rx_config, sar_tx_config);
|
||||||
|
|
||||||
ASSERT_OK(k_sem_init(&inst_suspend_sem, 0, 1));
|
ASSERT_OK(k_sem_init(&inst_suspend_sem, 0, 1));
|
||||||
array_random_fill(dummy_msg, ARRAY_SIZE(dummy_msg), RAND_SEED);
|
array_random_fill(dummy_msg, ARRAY_SIZE(dummy_msg), RAND_SEED);
|
||||||
|
@ -194,11 +214,12 @@ static void test_cli_max_len_sdu_send(void)
|
||||||
PASS();
|
PASS();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_srv_max_len_sdu_receive(void)
|
static void srv_max_len_sdu_receive(struct bt_mesh_sar_rx *sar_rx_config,
|
||||||
|
struct bt_mesh_sar_tx *sar_tx_config)
|
||||||
{
|
{
|
||||||
bt_mesh_test_cfg_set(NULL, WAIT_TIME);
|
bt_mesh_test_cfg_set(NULL, WAIT_TIME);
|
||||||
bt_mesh_device_setup(&prov, &comp);
|
bt_mesh_device_setup(&prov, &comp);
|
||||||
prov_and_conf(SRV_ADDR);
|
prov_and_conf(SRV_ADDR, sar_rx_config, sar_tx_config);
|
||||||
|
|
||||||
ASSERT_OK(k_sem_init(&inst_suspend_sem, 0, 1));
|
ASSERT_OK(k_sem_init(&inst_suspend_sem, 0, 1));
|
||||||
array_random_fill(dummy_msg, ARRAY_SIZE(dummy_msg), RAND_SEED);
|
array_random_fill(dummy_msg, ARRAY_SIZE(dummy_msg), RAND_SEED);
|
||||||
|
@ -211,6 +232,34 @@ static void test_srv_max_len_sdu_receive(void)
|
||||||
PASS();
|
PASS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_cli_max_len_sdu_send(void)
|
||||||
|
{
|
||||||
|
cli_max_len_sdu_send(&test_sar_rx, &test_sar_tx);
|
||||||
|
|
||||||
|
PASS();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_srv_max_len_sdu_receive(void)
|
||||||
|
{
|
||||||
|
srv_max_len_sdu_receive(&test_sar_rx, &test_sar_tx);
|
||||||
|
|
||||||
|
PASS();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_cli_max_len_sdu_slow_send(void)
|
||||||
|
{
|
||||||
|
cli_max_len_sdu_send(&test_sar_slow_rx, &test_sar_slow_tx);
|
||||||
|
|
||||||
|
PASS();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_srv_max_len_sdu_slow_receive(void)
|
||||||
|
{
|
||||||
|
srv_max_len_sdu_receive(&test_sar_slow_rx, &test_sar_slow_tx);
|
||||||
|
|
||||||
|
PASS();
|
||||||
|
}
|
||||||
|
|
||||||
#define TEST_CASE(role, name, description) \
|
#define TEST_CASE(role, name, description) \
|
||||||
{ \
|
{ \
|
||||||
.test_id = "sar_" #role "_" #name, \
|
.test_id = "sar_" #role "_" #name, \
|
||||||
|
@ -224,6 +273,10 @@ static const struct bst_test_instance test_sar[] = {
|
||||||
"Send a 32-segment message with pre-defined test SAR configurations"),
|
"Send a 32-segment message with pre-defined test SAR configurations"),
|
||||||
TEST_CASE(srv, max_len_sdu_receive,
|
TEST_CASE(srv, max_len_sdu_receive,
|
||||||
"Receive a 32-segment message with pre-defined test SAR configurations."),
|
"Receive a 32-segment message with pre-defined test SAR configurations."),
|
||||||
|
TEST_CASE(cli, max_len_sdu_slow_send,
|
||||||
|
"Send a 32-segment message with SAR configured with slowest timings."),
|
||||||
|
TEST_CASE(srv, max_len_sdu_slow_receive,
|
||||||
|
"Receive a 32-segment message with with SAR configured with slowest timings."),
|
||||||
|
|
||||||
BSTEST_END_MARKER};
|
BSTEST_END_MARKER};
|
||||||
|
|
||||||
|
|
19
tests/bluetooth/bsim/mesh/tests_scripts/sar/slow_transfer_test.sh
Executable file
19
tests/bluetooth/bsim/mesh/tests_scripts/sar/slow_transfer_test.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2023 Nordic Semiconductor
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh
|
||||||
|
|
||||||
|
# Test that a maximum length SDU can be processed with SAR,
|
||||||
|
# even with transmitter and receiver configured with longest possible
|
||||||
|
# intervals and default retransmission counts.
|
||||||
|
# Test procedure:
|
||||||
|
# 1. Initialize Client and Server instances.
|
||||||
|
# 2. Bind "dummy" vendor model to both instances.
|
||||||
|
# 3. Configure SAR transmitter and receiver states.
|
||||||
|
# 4. The Client sends a Get-message with a maximum length SDU, targeting the server.
|
||||||
|
# 5. The Server responds with a maximum length SDU Status-message.
|
||||||
|
# 6. The test passes when the Client successfully receives the Status response.
|
||||||
|
conf=prj_mesh1d1_conf
|
||||||
|
RunTest sar_slow_test \
|
||||||
|
sar_cli_max_len_sdu_slow_send sar_srv_max_len_sdu_slow_receive
|
Loading…
Add table
Add a link
Reference in a new issue