Skip to content

Commit

Permalink
Fix shutdown ordering in IM integration test (#7469)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored Jun 9, 2021
1 parent 17adc8c commit 82f42e4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 0 additions & 4 deletions src/app/tests/integration/chip_im_initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <core/CHIPCore.h>
#include <mutex>
#include <platform/CHIPDeviceLayer.h>
#include <protocols/secure_channel/MessageCounterManager.h>
#include <protocols/secure_channel/PASESession.h>
#include <support/ErrorStr.h>
#include <system/SystemPacketBuffer.h>
Expand All @@ -55,9 +54,6 @@ constexpr chip::Transport::AdminId gAdminId = 0;
chip::app::ReadClient * gpReadClient = nullptr;

chip::TransportMgr<chip::Transport::UDP> gTransportManager;
chip::SecureSessionMgr gSessionManager;
chip::secure_channel::MessageCounterManager gMessageCounterManager;

chip::Inet::IPAddress gDestAddr;

// The last time a CHIP Command was attempted to be sent.
Expand Down
3 changes: 0 additions & 3 deletions src/app/tests/integration/chip_im_responder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <messaging/ExchangeMgr.h>
#include <messaging/Flags.h>
#include <platform/CHIPDeviceLayer.h>
#include <protocols/secure_channel/MessageCounterManager.h>
#include <protocols/secure_channel/PASESession.h>
#include <support/ErrorStr.h>
#include <system/SystemPacketBuffer.h>
Expand Down Expand Up @@ -131,9 +130,7 @@ CHIP_ERROR ReadSingleClusterData(ClusterInfo & aClusterInfo, TLV::TLVWriter & aW

namespace {
chip::TransportMgr<chip::Transport::UDP> gTransportManager;
chip::SecureSessionMgr gSessionManager;
chip::SecurePairingUsingTestSecret gTestPairing;
chip::secure_channel::MessageCounterManager gMessageCounterManager;
LivenessEventGenerator gLivenessGenerator;

uint8_t gDebugEventBuffer[2048];
Expand Down
7 changes: 5 additions & 2 deletions src/app/tests/integration/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
#include <platform/CHIPDeviceLayer.h>
#include <support/ErrorStr.h>

// The ExchangeManager global object.
chip::Messaging::ExchangeManager gExchangeManager;
chip::SecureSessionMgr gSessionManager;
chip::secure_channel::MessageCounterManager gMessageCounterManager;

void InitializeChip(void)
{
Expand All @@ -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, ...)
Expand Down
3 changes: 3 additions & 0 deletions src/app/tests/integration/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@

#include <app/util/basic-types.h>
#include <messaging/ExchangeMgr.h>
#include <protocols/secure_channel/MessageCounterManager.h>

#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;
Expand Down

0 comments on commit 82f42e4

Please sign in to comment.