Skip to content

Commit af22724

Browse files
committed
Fix TearDown issue of some App Tests
1 parent cd7b9a0 commit af22724

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/app/tests/AppTestContext.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ void AppContext::SetUpTestSuite()
4949

5050
void AppContext::TearDownTestSuite()
5151
{
52+
// Adding a DrainAndServiceIO call fixes the teardown for some tests (TestAclAttribute and TestReportScheduler); these were
53+
// triggering failures in tests that follow them when running on nRF CI (Zephyr native_posix where all Unit Tests are compiled
54+
// into a single file)
55+
// TODO: understand this more and solve underlying issue
56+
LoopbackMessagingContext::DrainAndServiceIO();
57+
5258
chip::DeviceLayer::PlatformMgr().Shutdown();
5359
LoopbackMessagingContext::TearDownTestSuite();
5460
}

src/app/tests/BUILD.gn

+4-3
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,12 @@ chip_test_suite_using_nltest("tests_nltest") {
231231

232232
# The platform manager is not properly clearing queues in test teardown, which results in
233233
# DrainIO calls not being able to run in expected time (5seconds) if unprocessed reported engine
234-
# runs are remaining, causing tests to crash in Open IoT SDK and Zephyr tests since they are
234+
# runs are remaining, causing tests to crash in Open IoT SDK since they are
235235
# running all tests in one file. We need to figure out how to properly clean the event queues
236236
# before enabling this test for these platforms.
237-
if (chip_device_platform != "nrfconnect" &&
238-
chip_device_platform != "openiotsdk") {
237+
# Update: This was fixed for Nordic Zephyr Tests by calling DrainAndServiceIO in AppContext::TearDownTestSuite()
238+
# TODO: check if above solution works for openiotsdk as well
239+
if (chip_device_platform != "openiotsdk") {
239240
test_sources += [ "TestReportScheduler.cpp" ]
240241
}
241242

0 commit comments

Comments
 (0)