fix(test): testAsyncAbortAndReissue ensure stale reply is cleared
Build all targets / Scan for Board Targets (push) Has been cancelled
Build all targets / Seed [${{ matrix.chip_family }}] (push) Has been cancelled
Build all targets / Build [${{ matrix.runner }}][${{ matrix.group }}] (push) Has been cancelled
Build all targets / Upload Artifacts (push) Has been cancelled
Checks / Gate Checks [check_format] (push) Has been cancelled
Checks / Gate Checks [check_newlines] (push) Has been cancelled
Checks / Gate Checks [module_documentation] (push) Has been cancelled
Checks / Gate Checks [shellcheck_all] (push) Has been cancelled
Checks / Gate Checks [validate_module_configs] (push) Has been cancelled
Checks / Unit Tests (push) Has been cancelled
MacOS build / build (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:22.04) (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:24.04) (push) Has been cancelled
Container build / Set Tags and Variables (push) Has been cancelled
Container build / Build Container (amd64) (push) Has been cancelled
Container build / Build Container (arm64) (push) Has been cancelled
Container build / Deploy To Registry (push) Has been cancelled
Docs - Orchestrator / T1: Detect Changes (push) Has been cancelled
Docs - Orchestrator / T2: PR Metadata (push) Has been cancelled
Docs - Orchestrator / T2: Metadata Sync (push) Has been cancelled
Docs - Orchestrator / T2: Link Check (push) Has been cancelled
Docs - Orchestrator / T3: Build Site (push) Has been cancelled
Docs - Orchestrator / T4: Deploy (push) Has been cancelled
Failsafe Simulator Build / build (failsafe_web) (push) Has been cancelled
ITCM check / Checking nxp_mr-tropic (push) Has been cancelled
ITCM check / Checking nxp_tropic-community (push) Has been cancelled
ITCM check / Checking px4_fmu-v5x (push) Has been cancelled
ITCM check / Checking px4_fmu-v6xrt (push) Has been cancelled
ROS Integration Tests / build (push) Has been cancelled
ROS Translation Node Tests / Build and test [humble] (push) Has been cancelled
ROS Translation Node Tests / Build and test [jazzy] (push) Has been cancelled
SITL Tests / Testing PX4 iris (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v5x (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v6x (push) Has been cancelled
Python CI Checks / build (push) Has been cancelled
FLASH usage analysis / Publish Results (push) Has been cancelled
Static Analysis / Clang-Tidy (push) Has been cancelled

This commit is contained in:
jonas
2026-06-16 07:56:40 +02:00
committed by Beat Küng
parent 5fd7fed8d8
commit 13e74de617
+18 -10
View File
@@ -778,14 +778,22 @@ DatamanTest::testAsyncAbortAndReissue()
// and still return current data.
const dm_item_t item = DM_KEY_WAYPOINTS_OFFBOARD_0;
const uint32_t length = g_per_item_size[item];
const uint32_t index = 7;
const uint8_t value = 0xC3;
const uint32_t stale_index = 7;
const uint8_t stale_value = 0xC3;
const uint32_t new_index = 8;
const uint8_t new_value = 0xAA;
// Store a known value.
memset(_buffer_write, value, sizeof(_buffer_write));
memset(_buffer_write, stale_value, sizeof(_buffer_write));
if (!_dataman_client1.writeSync(item, index, _buffer_write, length)) {
PX4_ERR("seed writeSync failed");
if (!_dataman_client1.writeSync(item, stale_index, _buffer_write, length)) {
PX4_ERR("stale seed writeSync failed");
return false;
}
memset(_buffer_write, new_value, sizeof(_buffer_write));
if (!_dataman_client1.writeSync(item, new_index, _buffer_write, length)) {
PX4_ERR("new seed writeSync failed");
return false;
}
@@ -793,7 +801,7 @@ DatamanTest::testAsyncAbortAndReissue()
// this leaves a reply queued on the response topic.
uint8_t scratch[DM_MAX_DATA_SIZE] = {};
if (!_dataman_client1.readAsync(item, index, scratch, length)) {
if (!_dataman_client1.readAsync(item, stale_index, scratch, length)) {
PX4_ERR("first readAsync failed");
return false;
}
@@ -804,10 +812,10 @@ DatamanTest::testAsyncAbortAndReissue()
// Abandon the operation. The queued reply is now stale.
_dataman_client1.abortCurrentOperation();
// A fresh async read must drain the stale reply and return the current value.
// A fresh async read must drain the stale reply and return the new request's value.
memset(_buffer_read, 0, sizeof(_buffer_read));
if (!_dataman_client1.readAsync(item, index, _buffer_read, length)) {
if (!_dataman_client1.readAsync(item, new_index, _buffer_read, length)) {
PX4_ERR("second readAsync failed");
return false;
}
@@ -837,7 +845,7 @@ DatamanTest::testAsyncAbortAndReissue()
}
for (uint32_t i = 0; i < length; ++i) {
if (_buffer_read[i] != value) {
if (_buffer_read[i] != new_value) {
PX4_ERR("reissued read returned wrong data at %" PRIu32, i);
return false;
}