forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Bluetooth: add pipelined ATT write test
This verifies the zephyr host can tolerate a spec violating peer sending ATT requests without waiting for responses. It also tests the opposite, that is that the Zephyr host does not pipeline requests over the air. Signed-off-by: Jonathan Rico <[email protected]> Co-authored-by: Aleksander Wasaznik <[email protected]>
- Loading branch information
1 parent
1f19cc7
commit b68987f
Showing
10 changed files
with
1,409 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (c) 2023 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "bs_tracing.h" | ||
#include "bs_types.h" | ||
#include "bstests.h" | ||
|
||
#define BS_SECONDS(dur_sec) ((bs_time_t)dur_sec * USEC_PER_SEC) | ||
|
||
extern enum bst_result_t bst_result; | ||
|
||
#define DECLARE_FLAG(flag) extern atomic_t flag | ||
#define DEFINE_FLAG(flag) atomic_t flag = (atomic_t) false | ||
#define TEST_FLAG(flag) (bool)atomic_get(&flag) | ||
#define SET_FLAG(flag) (void)atomic_set(&flag, (atomic_t) true) | ||
#define UNSET_FLAG(flag) (void)atomic_set(&flag, (atomic_t) false) | ||
|
||
#define WAIT_FOR_VAL(var, val) \ | ||
while (atomic_get(&var) != val) { \ | ||
(void)k_sleep(K_MSEC(1)); \ | ||
} | ||
#define WAIT_FOR_FLAG(flag) \ | ||
while (!(bool)atomic_get(&flag)) { \ | ||
(void)k_sleep(K_MSEC(1)); \ | ||
} | ||
#define WAIT_FOR_FLAG_UNSET(flag) \ | ||
while ((bool)atomic_get(&flag)) { \ | ||
(void)k_sleep(K_MSEC(1)); \ | ||
} | ||
#define TAKE_FLAG(flag) \ | ||
while (!(bool)atomic_cas(&flag, true, false)) { \ | ||
(void)k_sleep(K_MSEC(1)); \ | ||
} | ||
|
||
#define ASSERT(expr, ...) \ | ||
do { \ | ||
if (!(expr)) { \ | ||
FAIL(__VA_ARGS__); \ | ||
} \ | ||
} while (0) | ||
|
||
#define FAIL(...) \ | ||
do { \ | ||
bst_result = Failed; \ | ||
bs_trace_error_time_line(__VA_ARGS__); \ | ||
} while (0) | ||
|
||
#define PASS(...) \ | ||
do { \ | ||
bst_result = Passed; \ | ||
bs_trace_info_time(1, __VA_ARGS__); \ | ||
} while (0) | ||
|
||
#define TEST_TIMEOUT_SIMULATED BS_SECONDS(100) | ||
#define HVX_HANDLE 0x0012 | ||
#define DUT_DEVICE_NBR 0 | ||
|
||
/* Run for more than ATT_TIMEOUT */ | ||
#define PROCEDURE_1_TIMEOUT_MS (1000 * 70) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(bsim_test_pipeline_dut) | ||
|
||
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/common/testlib testlib) | ||
|
||
target_sources(app PRIVATE | ||
src/main.c | ||
) | ||
|
||
zephyr_include_directories( | ||
../common/ | ||
${BSIM_COMPONENTS_PATH}/libUtilv1/src/ | ||
${BSIM_COMPONENTS_PATH}/libPhyComv1/src/ | ||
) | ||
|
||
target_link_libraries(app PRIVATE testlib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
CONFIG_LOG=y | ||
CONFIG_ASSERT=y | ||
|
||
CONFIG_BT=y | ||
CONFIG_BT_CENTRAL=y | ||
CONFIG_BT_PERIPHERAL=y | ||
CONFIG_BT_MAX_CONN=3 | ||
|
||
CONFIG_BT_DEVICE_NAME="Sequential" | ||
|
||
CONFIG_BT_GATT_CLIENT=y | ||
CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION=n | ||
|
||
# Enable bt_testing_tx_tid_get() | ||
CONFIG_BT_TESTING=y | ||
|
||
# Replace `Execute` with `gdb --args` in the shell script | ||
# and get a nice backtrace on assert | ||
CONFIG_ARCH_POSIX_TRAP_ON_FATAL=y | ||
|
||
# Prepend logs with thread names | ||
CONFIG_THREAD_NAME=y | ||
CONFIG_LOG_THREAD_ID_PREFIX=y | ||
|
||
# Enable those as needed | ||
# CONFIG_BT_L2CAP_LOG_LEVEL_DBG=y | ||
# CONFIG_BT_ATT_LOG_LEVEL_DBG=y | ||
# CONFIG_BT_GATT_LOG_LEVEL_DBG=y | ||
|
||
# Allow whole L2CAP PDUs to fit on-air | ||
CONFIG_BT_BUF_ACL_TX_SIZE=251 | ||
CONFIG_BT_BUF_ACL_RX_SIZE=251 | ||
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 | ||
CONFIG_BT_DATA_LEN_UPDATE=y | ||
CONFIG_BT_USER_DATA_LEN_UPDATE=y | ||
|
||
# Disable auto-initiated procedures so they don't | ||
# mess with the test's execution. | ||
CONFIG_BT_AUTO_PHY_UPDATE=n | ||
CONFIG_BT_AUTO_DATA_LEN_UPDATE=n | ||
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n | ||
|
||
# Needed by `testlib` | ||
CONFIG_BT_SMP=y |
Oops, something went wrong.