From 96c6dacdc03c21fe4fae05d09ddf1393f00568d8 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Fri, 4 Sep 2026 15:37:10 -0700 Subject: [PATCH] [test] check return value of `Error`-returning calls in `test_tcat` (#13581) This commit wraps several calls to `Mle::Disable()`, `HandleStartThreadInterface()`, and `HandleStopThreadInterface()` in `tests/unit/test_tcat.cpp` with `SuccessOrQuit()` to fix unused-result compiler warnings and validate test execution. --- tests/unit/test_tcat.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/unit/test_tcat.cpp b/tests/unit/test_tcat.cpp index bd9b9990d..69f1abc80 100644 --- a/tests/unit/test_tcat.cpp +++ b/tests/unit/test_tcat.cpp @@ -604,7 +604,7 @@ private: // It models the behavior of `HandleSetActiveOperationalDataset()`, without checking authorization. static void MockWriteActiveDataset(Instance *aInstance, const Dataset::Info &aDataset) { - aInstance->Get().Disable(); + SuccessOrQuit(aInstance->Get().Disable()); aInstance->Get().SaveLocal(aDataset); aInstance->Get().mIsSourceOfDatasetChange = true; otTaskletsProcess(aInstance); @@ -621,7 +621,7 @@ private: // Mock operation: an entity other than a TCAT Commissioner clears the active dataset. static void MockActiveDatasetCleared(Instance *aInstance) { - aInstance->Get().Disable(); + SuccessOrQuit(aInstance->Get().Disable()); aInstance->Get().Clear(); otTaskletsProcess(aInstance); } @@ -1170,21 +1170,21 @@ public: { // Once the device is attached to a Thread network, the TCAT Commissioner can no longer overwrite the // Active Dataset (this prevents a dataset from propagating to other already-networked devices). - agent->HandleStartThreadInterface(); + SuccessOrQuit(agent->HandleStartThreadInterface()); MockDeviceAttachedToNetwork(instance); VerifyOrQuit(!IsSetActiveDatasetSuccessful(agent, sFullDataset)); VerifyOrQuit(!IsSetActiveDatasetSuccessful(agent, sPartialDataset)); // When the device has detached from Thread, the TCAT Commissioner can overwrite the Active Dataset // even without a Decommission command, because it's still in the same TCAT session. - agent->HandleStopThreadInterface(); + SuccessOrQuit(agent->HandleStopThreadInterface()); MockDeviceDetachedFromNetwork(instance); VerifyOrQuit(IsSetActiveDatasetSuccessful(agent, sFullDataset)); VerifyOrQuit(IsSetActiveDatasetSuccessful(agent, sPartialDataset)); } // Attach to Thread Network again to prepare for the next test. - agent->HandleStartThreadInterface(); + SuccessOrQuit(agent->HandleStartThreadInterface()); MockDeviceAttachedToNetwork(instance); // Another module/process changes the Active Dataset content significantly (here: a different Network Key). @@ -1198,13 +1198,13 @@ public: } // Thread is stopped - agent->HandleStopThreadInterface(); + SuccessOrQuit(agent->HandleStopThreadInterface()); MockDeviceDetachedFromNetwork(instance); VerifyOrQuit(!IsSetActiveDatasetSuccessful(agent, sFullDataset)); VerifyOrQuit(!IsSetActiveDatasetSuccessful(agent, sPartialDataset)); // Attach to Thread Network again - agent->HandleStartThreadInterface(); + SuccessOrQuit(agent->HandleStartThreadInterface()); MockDeviceAttachedToNetwork(instance); VerifyOrQuit(!IsSetActiveDatasetSuccessful(agent, sFullDataset)); VerifyOrQuit(!IsSetActiveDatasetSuccessful(agent, sPartialDataset));