From 62c145d015cb373d0126cb17a639d604979c42eb Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 9 Jun 2021 00:20:25 -0700 Subject: [PATCH] Fix shutdown ordering in IM integration test (#7469) --- src/app/tests/integration/chip_im_initiator.cpp | 4 ---- src/app/tests/integration/chip_im_responder.cpp | 3 --- src/app/tests/integration/common.cpp | 7 +++++-- src/app/tests/integration/common.h | 3 +++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/app/tests/integration/chip_im_initiator.cpp b/src/app/tests/integration/chip_im_initiator.cpp index 732100e1692a21..c617b3b27d3234 100644 --- a/src/app/tests/integration/chip_im_initiator.cpp +++ b/src/app/tests/integration/chip_im_initiator.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -55,9 +54,6 @@ constexpr chip::Transport::AdminId gAdminId = 0; chip::app::ReadClient * gpReadClient = nullptr; chip::TransportMgr gTransportManager; -chip::SecureSessionMgr gSessionManager; -chip::secure_channel::MessageCounterManager gMessageCounterManager; - chip::Inet::IPAddress gDestAddr; // The last time a CHIP Command was attempted to be sent. diff --git a/src/app/tests/integration/chip_im_responder.cpp b/src/app/tests/integration/chip_im_responder.cpp index 2be6b9b5daf95b..509693f6507201 100644 --- a/src/app/tests/integration/chip_im_responder.cpp +++ b/src/app/tests/integration/chip_im_responder.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -131,9 +130,7 @@ CHIP_ERROR ReadSingleClusterData(ClusterInfo & aClusterInfo, TLV::TLVWriter & aW namespace { chip::TransportMgr gTransportManager; -chip::SecureSessionMgr gSessionManager; chip::SecurePairingUsingTestSecret gTestPairing; -chip::secure_channel::MessageCounterManager gMessageCounterManager; LivenessEventGenerator gLivenessGenerator; uint8_t gDebugEventBuffer[2048]; diff --git a/src/app/tests/integration/common.cpp b/src/app/tests/integration/common.cpp index cd1aa56cda23ea..be0cbcd6ec9b3d 100644 --- a/src/app/tests/integration/common.cpp +++ b/src/app/tests/integration/common.cpp @@ -30,8 +30,9 @@ #include #include -// The ExchangeManager global object. chip::Messaging::ExchangeManager gExchangeManager; +chip::SecureSessionMgr gSessionManager; +chip::secure_channel::MessageCounterManager gMessageCounterManager; void InitializeChip(void) { @@ -57,8 +58,10 @@ void InitializeChip(void) void ShutdownChip(void) { - gExchangeManager.Shutdown(); chip::DeviceLayer::PlatformMgr().Shutdown(); + gMessageCounterManager.Shutdown(); + gExchangeManager.Shutdown(); + gSessionManager.Shutdown(); } void TLVPrettyPrinter(const char * aFormat, ...) diff --git a/src/app/tests/integration/common.h b/src/app/tests/integration/common.h index e2851fb5cf506f..6f6854c33eff36 100644 --- a/src/app/tests/integration/common.h +++ b/src/app/tests/integration/common.h @@ -26,11 +26,14 @@ #include #include +#include #define MAX_MESSAGE_SOURCE_STR_LENGTH (100) #define NETWORK_SLEEP_TIME_MSECS (100 * 1000) extern chip::Messaging::ExchangeManager gExchangeManager; +extern chip::SecureSessionMgr gSessionManager; +extern chip::secure_channel::MessageCounterManager gMessageCounterManager; constexpr chip::NodeId kTestNodeId = 0x1ULL; constexpr chip::NodeId kTestNodeId1 = 0x2ULL;