circuitpython/tests/multi_bluetooth
Damien George c6423d5d8e tests/multi_bluetooth: Synchronise MTU exchange in BLE MTU tests.
With the recent update to ESP-IDF 5.4.2, there is a change in BLE event
behaviour which makes `tests/multi_bluetooth/ble_mtu.py` and
`tests/multi_bluetooth/ble_mtu_peripheral.py` now fail on ESP32 with IDF
5.4.2.

The change in behaviour is that MTU_EXCHANGE events can now occur before
CENTRAL_CONNECT/PERIPHERAL_CONNECT events.  That seems a bit strange,
because the MTU exchange occurs after the connection.  And looking at the
timing of the events there is exactly 100ms between them, ie MTU_EXCHANGE
fires and then exactly 100ms later CENTRAL_CONNECT/PERIPHERAL_CONNECT
fires.

It's unknown if this is a bug in (Espressif's) NimBLE, a subtle change in
scheduling with still valid behaviour, an intended change, a change allowed
under the BLE spec, or something else.

But in order to move forward with updating to IDF 5.4.2, the relevant tests
have been adjusted so they can pass.  The test just needs to wait a bit
between doing the connect and doing the MTU exchange, so the other side
sees the original/correct ordering of events.  This wait is done using the
multitest synchronisation primitives (broadcast and wait).

Signed-off-by: Damien George <damien@micropython.org>
2025-07-23 12:53:28 +10:00
..
ble_characteristic.py tests/multi_bluetooth: Use multitest.broadcast instead of sleep. 2023-04-26 11:37:20 +10:00
ble_characteristic.py.exp tests/multi_bluetooth/ble_characteristic.py: Add write-no-response. 2023-04-26 11:37:20 +10:00
ble_descriptor.py tests/multi_bluetooth: Add test for descriptors. 2023-04-26 11:37:20 +10:00
ble_descriptor.py.exp tests/multi_bluetooth: Add test for descriptors. 2023-04-26 11:37:20 +10:00
ble_gap_advertise.py tests/multi_bluetooth: Use time.sleep_ms instead of time.sleep. 2023-04-26 11:37:20 +10:00
ble_gap_advertise.py.exp extmod/modbluetooth: Change scan result's "connectable" to "adv_type". 2020-03-11 14:00:44 +11:00
ble_gap_connect.py tests/multi_bluetooth: Change dict index-and-del to pop, to clear event. 2020-11-16 17:03:27 +11:00
ble_gap_connect.py.exp tests/multi_bluetooth: Make ble_gap_connect robust against event timing. 2020-09-08 23:53:12 +10:00
ble_gap_device_name.py tests/multi_bluetooth: Use multitest.broadcast instead of sleep. 2023-04-26 11:37:20 +10:00
ble_gap_device_name.py.exp tests/multi_bluetooth: Improve reliability of event waiting. 2020-11-13 17:19:05 +11:00
ble_gap_pair.py tests/multi_bluetooth: Skip tests when BLE features are unsupported. 2021-03-12 20:08:20 +11:00
ble_gap_pair.py.exp tests/multi_bluetooth: Add multitests for BLE pairing and bonding. 2020-12-02 14:44:55 +11:00
ble_gap_pair_bond.py tests/multi_bluetooth: Skip tests when BLE features are unsupported. 2021-03-12 20:08:20 +11:00
ble_gap_pair_bond.py.exp tests/multi_bluetooth: Add multitests for BLE pairing and bonding. 2020-12-02 14:44:55 +11:00
ble_gatt_data_transfer.py tests/multi_bluetooth: Change dict index-and-del to pop, to clear event. 2020-11-16 17:03:27 +11:00
ble_gatt_data_transfer.py.exp tests/multi_bluetooth: Update UUID format in .exp files. 2020-09-18 12:51:21 +10:00
ble_gattc_discover_services.py tests/multi_bluetooth: Change dict index-and-del to pop, to clear event. 2020-11-16 17:03:27 +11:00
ble_gattc_discover_services.py.exp tests/multi_bluetooth: Improve reliability of event waiting. 2020-11-13 17:19:05 +11:00
ble_irq_calls.py tests/multi_bluetooth/ble_irq_calls.py: Enhance test to test recursion. 2024-02-16 10:20:28 +11:00
ble_irq_calls.py.exp tests/multi_bluetooth/ble_irq_calls.py: Enhance test to test recursion. 2024-02-16 10:20:28 +11:00
ble_l2cap.py tests/multi_bluetooth: Skip tests when BLE features are unsupported. 2021-03-12 20:08:20 +11:00
ble_l2cap.py.exp tests/multi_bluetooth: Add L2CAP channels multi-test. 2020-11-24 01:07:17 +11:00
ble_mtu.py tests/multi_bluetooth: Synchronise MTU exchange in BLE MTU tests. 2025-07-23 12:53:28 +10:00
ble_mtu.py.exp tests/multi_bluetooth/ble_mtu: Split peripheral/central-initiated. 2023-04-26 11:37:20 +10:00
ble_mtu_peripheral.py tests/multi_bluetooth: Synchronise MTU exchange in BLE MTU tests. 2025-07-23 12:53:28 +10:00
ble_mtu_peripheral.py.exp tests/multi_bluetooth/ble_mtu: Split peripheral/central-initiated. 2023-04-26 11:37:20 +10:00
ble_subscribe.py tests/multi_bluetooth/ble_subscribe: Use end_handle in desc discovery. 2023-04-26 11:37:20 +10:00
ble_subscribe.py.exp tests/multi_bluetooth/ble_subscribe.py: Add test for subscription. 2021-08-14 22:44:47 +10:00
perf_gatt_char_write.py tests/multi_bluetooth: Use multitest.output_metric in BLE perf tests. 2023-03-23 13:18:52 +11:00
perf_gatt_char_write.py.exp tests/multi_bluetooth: Add performance test for gatt char writes. 2021-04-30 16:14:48 +10:00
perf_gatt_notify.py tests/multi_bluetooth/perf_gatt_notify.py: Reduce connection interval. 2024-07-19 22:28:31 +10:00
perf_gatt_notify.py.exp tests/multi_bluetooth: Use multitest.output_metric in BLE perf tests. 2023-03-23 13:18:52 +11:00
perf_l2cap.py tests/multi_bluetooth: Use multitest.output_metric in BLE perf tests. 2023-03-23 13:18:52 +11:00
perf_l2cap.py.exp tests/multi_bluetooth: Use multitest.output_metric in BLE perf tests. 2023-03-23 13:18:52 +11:00
stress_deepsleep_reconnect.py tests/multi_bluetooth: Move ble_deepsleep to stress_deepsleep_reconnect. 2024-02-29 14:16:05 +11:00
stress_deepsleep_reconnect.py.exp tests/multi_bluetooth: Move ble_deepsleep to stress_deepsleep_reconnect. 2024-02-29 14:16:05 +11:00
stress_log_filesystem.py tests/multi_bluetooth: Add a test for WB55 concurrent flash access. 2020-11-16 17:04:02 +11:00
stress_log_filesystem.py.exp tests/multi_bluetooth: Add a test for WB55 concurrent flash access. 2020-11-16 17:04:02 +11:00