Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue related to teardown of some App Tests #33654

Merged
merged 3 commits into from
May 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/tests/AppTestContext.cpp
Original file line number Diff line number Diff line change
@@ -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();
}
14 changes: 2 additions & 12 deletions src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
@@ -123,6 +123,7 @@ chip_test_suite_using_nltest("tests") {
output_name = "libAppTests"

test_sources = [
"TestAclAttribute.cpp",
"TestAclEvent.cpp",
"TestAttributeAccessInterfaceCache.cpp",
"TestAttributePathExpandIterator.cpp",
@@ -151,6 +152,7 @@ chip_test_suite_using_nltest("tests") {
"TestPendingResponseTrackerImpl.cpp",
"TestPowerSourceCluster.cpp",
"TestReadInteraction.cpp",
"TestReportScheduler.cpp",
"TestReportingEngine.cpp",
"TestStatusIB.cpp",
"TestStatusResponseMessage.cpp",
@@ -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" ]
@@ -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 = [