Skip to content

Commit f7a5195

Browse files
committed
Fix issue related to teardown of some App Tests
1 parent 8c8889b commit f7a5195

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
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

+2-12
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ chip_test_suite_using_nltest("tests") {
123123
output_name = "libAppTests"
124124

125125
test_sources = [
126+
"TestAclAttribute.cpp",
126127
"TestAclEvent.cpp",
127128
"TestAttributeAccessInterfaceCache.cpp",
128129
"TestAttributePathExpandIterator.cpp",
@@ -151,6 +152,7 @@ chip_test_suite_using_nltest("tests") {
151152
"TestPendingResponseTrackerImpl.cpp",
152153
"TestPowerSourceCluster.cpp",
153154
"TestReadInteraction.cpp",
155+
"TestReportScheduler.cpp",
154156
"TestReportingEngine.cpp",
155157
"TestStatusIB.cpp",
156158
"TestStatusResponseMessage.cpp",
@@ -164,8 +166,6 @@ chip_test_suite_using_nltest("tests") {
164166
test_sources += [ "TestFailSafeContext.cpp" ]
165167
}
166168

167-
test_sources += [ "TestAclAttribute.cpp" ]
168-
169169
# DefaultICDClientStorage assumes that raw AES key is used by the application
170170
if (chip_crypto != "psa") {
171171
test_sources += [ "TestDefaultICDClientStorage.cpp" ]
@@ -189,16 +189,6 @@ chip_test_suite_using_nltest("tests") {
189189
test_sources += [ "TestEventLogging.cpp" ]
190190
}
191191

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

204194
public_deps = [

0 commit comments

Comments
 (0)