Skip to content

Commit

Permalink
Fix issue related to teardown of some App Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alami-Amine committed May 29, 2024
1 parent 8c8889b commit f7a5195
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/app/tests/AppTestContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ void AppContext::SetUpTestSuite()

void AppContext::TearDownTestSuite()
{
// Adding a DrainAndServiceIO call fixes the teardown for some tests (TestAclAttribute and TestReportScheduler); these were
// triggering failures in tests that follow them when running on nRF CI (Zephyr native_posix where all Unit Tests are compiled
// into a single file)
// TODO: understand this more and solve underlying issue
LoopbackMessagingContext::DrainAndServiceIO();

chip::DeviceLayer::PlatformMgr().Shutdown();
LoopbackMessagingContext::TearDownTestSuite();
}
Expand Down
14 changes: 2 additions & 12 deletions src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ chip_test_suite_using_nltest("tests") {
output_name = "libAppTests"

test_sources = [
"TestAclAttribute.cpp",
"TestAclEvent.cpp",
"TestAttributeAccessInterfaceCache.cpp",
"TestAttributePathExpandIterator.cpp",
Expand Down Expand Up @@ -151,6 +152,7 @@ chip_test_suite_using_nltest("tests") {
"TestPendingResponseTrackerImpl.cpp",
"TestPowerSourceCluster.cpp",
"TestReadInteraction.cpp",
"TestReportScheduler.cpp",
"TestReportingEngine.cpp",
"TestStatusIB.cpp",
"TestStatusResponseMessage.cpp",
Expand All @@ -164,8 +166,6 @@ chip_test_suite_using_nltest("tests") {
test_sources += [ "TestFailSafeContext.cpp" ]
}

test_sources += [ "TestAclAttribute.cpp" ]

# DefaultICDClientStorage assumes that raw AES key is used by the application
if (chip_crypto != "psa") {
test_sources += [ "TestDefaultICDClientStorage.cpp" ]
Expand All @@ -189,16 +189,6 @@ chip_test_suite_using_nltest("tests") {
test_sources += [ "TestEventLogging.cpp" ]
}

# The platform manager is not properly clearing queues in test teardown, which results in
# DrainIO calls not being able to run in expected time (5seconds) if unprocessed reported engine
# runs are remaining, causing tests to crash in Open IoT SDK and Zephyr tests since they are
# running all tests in one file. We need to figure out how to properly clean the event queues
# before enabling this test for these platforms.
if (chip_device_platform != "nrfconnect" &&
chip_device_platform != "openiotsdk") {
test_sources += [ "TestReportScheduler.cpp" ]
}

cflags = [ "-Wconversion" ]

public_deps = [
Expand Down

0 comments on commit f7a5195

Please sign in to comment.