diff --git a/src/BUILD.gn b/src/BUILD.gn index 01aae8abc3fbab..cf15f40ec00629 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -92,9 +92,9 @@ if (chip_build_tests) { ] } + # Skip on efr32 due to flash and/or ram limitations. if (chip_device_platform != "efr32") { tests += [ - # TODO(#10447): App test has HF on EFR32. "${chip_root}/src/app/tests", "${chip_root}/src/credentials/tests", "${chip_root}/src/lib/format/tests", @@ -128,7 +128,7 @@ if (chip_build_tests) { # https://github.com/project-chip/connectedhomeip/issues/9630 if (chip_device_platform != "nrfconnect" && chip_device_platform != "efr32") { - # TODO(#10447): Controller test has HF on EFR32. + # Doesn't compile on ef32. Multiple definitions issues with attribute storage and overflows flash memory. tests += [ "${chip_root}/src/controller/tests/data_model" ] # Skip controller test for Open IoT SDK diff --git a/src/app/icd/server/tests/TestICDManager.cpp b/src/app/icd/server/tests/TestICDManager.cpp index 6cba8c308b4e06..45e781685e6d31 100644 --- a/src/app/icd/server/tests/TestICDManager.cpp +++ b/src/app/icd/server/tests/TestICDManager.cpp @@ -1061,10 +1061,15 @@ TEST_F(TestICDManager, TestICDStateObserverOnTransitionToIdleModeEqualActiveMode // Expire IdleMode timer AdvanceClockAndRunEventLoop(1_s); - EXPECT_FALSE(mICDStateObserver.mOnTransitionToIdleCalled); + // In this scenario, The ICD state machine kicked a OnTransitionToIdle timer with a duration of 0 seconds. + // The freeRTOS systemlayer timer calls a 0s timer's callback instantly while on posix it take and 1 addition event loop. + // Thefore, the expect result diverges here based on the systemlayer implementation. Skip this check. + // https://github.com/project-chip/connectedhomeip/issues/33441 + // EXPECT_FALSE(mICDStateObserver.mOnTransitionToIdleCalled); // Expire OnTransitionToIdleMode AdvanceClockAndRunEventLoop(1_ms32); + // All systems should have called the OnTransitionToIdle callback by now. EXPECT_TRUE(mICDStateObserver.mOnTransitionToIdleCalled); // Reset Old durations diff --git a/src/inet/tests/TestInetCommonOptions.cpp b/src/inet/tests/TestInetCommonOptions.cpp index fdc79b11954a27..7e4648d7466b1b 100644 --- a/src/inet/tests/TestInetCommonOptions.cpp +++ b/src/inet/tests/TestInetCommonOptions.cpp @@ -51,7 +51,7 @@ NetworkOptions::NetworkOptions() static OptionDef optionDefs[] = { { "local-addr", kArgumentRequired, 'a' }, { "node-addr", kArgumentRequired, kToolCommonOpt_NodeAddr }, /* alias for local-addr */ -#if CHIP_SYSTEM_CONFIG_USE_LWIP +#if CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT { "tap-device", kArgumentRequired, kToolCommonOpt_TapDevice }, { "ipv4-gateway", kArgumentRequired, kToolCommonOpt_IPv4GatewayAddr }, { "ipv6-gateway", kArgumentRequired, kToolCommonOpt_IPv6GatewayAddr }, @@ -59,7 +59,7 @@ NetworkOptions::NetworkOptions() { "debug-lwip", kNoArgument, kToolCommonOpt_DebugLwIP }, { "event-delay", kArgumentRequired, kToolCommonOpt_EventDelay }, { "tap-system-config", kNoArgument, kToolCommonOpt_TapInterfaceConfig }, -#endif +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT {} }; OptionDefs = optionDefs; @@ -69,7 +69,7 @@ NetworkOptions::NetworkOptions() OptionHelp = " -a, --local-addr, --node-addr \n" " Local address for the node.\n" "\n" -#if CHIP_SYSTEM_CONFIG_USE_LWIP +#if CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT " --tap-device \n" " TAP device name for LwIP hosted OS usage. Defaults to chip-dev-.\n" "\n" @@ -91,14 +91,14 @@ NetworkOptions::NetworkOptions() " --tap-system-config\n" " Use configuration on each of the Linux TAP interfaces to configure LwIP's interfaces.\n" "\n" -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT ; // Defaults. LocalIPv4Addr.clear(); LocalIPv6Addr.clear(); -#if CHIP_SYSTEM_CONFIG_USE_LWIP +#if CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT TapDeviceName.clear(); LwIPDebugFlags = 0; EventDelay = 0; @@ -106,7 +106,7 @@ NetworkOptions::NetworkOptions() IPv6GatewayAddr.clear(); DNSServerAddr = Inet::IPAddress::Any; TapUseSystemConfig = false; -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT } bool NetworkOptions::HandleOption(const char * progName, OptionSet * optSet, int id, const char * name, const char * arg) diff --git a/src/inet/tests/TestInetCommonOptions.h b/src/inet/tests/TestInetCommonOptions.h index 9b3cd2e59b4f3b..a67536dda1b266 100644 --- a/src/inet/tests/TestInetCommonOptions.h +++ b/src/inet/tests/TestInetCommonOptions.h @@ -59,7 +59,7 @@ class NetworkOptions : public chip::ArgParser::OptionSetBase std::vector LocalIPv4Addr; std::vector LocalIPv6Addr; -#if CHIP_SYSTEM_CONFIG_USE_LWIP +#if CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT std::vector IPv4GatewayAddr; std::vector IPv6GatewayAddr; chip::Inet::IPAddress DNSServerAddr; @@ -67,7 +67,7 @@ class NetworkOptions : public chip::ArgParser::OptionSetBase uint8_t LwIPDebugFlags; uint32_t EventDelay; bool TapUseSystemConfig; -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT NetworkOptions(); diff --git a/src/inet/tests/TestInetCommonPosix.cpp b/src/inet/tests/TestInetCommonPosix.cpp index 9d5e4588979d1a..6fc53a15fbb980 100644 --- a/src/inet/tests/TestInetCommonPosix.cpp +++ b/src/inet/tests/TestInetCommonPosix.cpp @@ -337,7 +337,7 @@ void InitNetwork() #if INET_CONFIG_ENABLE_TCP_ENDPOINT gTCP.Init(gSystemLayer); #endif -#if INET_CONFIG_ENABLE_TCP_ENDPOINT +#if INET_CONFIG_ENABLE_UDP_ENDPOINT gUDP.Init(gSystemLayer); #endif } @@ -368,14 +368,14 @@ void ServiceEvents(uint32_t aSleepTimeMilliseconds) gSystemLayer.HandleEvents(); #endif -#if CHIP_SYSTEM_CONFIG_USE_LWIP +#if CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT if (gSystemLayer.IsInitialized()) { static uint32_t sRemainingSystemLayerEventDelay = 0; if (sRemainingSystemLayerEventDelay == 0) { -#if CHIP_DEVICE_LAYER_TARGET_OPEN_IOT_SDK +#if CHIP_DEVICE_LAYER_TARGET_OPEN_IOT_SDK || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT // We need to terminate event loop after performance single step. // Event loop processing work items until StopEventLoopTask is called. // Scheduling StopEventLoop task guarantees correct operation of the loop. @@ -390,7 +390,7 @@ void ServiceEvents(uint32_t aSleepTimeMilliseconds) gSystemLayer.HandlePlatformTimer(); } -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT } #if CHIP_SYSTEM_CONFIG_USE_LWIP && !(CHIP_SYSTEM_CONFIG_LWIP_SKIP_INIT) diff --git a/src/lib/core/tests/BUILD.gn b/src/lib/core/tests/BUILD.gn index 30d50ee9493699..001078019a7e83 100644 --- a/src/lib/core/tests/BUILD.gn +++ b/src/lib/core/tests/BUILD.gn @@ -30,9 +30,14 @@ chip_test_suite("tests") { "TestOptional.cpp", "TestReferenceCounted.cpp", "TestTLV.cpp", - "TestTLVVectorWriter.cpp", ] + # requires large amount of heap for multiple unfragmented 10k buffers + # skip for efr32 to allow flash space for other tests + if (chip_device_platform != "efr32") { + test_sources += [ "TestTLVVectorWriter.cpp" ] + } + cflags = [ "-Wconversion" ] public_deps = [ diff --git a/src/lib/support/UnitTestUtils.cpp b/src/lib/support/UnitTestUtils.cpp index 84976405a20940..0d3acae6487106 100644 --- a/src/lib/support/UnitTestUtils.cpp +++ b/src/lib/support/UnitTestUtils.cpp @@ -51,7 +51,7 @@ uint64_t TimeMonotonicMillis() void SleepMillis(uint64_t millisecs) { - uint32_t ticks = static_cast(millisecs / portTICK_PERIOD_MS); + uint32_t ticks = pdMS_TO_TICKS(millisecs); vTaskDelay(ticks == 0 ? 1 : ticks); // delay at least 1 tick } diff --git a/src/messaging/tests/BUILD.gn b/src/messaging/tests/BUILD.gn index a78dcce953756b..89f0934486b9c1 100644 --- a/src/messaging/tests/BUILD.gn +++ b/src/messaging/tests/BUILD.gn @@ -49,27 +49,20 @@ static_library("helpers") { chip_test_suite_using_nltest("tests") { output_name = "libMessagingLayerTests" - test_sources = [] - - if (chip_device_platform != "efr32") { - # TODO(#10447): ReliableMessage Test has HF, and ExchangeMgr hangs on EFR32. - # And TestAbortExchangesForFabric does not link on EFR32 for some reason. - # TODO #33372: TestExchange.cpp asserts in ExchangeContext::SendMessage - test_sources += [ - "TestAbortExchangesForFabric.cpp", - "TestExchange.cpp", - "TestExchangeMgr.cpp", - "TestReliableMessageProtocol.cpp", - ] + test_sources = [ + "TestAbortExchangesForFabric.cpp", + "TestExchange.cpp", + "TestExchangeMgr.cpp", + "TestReliableMessageProtocol.cpp", + ] - if (chip_device_platform != "esp32" && chip_device_platform != "mbed" && - chip_device_platform != "nrfconnect" && chip_device_platform != "nxp") { - test_sources += [ "TestExchangeHolder.cpp" ] - } + if (chip_device_platform != "esp32" && chip_device_platform != "mbed" && + chip_device_platform != "nrfconnect" && chip_device_platform != "nxp") { + test_sources += [ "TestExchangeHolder.cpp" ] + } - if (chip_device_platform == "linux") { - test_sources += [ "TestMessagingLayer.cpp" ] - } + if (chip_device_platform == "linux") { + test_sources += [ "TestMessagingLayer.cpp" ] } cflags = [ "-Wconversion" ] diff --git a/src/platform/silabs/CHIPDevicePlatformConfig.h b/src/platform/silabs/CHIPDevicePlatformConfig.h index e8601e5feedaf9..feabf306ab0772 100644 --- a/src/platform/silabs/CHIPDevicePlatformConfig.h +++ b/src/platform/silabs/CHIPDevicePlatformConfig.h @@ -96,7 +96,9 @@ #endif /* CHIP_ENABLE_OPENTHREAD */ #endif /* defined(SL_WIFI) */ +#ifndef CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE #define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 +#endif #if defined(SL_WIFI) diff --git a/src/system/tests/TestSystemTimer.cpp b/src/system/tests/TestSystemTimer.cpp index 6c065b96a01f9a..6271836238b55c 100644 --- a/src/system/tests/TestSystemTimer.cpp +++ b/src/system/tests/TestSystemTimer.cpp @@ -70,7 +70,7 @@ class LayerEvents class LayerEvents::value>::type> @@ -87,7 +87,7 @@ class LayerEvents #include #include +#include #include +#include #include #include +#include #include #include #include @@ -37,6 +40,8 @@ #include #include +#include "SilabsDeviceDataProvider.h" + extern "C" int printf(const char * format, ...) { va_list args; @@ -56,8 +61,11 @@ class NlTest : public pw_rpc::nanopb::NlTest::Service stream_writer = &writer; nlTestSetLogger(&nl_test_logger); - RunRegisteredUnitTests(); - + printf("--- Running nltest ---"); + int status = RunRegisteredUnitTests(); + printf("--- Running gtest ---"); + status += chip::test::RunAllTests(); + printf("Test status: %d", status); stream_writer = nullptr; writer.Finish(); } @@ -194,6 +202,9 @@ int main(void) chip::Platform::MemoryInit(); chip::DeviceLayer::PlatformMgr().InitChipStack(); + // required for inits tied to the event loop + chip::DeviceLayer::SetDeviceInstanceInfoProvider(&chip::DeviceLayer::Silabs::SilabsDeviceDataProvider::GetDeviceDataProvider()); + chip::DeviceLayer::SetCommissionableDataProvider(&chip::DeviceLayer::Silabs::SilabsDeviceDataProvider::GetDeviceDataProvider()); SILABS_LOG("***** CHIP EFR32 device tests *****\r\n");