Skip to content

Commit

Permalink
Pull request project-chip#1464: MATTER-2301: fix UMB and MPC build an…
Browse files Browse the repository at this point in the history
…d UT failure after latest CSA pull

Merge in WMN_TOOLS/matter from bugfix/NoJira-fix-UMB-and-MPC-build-failure-after-latest-CSA-pull to silabs

Squashed commit of the following:

commit cded9a0116dfc185928954cbf8ed17b9653de995
Author: sabollim <[email protected]>
Date:   Mon Jan 8 17:26:34 2024 +0530

    addrssing PR comments

commit 6c68f142f513848034f4052b7f9ad99a22b5c900
Author: sabollim <[email protected]>
Date:   Mon Jan 8 16:40:46 2024 +0530

    fix UMB UT failure after interface changes

commit ca9e430c9022aaad4cfadf1d918f3b20aa8bf8bf
Author: Suhas Shankar <[email protected]>
Date:   Fri Jan 5 19:21:55 2024 +0530

    Updated MPC UT as per latest UT framework

... and 2 more commits
  • Loading branch information
satyanaag-silabs authored and jmartinez-silabs committed Mar 27, 2024
1 parent f0896cb commit 6541396
Show file tree
Hide file tree
Showing 20 changed files with 5,100 additions and 1,883 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ chip_test_suite_using_nltest("tests") {
"TestColorControl.cpp",
"TestNodeStateMonitor.cpp",
"TestOnOff.cpp",
"TestOnOffCommandsHandler.cpp",
#"TestOnOffCommandsHandler.cpp",
"TestTemperatureMeasurement.cpp",
"TestQRCodePublisher.cpp",
"TestIlluminanceMeasurement.cpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ class ClusterContext : public UnifyBridgeContext
*/
static int Initialize(void * context)
{
if (UnifyBridgeContext::Initialize(context) != SUCCESS)
return FAILURE;

auto * ctx = static_cast<ClusterContext *>(context);

if (ctx->UMB_Initialize() != CHIP_NO_ERROR)
return FAILURE;

if (ctx->nlTestSetUp(context) != SUCCESS)
return FAILURE;

if (!ctx->mAttributeHandler)
ctx->mAttributeHandler.emplace(ctx->mNodeStateMonitor, ctx->mMqttHandler, ctx->mDeviceTranslator);
Expand All @@ -101,6 +104,26 @@ class ClusterContext : public UnifyBridgeContext

return SUCCESS;
}

/**
* @brief
* It's necessary to call this function as a part of your teardown of the
* entire test suite.
*
* @param[inout] inContext A pointer to test suite-specific context
* provided by the test suite driver.
*/
static int Finalize(void * context)
{
auto * ctx = static_cast<ClusterContext *>(context);

if (ctx->nlTestTearDown(context) != SUCCESS)
return FAILURE;

ctx->UMB_Finalize();

return SUCCESS;
}

/**
* @brief
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ static nlTestSuite kTheSuite =
{
"QRCodePublisher",
&sTests[0],
UnifyBridgeContext::Initialize,
UnifyBridgeContext::Finalize
UnifyBridgeContext::nlTestSetUpTestSuite,
UnifyBridgeContext::nlTestTearDownTestSuite
};

int QRCodePublisherSuite(void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
namespace unify::matter_bridge {
namespace Test {

CHIP_ERROR UnifyBridgeContext::Init()
CHIP_ERROR UnifyBridgeContext::UMB_Initialize()
{
ReturnErrorOnFailure(Super::Init());
ReturnErrorOnFailure(Super::SetUpTestSuite());

MockAttributePersistenceProvider persistence;
chip::app::SetAttributePersistenceProvider(&persistence);
Expand All @@ -28,9 +28,9 @@ CHIP_ERROR UnifyBridgeContext::Init()
return CHIP_NO_ERROR;
}

void UnifyBridgeContext::Shutdown()
void UnifyBridgeContext::UMB_Finalize()
{
Super::Shutdown();
Super::TearDownTestSuite();
}

} // namespace Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// Third party library
#include <nlunit-test.h>
#include "sl_log.h"

namespace unify::matter_bridge {
namespace Test {
Expand All @@ -53,10 +54,10 @@ class UnifyBridgeContext : public chip::Test::AppContext
{}

/// Initialize the underlying layers.
CHIP_ERROR Init() override;
CHIP_ERROR UMB_Initialize();

// Shutdown all layers, finalize operations
void Shutdown() override;
void UMB_Finalize();

UnifyEmberInterface mEmberInterface;
device_translator mDeviceTranslator = device_translator(false);
Expand Down
Loading

0 comments on commit 6541396

Please sign in to comment.