[nexus] fix intermittent failure in test 5.6.6 (#12573)

This commit fixes an intermittent failure in Nexus test 5.6.6 by ensuring
that the OnMeshPrefixConfig object is properly initialized before use.

The OnMeshPrefixConfig object is declared on the stack and, if not
explicitly cleared, may contain garbage values in its bit-fields (such
as mDhcp or mPreference). This can cause the subsequent call to
AddOnMeshPrefix() to fail its IsValid() check, resulting in a
kErrorInvalidArgs error and a test failure.

Changes:
- Call config.Clear() after declaring the OnMeshPrefixConfig object
  in tests/nexus/test_5_6_6.cpp to ensure all fields are initialized
  to zero.

This aligns the test implementation with other Nexus tests and improves
the robustness of the test suite in simulation environments.

Verified to pass in the Nexus simulation environment.
This commit is contained in:
Jonathan Hui
2026-02-26 14:00:57 -06:00
committed by GitHub
parent a7c051f07a
commit f53b16472f
+1
View File
@@ -159,6 +159,7 @@ void Test5_6_6(void)
{
NetworkData::OnMeshPrefixConfig config;
config.Clear();
SuccessOrQuit(config.GetPrefix().FromString(kPrefix1));
config.mStable = true;
config.mOnMesh = true;