connection between 2 systems and bug fixes (#14)

This commit is contained in:
tompzf
2026-07-03 14:53:48 +02:00
committed by GitHub
parent 0fb5660d27
commit 46842200f1
284 changed files with 35200 additions and 8265 deletions

View File

@@ -42,7 +42,7 @@ public:
*/
CReceiver()
{
m_threadSender = std::thread(&CReceiver::SendThreadFunc, this);
m_threadSender = sdv::core::secure_thread(&CReceiver::SendThreadFunc, this);
}
/**
@@ -236,7 +236,7 @@ private:
std::queue<sdv::sequence<sdv::pointer<uint8_t>>> m_queueSendData; ///< Queue for sending data.
std::condition_variable m_cvDisconnect; ///< Disconnect event.
std::condition_variable m_cvReceived; ///< Receive event.
std::thread m_threadSender; ///< Thread to send data.
sdv::core::secure_thread m_threadSender; ///< Thread to send data.
std::atomic_bool m_bConnected = false; ///< Set when connected was triggered.
std::atomic_bool m_bDisconnect = false; ///< Set when shutdown was triggered.
std::atomic_bool m_bShutdown = false; ///< Set when shutdown is processed.
@@ -320,9 +320,9 @@ extern "C" int main(int argc, char* argv[])
TRACE("Forced termination of app ", bServer ? "server" : "client", " process is ", bForceTerminate ? "enabled" : "disabled");
TRACE("Long life of app ",bServer ? "server" : "client", " process is ", bLongLife ? "enabled" : "disabled");
// Create an control management channel (if required).
// Create a control management channel (if required).
CSharedMemChannelMgnt mgntControlMgntChannel;
mgntControlMgntChannel.Initialize("");
mgntControlMgntChannel.Initialize(sdv::SObjectInfo());
if (mgntControlMgntChannel.GetObjectState() != sdv::EObjectState::initialized) return -11;
mgntControlMgntChannel.SetOperationMode(sdv::EOperationMode::running);
if (mgntControlMgntChannel.GetObjectState() != sdv::EObjectState::running) return -11;
@@ -349,7 +349,7 @@ extern "C" int main(int argc, char* argv[])
// Create the data management channel.
CSharedMemChannelMgnt mgntDataMgntChannel;
mgntDataMgntChannel.Initialize("");
mgntDataMgntChannel.Initialize(sdv::SObjectInfo());
if (mgntDataMgntChannel.GetObjectState() != sdv::EObjectState::initialized) return -1;
mgntDataMgntChannel.SetOperationMode(sdv::EOperationMode::running);
if (mgntDataMgntChannel.GetObjectState() != sdv::EObjectState::running) return -1;
@@ -360,10 +360,10 @@ extern "C" int main(int argc, char* argv[])
if (bServer)
{
TRACE("Server: Create data endpoint...");
sdv::ipc::SChannelEndpoint sEndpoint = mgntDataMgntChannel.CreateEndpoint(R"code(
sdv::ipc::SChannelEndpoint sEndpoint = mgntDataMgntChannel.CreateEndpoint(R"toml(
[IpcChannel]
Size = 1024000
)code");
)toml");
ptrDataConnection = sEndpoint.pConnection;
sdv::pointer<uint8_t> ptrConnectInfoData;
ptrConnectInfoData.resize(sEndpoint.ssConnectString.size());

View File

@@ -59,7 +59,7 @@ TEST(InProcessMemoryBufferTest, TriggerTestRx)
};
std::unique_lock<std::mutex> lockStart(mtxStart);
std::thread thread(fnWaitForTrigger);
sdv::core::secure_thread thread(fnWaitForTrigger);
cvStart.wait(lockStart);
for (size_t n = 0; n < 20; n++)
@@ -108,7 +108,7 @@ TEST(InProcessMemoryBufferTest, TriggerTestTx)
};
std::unique_lock<std::mutex> lockStart(mtxStart);
std::thread thread(fnWaitForTrigger);
sdv::core::secure_thread thread(fnWaitForTrigger);
cvStart.wait(lockStart);
for (size_t n = 0; n < 20; n++)
@@ -170,8 +170,8 @@ TEST(InProcessMemoryBufferTest, TriggerTestRxTx)
std::unique_lock<std::mutex> lockStartSender(mtxSenderStart);
std::unique_lock<std::mutex> lockStartReceiver(mtxReceiverStart);
std::thread threadSender(fnWaitForTriggerSender);
std::thread threadReceiver(fnWaitForTriggerReceiver);
sdv::core::secure_thread threadSender(fnWaitForTriggerSender);
sdv::core::secure_thread threadReceiver(fnWaitForTriggerReceiver);
cvSenderStart.wait(lockStartSender);
lockStartSender.unlock();
cvReceiverStart.wait(lockStartReceiver);
@@ -340,8 +340,8 @@ TEST(InProcessMemoryBufferTest, ReserveCommitAccessReleaseNonChronologicalOrder)
// Reserve buffers for strings
// The buffer header has 16 bytes
// Each allocation is 8 bytes header, 5 bytes data and 3 bytes alignment
CAccessorTxPacket rgTxPackets[32] = {};
// Each allocation is 8 bytes header, 5 bytes data and 3 bytes alignment
CAccessorTxPacket rgTxPackets[32] = {};
for (int32_t iIndex = 0; iIndex < 15; iIndex++)
{
auto optTxPacket = sender.Reserve(5);
@@ -373,8 +373,8 @@ TEST(InProcessMemoryBufferTest, ReserveCommitAccessReleaseNonChronologicalOrder)
{
// The text should contain the number 0
EXPECT_TRUE(optRxPacket);
EXPECT_NE(optRxPacket->GetData(), nullptr);
EXPECT_EQ(std::to_string(0), optRxPacket->GetData<char>());
EXPECT_NE(optRxPacket->GetData(), nullptr);
EXPECT_EQ(std::to_string(0), optRxPacket->GetData<char>());
optRxPacket->Accept();
}
else
@@ -414,7 +414,7 @@ TEST(InProcessMemoryBufferTest, ReserveCommitAccessReleaseNonChronologicalOrder)
EXPECT_NE(rgRxPackets[iIndex].GetData(), nullptr);
EXPECT_NE(rgRxPackets[iIndex].GetSize(), 0u);
}
if (rgRxPackets[iIndex])
if (rgRxPackets[iIndex])
{
EXPECT_EQ(std::to_string(iIndex), rgRxPackets[iIndex].GetData<char>());
}
@@ -442,33 +442,33 @@ TEST(InProcessMemoryBufferTest, SendReceivePattern)
ASSERT_TRUE(appcontrol.Startup(""));
CInProcMemBufferTx sender;
EXPECT_TRUE(sender.IsValid());
EXPECT_TRUE(sender.IsValid());
CInProcMemBufferRx receiver(sender.GetConnectionString());
EXPECT_TRUE(receiver.IsValid());
CInProcMemBufferRx receiver(sender.GetConnectionString());
EXPECT_TRUE(receiver.IsValid());
CPatternReceiver pattern_inspector(receiver);
CPatternReceiver pattern_inspector(receiver);
CPatternSender pattern_generator(sender);
// Wait for 2 seconds
std::this_thread::sleep_for(std::chrono::seconds(PATTERN_TEST_TIME_S));
std::this_thread::sleep_for(std::chrono::seconds(PATTERN_TEST_TIME_S));
// Shutdown
pattern_generator.Shutdown();
pattern_inspector.Shutdown();
pattern_inspector.Shutdown();
std::cout << "Pattern generator: " << pattern_generator.GetCycleCnt() << " cyles, " << pattern_generator.GetPacketCnt()
<< " packets, " << pattern_generator.GetByteCnt() << " bytes" << std::endl;
std::cout << "Pattern inspector: " << pattern_inspector.GetCycleCnt() << " cyles, " << pattern_inspector.GetPacketCnt()
<< " packets, " << pattern_generator.GetByteCnt() << " bytes" << std::endl;
std::cout << "Pattern inspector: " << pattern_inspector.GetCycleCnt() << " cyles, " << pattern_inspector.GetPacketCnt()
<< " packets, " << pattern_inspector.GetByteCnt() << " bytes, " << pattern_inspector.GetErrorCnt()
<< " errors, " << std::endl;
EXPECT_NE(pattern_generator.GetCycleCnt(), 0u);
EXPECT_NE(pattern_generator.GetPacketCnt(), 0u);
EXPECT_NE(pattern_generator.GetByteCnt(), 0ull);
EXPECT_NE(pattern_inspector.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_inspector.GetErrorCnt(), 0u);
EXPECT_NE(pattern_inspector.GetPacketCnt(), 0u);
EXPECT_NE(pattern_inspector.GetByteCnt(), 0ull);
EXPECT_NE(pattern_generator.GetCycleCnt(), 0u);
EXPECT_NE(pattern_generator.GetPacketCnt(), 0u);
EXPECT_NE(pattern_generator.GetByteCnt(), 0ull);
EXPECT_NE(pattern_inspector.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_inspector.GetErrorCnt(), 0u);
EXPECT_NE(pattern_inspector.GetPacketCnt(), 0u);
EXPECT_NE(pattern_inspector.GetByteCnt(), 0ull);
}
TEST(InProcessMemoryBufferTest, DelayedSendReceivePattern)
@@ -477,33 +477,33 @@ TEST(InProcessMemoryBufferTest, DelayedSendReceivePattern)
ASSERT_TRUE(appcontrol.Startup(""));
CInProcMemBufferTx sender;
EXPECT_TRUE(sender.IsValid());
EXPECT_TRUE(sender.IsValid());
CInProcMemBufferRx receiver(sender.GetConnectionString());
EXPECT_TRUE(receiver.IsValid());
CInProcMemBufferRx receiver(sender.GetConnectionString());
EXPECT_TRUE(receiver.IsValid());
CPatternReceiver pattern_inspector(receiver);
CPatternSender pattern_generator(sender, 10);
CPatternReceiver pattern_inspector(receiver);
CPatternSender pattern_generator(sender, 10);
// Wait for 2 seconds
std::this_thread::sleep_for(std::chrono::seconds(PATTERN_TEST_TIME_S));
// Wait for 2 seconds
std::this_thread::sleep_for(std::chrono::seconds(PATTERN_TEST_TIME_S));
// Shutdown
pattern_generator.Shutdown();
pattern_inspector.Shutdown();
// Shutdown
pattern_generator.Shutdown();
pattern_inspector.Shutdown();
std::cout << "Pattern generator: " << pattern_generator.GetCycleCnt() << " cyles, " << pattern_generator.GetPacketCnt()
<< " packets, " << pattern_generator.GetByteCnt() << " bytes" << std::endl;
std::cout << "Pattern inspector: " << pattern_inspector.GetCycleCnt() << " cyles, " << pattern_inspector.GetPacketCnt()
<< " packets, " << pattern_generator.GetByteCnt() << " bytes" << std::endl;
std::cout << "Pattern inspector: " << pattern_inspector.GetCycleCnt() << " cyles, " << pattern_inspector.GetPacketCnt()
<< " packets, " << pattern_inspector.GetByteCnt() << " bytes, " << pattern_inspector.GetErrorCnt()
<< " errors, " << std::endl;
EXPECT_NE(pattern_generator.GetCycleCnt(), 0u);
EXPECT_NE(pattern_generator.GetPacketCnt(), 0u);
EXPECT_NE(pattern_generator.GetByteCnt(), 0ull);
EXPECT_NE(pattern_inspector.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_inspector.GetErrorCnt(), 0u);
EXPECT_NE(pattern_inspector.GetPacketCnt(), 0u);
EXPECT_NE(pattern_inspector.GetByteCnt(), 0ull);
EXPECT_NE(pattern_generator.GetCycleCnt(), 0u);
EXPECT_NE(pattern_generator.GetPacketCnt(), 0u);
EXPECT_NE(pattern_generator.GetByteCnt(), 0ull);
EXPECT_NE(pattern_inspector.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_inspector.GetErrorCnt(), 0u);
EXPECT_NE(pattern_inspector.GetPacketCnt(), 0u);
EXPECT_NE(pattern_inspector.GetByteCnt(), 0ull);
}
TEST(InProcessMemoryBufferTest, SendDelayedReceivePattern)
@@ -512,33 +512,33 @@ TEST(InProcessMemoryBufferTest, SendDelayedReceivePattern)
ASSERT_TRUE(appcontrol.Startup(""));
CInProcMemBufferTx sender;
EXPECT_TRUE(sender.IsValid());
EXPECT_TRUE(sender.IsValid());
CInProcMemBufferRx receiver(sender.GetConnectionString());
EXPECT_TRUE(receiver.IsValid());
CInProcMemBufferRx receiver(sender.GetConnectionString());
EXPECT_TRUE(receiver.IsValid());
CPatternReceiver pattern_inspector(receiver, 10);
CPatternSender pattern_generator(sender);
CPatternReceiver pattern_inspector(receiver, 10);
CPatternSender pattern_generator(sender);
// Wait for 2 seconds
std::this_thread::sleep_for(std::chrono::seconds(PATTERN_TEST_TIME_S));
// Wait for 2 seconds
std::this_thread::sleep_for(std::chrono::seconds(PATTERN_TEST_TIME_S));
// Shutdown
pattern_generator.Shutdown();
pattern_inspector.Shutdown();
// Shutdown
pattern_generator.Shutdown();
pattern_inspector.Shutdown();
std::cout << "Pattern generator: " << pattern_generator.GetCycleCnt() << " cyles, " << pattern_generator.GetPacketCnt()
<< " packets, " << pattern_generator.GetByteCnt() << " bytes" << std::endl;
std::cout << "Pattern inspector: " << pattern_inspector.GetCycleCnt() << " cyles, " << pattern_inspector.GetPacketCnt()
<< " packets, " << pattern_generator.GetByteCnt() << " bytes" << std::endl;
std::cout << "Pattern inspector: " << pattern_inspector.GetCycleCnt() << " cyles, " << pattern_inspector.GetPacketCnt()
<< " packets, " << pattern_inspector.GetByteCnt() << " bytes, " << pattern_inspector.GetErrorCnt()
<< " errors, " << std::endl;
EXPECT_NE(pattern_generator.GetCycleCnt(), 0u);
EXPECT_NE(pattern_generator.GetPacketCnt(), 0u);
EXPECT_NE(pattern_generator.GetByteCnt(), 0ull);
EXPECT_NE(pattern_inspector.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_inspector.GetErrorCnt(), 0u);
EXPECT_NE(pattern_inspector.GetPacketCnt(), 0u);
EXPECT_NE(pattern_inspector.GetByteCnt(), 0ull);
EXPECT_NE(pattern_generator.GetCycleCnt(), 0u);
EXPECT_NE(pattern_generator.GetPacketCnt(), 0u);
EXPECT_NE(pattern_generator.GetByteCnt(), 0ull);
EXPECT_NE(pattern_inspector.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_inspector.GetErrorCnt(), 0u);
EXPECT_NE(pattern_inspector.GetPacketCnt(), 0u);
EXPECT_NE(pattern_inspector.GetByteCnt(), 0ull);
}
TEST(InProcessMemoryBufferTest, SendRepeatReceivePattern)
@@ -547,50 +547,50 @@ TEST(InProcessMemoryBufferTest, SendRepeatReceivePattern)
ASSERT_TRUE(appcontrol.Startup(""));
// The first process creates a sender and receiver
CInProcMemBufferTx bufferTX;
EXPECT_TRUE(bufferTX.IsValid());
CInProcMemBufferRx bufferRX;
EXPECT_TRUE(bufferRX.IsValid());
CInProcMemBufferTx bufferTX;
EXPECT_TRUE(bufferTX.IsValid());
CInProcMemBufferRx bufferRX;
EXPECT_TRUE(bufferRX.IsValid());
// The connection string containing the RX and TX strings for the repeater
std::string ssConnectionString = bufferTX.GetConnectionString() + "\n" + bufferRX.GetConnectionString();
// The repeater process creates a receiver and sender
CInProcMemBufferRx bufferRepeaterRX(ssConnectionString);
EXPECT_TRUE(bufferRepeaterRX.IsValid());
CInProcMemBufferTx bufferRepeaterTX(ssConnectionString);
EXPECT_TRUE(bufferRepeaterTX.IsValid());
CInProcMemBufferRx bufferRepeaterRX(ssConnectionString);
EXPECT_TRUE(bufferRepeaterRX.IsValid());
CInProcMemBufferTx bufferRepeaterTX(ssConnectionString);
EXPECT_TRUE(bufferRepeaterTX.IsValid());
// Connect the pattern generator and inspector
CPatternReceiver pattern_inspector(bufferRX);
CPatternRepeater pattern_repeater(bufferRepeaterRX, bufferRepeaterTX);
CPatternSender pattern_generator(bufferTX);
CPatternRepeater pattern_repeater(bufferRepeaterRX, bufferRepeaterTX);
CPatternSender pattern_generator(bufferTX);
// Wait for 2 seconds
std::this_thread::sleep_for(std::chrono::seconds(PATTERN_TEST_TIME_S));
// Wait for 2 seconds
std::this_thread::sleep_for(std::chrono::seconds(PATTERN_TEST_TIME_S));
// Shutdown
pattern_generator.Shutdown();
pattern_repeater.Shutdown();
pattern_inspector.Shutdown();
// Shutdown
pattern_generator.Shutdown();
pattern_repeater.Shutdown();
pattern_inspector.Shutdown();
std::cout << "Pattern generator: " << pattern_generator.GetCycleCnt() << " cyles, " << pattern_generator.GetPacketCnt()
<< " packets, " << pattern_generator.GetByteCnt() << " bytes" << std::endl;
std::cout << "Pattern inspector: " << pattern_inspector.GetCycleCnt() << " cyles, " << pattern_inspector.GetPacketCnt()
<< " packets, " << pattern_generator.GetByteCnt() << " bytes" << std::endl;
std::cout << "Pattern inspector: " << pattern_inspector.GetCycleCnt() << " cyles, " << pattern_inspector.GetPacketCnt()
<< " packets, " << pattern_inspector.GetByteCnt() << " bytes, " << pattern_inspector.GetErrorCnt()
<< " errors, " << std::endl;
std::cout << "Pattern repeater: " << pattern_repeater.GetCycleCnt() << " cyles, " << pattern_repeater.GetPacketCnt()
std::cout << "Pattern repeater: " << pattern_repeater.GetCycleCnt() << " cyles, " << pattern_repeater.GetPacketCnt()
<< " packets, " << pattern_repeater.GetByteCnt() << " bytes, " << pattern_repeater.GetErrorCnt()
<< " errors, " << std::endl;
EXPECT_NE(pattern_generator.GetCycleCnt(), 0u);
EXPECT_NE(pattern_generator.GetPacketCnt(), 0u);
EXPECT_NE(pattern_generator.GetByteCnt(), 0ull);
EXPECT_NE(pattern_inspector.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_inspector.GetErrorCnt(), 0u);
EXPECT_NE(pattern_inspector.GetPacketCnt(), 0u);
EXPECT_NE(pattern_inspector.GetByteCnt(), 0ull);
EXPECT_NE(pattern_repeater.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_repeater.GetErrorCnt(), 0u);
EXPECT_NE(pattern_repeater.GetPacketCnt(), 0u);
EXPECT_NE(pattern_repeater.GetByteCnt(), 0ull);
EXPECT_NE(pattern_generator.GetCycleCnt(), 0u);
EXPECT_NE(pattern_generator.GetPacketCnt(), 0u);
EXPECT_NE(pattern_generator.GetByteCnt(), 0ull);
EXPECT_NE(pattern_inspector.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_inspector.GetErrorCnt(), 0u);
EXPECT_NE(pattern_inspector.GetPacketCnt(), 0u);
EXPECT_NE(pattern_inspector.GetByteCnt(), 0ull);
EXPECT_NE(pattern_repeater.GetCycleCnt(), 0u);
EXPECT_EQ(pattern_repeater.GetErrorCnt(), 0u);
EXPECT_NE(pattern_repeater.GetPacketCnt(), 0u);
EXPECT_NE(pattern_repeater.GetByteCnt(), 0ull);
}

View File

@@ -24,7 +24,7 @@ CPatternSender::CPatternSender(CMemBufferAccessorTx& raccessorOut, uint32_t uiDe
m_raccessorOut(raccessorOut), m_uiDelayMs(uiDelayMs)
{
// Start the thread
m_thread = std::thread(&CPatternSender::Process, this);
m_thread = sdv::core::secure_thread(&CPatternSender::Process, this);
// Wait for the thread to run
while (!m_bStarted) std::this_thread::sleep_for(std::chrono::milliseconds(1));
@@ -67,7 +67,7 @@ CPatternReceiver::CPatternReceiver(CMemBufferAccessorRx& raccessorIn, uint32_t u
m_raccessorIn(raccessorIn),m_uiDelayMs(uiDelayMs)
{
// Start the thread
m_thread = std::thread(& CPatternReceiver::Process, this);
m_thread = sdv::core::secure_thread(& CPatternReceiver::Process, this);
// Wait for the thread to run
while (!m_bStarted) std::this_thread::sleep_for(std::chrono::milliseconds(1));
@@ -123,7 +123,7 @@ CPatternRepeater::CPatternRepeater(CMemBufferAccessorRx& raccessorIn, CMemBuffer
m_raccessorIn(raccessorIn), m_raccessorOut(raccessorOut), m_uiDelayMs(uiDelayMs)
{
// Start the thread
m_thread = std::thread(&CPatternRepeater::Process, this);
m_thread = sdv::core::secure_thread(&CPatternRepeater::Process, this);
// Wait for the thread to run
while (!m_bStarted) std::this_thread::sleep_for(std::chrono::milliseconds(1));

View File

@@ -16,6 +16,7 @@
#include <thread>
#include <atomic>
#include <support/local_service_access.h>
#include "../../../sdv_services/ipc_shared_mem/mem_buffer_accessor.h"
/**
@@ -55,14 +56,14 @@ public:
*/
private:
CMemBufferAccessorTx& m_raccessorOut; //!< Reference to the output accessor
std::thread m_thread; //!< Processing thread
std::atomic_bool m_bStarted = false; //!< Set by the thread when started.
std::atomic_bool m_bShutdown = false; //!< When set, shutdown the thread.
uint32_t m_uiDelayMs = 0u; //!< Delay (in ms) to insert while processing.
uint32_t m_uiCycleCnt = 0u; //!< Amount of packets
uint32_t m_uiPacketCnt = 0u; //!< Amount of packets
uint64_t m_uiByteCnt = 0ull; //!< Amount of bytes
CMemBufferAccessorTx& m_raccessorOut; //!< Reference to the output accessor
sdv::core::secure_thread m_thread; //!< Processing thread
std::atomic_bool m_bStarted = false; //!< Set by the thread when started.
std::atomic_bool m_bShutdown = false; //!< When set, shutdown the thread.
uint32_t m_uiDelayMs = 0u; //!< Delay (in ms) to insert while processing.
uint32_t m_uiCycleCnt = 0u; //!< Amount of packets
uint32_t m_uiPacketCnt = 0u; //!< Amount of packets
uint64_t m_uiByteCnt = 0ull; //!< Amount of bytes
};
class CPatternReceiver
@@ -98,15 +99,15 @@ public:
*/
private:
CMemBufferAccessorRx& m_raccessorIn; //!< Reference to the input accessor
std::thread m_thread; //!< Processing thread
CMemBufferAccessorRx& m_raccessorIn; //!< Reference to the input accessor
sdv::core::secure_thread m_thread; //!< Processing thread
bool m_bStarted = false; //!< Set by the thread when started.
bool m_bShutdown = false; //!< When set, shutdown the thread.
uint32_t m_uiDelayMs = 0u; //!< Delay (in ms) to insert while processing.
uint32_t m_uiCycleCnt = 0u; //!< Amount of packets
uint32_t m_uiErrorCnt = 0u; //!< Amount of counter errors
uint32_t m_uiPacketCnt = 0u; //!< Amount of packets
uint64_t m_uiByteCnt = 0ull; //!< Amount of bytes
uint32_t m_uiDelayMs = 0u; //!< Delay (in ms) to insert while processing.
uint32_t m_uiCycleCnt = 0u; //!< Amount of packets
uint32_t m_uiErrorCnt = 0u; //!< Amount of counter errors
uint32_t m_uiPacketCnt = 0u; //!< Amount of packets
uint64_t m_uiByteCnt = 0ull; //!< Amount of bytes
};
class CPatternRepeater
@@ -143,16 +144,16 @@ public:
*/
private:
CMemBufferAccessorRx& m_raccessorIn; //!< Reference to the input accessor
CMemBufferAccessorTx& m_raccessorOut; //!< Reference to the output accessor
std::thread m_thread; //!< Processing thread
bool m_bStarted = false; //!< Set by the thread when started.
bool m_bShutdown = false; //!< When set, shutdown the thread.
uint32_t m_uiDelayMs = 0u; //!< Delay (in ms) to insert while processing.
uint32_t m_uiCycleCnt = 0u; //!< Amount of packets
uint32_t m_uiErrorCnt = 0u; //!< Amount of counter errors
uint32_t m_uiPacketCnt = 0u; //!< Amount of packets
uint64_t m_uiByteCnt = 0ull; //!< Amount of bytes
CMemBufferAccessorRx& m_raccessorIn; //!< Reference to the input accessor
CMemBufferAccessorTx& m_raccessorOut; //!< Reference to the output accessor
sdv::core::secure_thread m_thread; //!< Processing thread
bool m_bStarted = false; //!< Set by the thread when started.
bool m_bShutdown = false; //!< When set, shutdown the thread.
uint32_t m_uiDelayMs = 0u; //!< Delay (in ms) to insert while processing.
uint32_t m_uiCycleCnt = 0u; //!< Amount of packets
uint32_t m_uiErrorCnt = 0u; //!< Amount of counter errors
uint32_t m_uiPacketCnt = 0u; //!< Amount of packets
uint64_t m_uiByteCnt = 0ull; //!< Amount of bytes
};
#endif // !defined(PATTERN_GEN_H)

View File

@@ -88,7 +88,7 @@ TEST(SharedMemoryBufferTest, TriggerTestRx)
};
std::unique_lock<std::mutex> lockStart(mtxStart);
std::thread thread(fnWaitForTrigger);
sdv::core::secure_thread thread(fnWaitForTrigger);
cvStart.wait(lockStart);
for (size_t n = 0; n < 20; n++)
@@ -141,7 +141,7 @@ TEST(SharedMemoryBufferTest, TriggerTestTx)
};
std::unique_lock<std::mutex> lockStart(mtxStart);
std::thread thread(fnWaitForTrigger);
sdv::core::secure_thread thread(fnWaitForTrigger);
cvStart.wait(lockStart);
for (size_t n = 0; n < 20; n++)
@@ -208,8 +208,8 @@ TEST(SharedMemoryBufferTest, TriggerTestRxTx)
std::unique_lock<std::mutex> lockStartSender(mtxSenderStart);
std::unique_lock<std::mutex> lockStartReceiver(mtxReceiverStart);
std::thread threadSender(fnWaitForTriggerSender);
std::thread threadReceiver(fnWaitForTriggerReceiver);
sdv::core::secure_thread threadSender(fnWaitForTriggerSender);
sdv::core::secure_thread threadReceiver(fnWaitForTriggerReceiver);
cvSenderStart.wait(lockStartSender);
lockStartSender.unlock();
cvReceiverStart.wait(lockStartReceiver);
@@ -693,8 +693,8 @@ TEST(SharedMemoryBufferTest, SendRepeatReceivePattern)
TEST(SharedMemoryBufferTest, AppProcessSendRepeatReceivePattern)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code([Application]
Mode = "Essential")code"));
ASSERT_TRUE(appcontrol.Startup(R"toml([Application]
Mode = "Essential")toml"));
LoadSupportServices();
CSharedMemBufferTx bufferTX;
@@ -747,8 +747,8 @@ Mode = "Essential")code"));
TEST(SharedMemoryBufferTest, SendRepeatReceivePatternBetweenTwoAppProcesses)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code([Application]
Mode = "Essential")code"));
ASSERT_TRUE(appcontrol.Startup(R"toml([Application]
Mode = "Essential")toml"));
LoadSupportServices();
// test starts 2 app processes, one should be the sender of the pattern, the other is the repeater

View File

@@ -81,7 +81,7 @@ public:
// Start the processing thread if needed
if (!m_threadDecoupledSend.joinable()) m_threadDecoupledSend =
std::thread(&CConnectReceiver::DecoupledSendThread, this);
sdv::core::secure_thread(&CConnectReceiver::DecoupledSendThread, this);
// Store data into the queue for sending.
m_queueDecoupledSend.push(std::move(seqData));
@@ -186,7 +186,7 @@ private:
bool m_bConnectError = false; ///< Connection error ocurred.
bool m_bCommError = false; ///< Communication error occurred.
bool m_bForcedDisconnect = false; ///< Force disconnect.
std::thread m_threadDecoupledSend; ///< Decoupled send thread.
sdv::core::secure_thread m_threadDecoupledSend; ///< Decoupled send thread.
std::queue<sdv::sequence<sdv::pointer<uint8_t>>> m_queueDecoupledSend; ///< Data queue for sending.
std::condition_variable m_cvDecoupledSend; ///< Trigger decoupled sending.
std::atomic_bool m_bShutdown = false; ///< Shutdown send thread.
@@ -203,7 +203,7 @@ TEST(SharedMemChannelService, Instantiate)
ASSERT_TRUE(appcontrol.Startup(""));
CSharedMemChannelMgnt mgnt;
EXPECT_NO_THROW(mgnt.Initialize(""));
EXPECT_NO_THROW(mgnt.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
@@ -220,7 +220,7 @@ TEST(SharedMemChannelService, ChannelConfigString)
ASSERT_TRUE(appcontrol.Startup(""));
CSharedMemChannelMgnt mgnt;
EXPECT_NO_THROW(mgnt.Initialize(""));
EXPECT_NO_THROW(mgnt.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
@@ -237,7 +237,7 @@ TEST(SharedMemChannelService, CreateRandomEndpoint)
CSharedMemChannelMgnt mgnt;
// Create an endpoint.
EXPECT_NO_THROW(mgnt.Initialize(""));
EXPECT_NO_THROW(mgnt.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgnt.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -256,12 +256,12 @@ TEST(SharedMemChannelService, CreateExplicitEndpoint)
CSharedMemChannelMgnt mgnt;
// Create an endpoint.
EXPECT_NO_THROW(mgnt.Initialize(""));
EXPECT_NO_THROW(mgnt.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgnt.CreateEndpoint(R"code([IpcChannel]
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgnt.CreateEndpoint(R"toml([IpcChannel]
Name = "CHANNEL_1234"
Size = 10240
)code");
)toml");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
if (sChannelEndpoint.pConnection) sdv::TObjectPtr(sChannelEndpoint.pConnection);
@@ -278,9 +278,9 @@ TEST(SharedMemChannelService, GetRandomEndpointAccess)
CSharedMemChannelMgnt mgntServer, mgntClient;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
EXPECT_NO_THROW(mgntClient.Initialize(""));
EXPECT_NO_THROW(mgntClient.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -306,14 +306,14 @@ TEST(SharedMemChannelService, GetExplicitEndpointAccess)
CSharedMemChannelMgnt mgntServer, mgntClient;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
EXPECT_NO_THROW(mgntClient.Initialize(""));
EXPECT_NO_THROW(mgntClient.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code([IpcChannel]
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"toml([IpcChannel]
Name = "CHANNEL_1234"
Size = 10240
)code");
)toml");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
@@ -337,7 +337,7 @@ TEST(SharedMemChannelService, WaitForConnection)
CSharedMemChannelMgnt mgnt;
// Create an endpoint.
EXPECT_NO_THROW(mgnt.Initialize(""));
EXPECT_NO_THROW(mgnt.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgnt.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -359,7 +359,7 @@ TEST(SharedMemChannelService, WaitForConnection)
pConnection->GetConnectState() == sdv::ipc::EConnectState::connecting);
// Wait for connection for infinite period with cancel.
std::thread threadCancelWait([&]()
sdv::core::secure_thread threadCancelWait([&]()
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pConnection->CancelWait();
@@ -384,9 +384,9 @@ TEST(SharedMemChannelService, AsyncConnect)
CSharedMemChannelMgnt mgntServer, mgntClient;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
EXPECT_NO_THROW(mgntClient.Initialize(""));
EXPECT_NO_THROW(mgntClient.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -481,9 +481,9 @@ TEST(SharedMemChannelService, EstablishConnectionEvents)
CSharedMemChannelMgnt mgntServer, mgntClient;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
EXPECT_NO_THROW(mgntClient.Initialize(""));
EXPECT_NO_THROW(mgntClient.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -597,11 +597,11 @@ TEST(SharedMemChannelService, EstablishReconnect)
CSharedMemChannelMgnt mgntServer, mgntClient1, mgntClient2;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
EXPECT_NO_THROW(mgntClient1.Initialize(""));
EXPECT_NO_THROW(mgntClient1.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntClient1.GetObjectState(), sdv::EObjectState::initialized);
EXPECT_NO_THROW(mgntClient2.Initialize(""));
EXPECT_NO_THROW(mgntClient2.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntClient2.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -680,11 +680,11 @@ TEST(SharedMemChannelService, EstablishReconnectEvents)
CSharedMemChannelMgnt mgntServer, mgntClient1, mgntClient2;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
EXPECT_NO_THROW(mgntClient1.Initialize(""));
EXPECT_NO_THROW(mgntClient1.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntClient1.GetObjectState(), sdv::EObjectState::initialized);
EXPECT_NO_THROW(mgntClient2.Initialize(""));
EXPECT_NO_THROW(mgntClient2.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntClient2.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -779,14 +779,14 @@ TEST(SharedMemChannelService, EstablishReconnectEvents)
TEST(SharedMemChannelService, AppEstablishConnection)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code([Application]
Mode = "Essential")code"));
ASSERT_TRUE(appcontrol.Startup(R"toml([Application]
Mode = "Essential")toml"));
LoadSupportServices();
CSharedMemChannelMgnt mgntServer;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -860,14 +860,14 @@ Mode = "Essential")code"));
TEST(SharedMemChannelService, AppGracefullyShutdown)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code([Application]
Mode = "Essential")code"));
ASSERT_TRUE(appcontrol.Startup(R"toml([Application]
Mode = "Essential")toml"));
LoadSupportServices();
CSharedMemChannelMgnt mgntServer;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -937,14 +937,14 @@ Mode = "Essential")code"));
TEST(SharedMemChannelService, AppForcedShutdown_Watchdog)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code([Application]
Mode = "Essential")code"));
ASSERT_TRUE(appcontrol.Startup(R"toml([Application]
Mode = "Essential")toml"));
LoadSupportServices();
CSharedMemChannelMgnt mgntServer;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
@@ -1019,8 +1019,8 @@ Mode = "Essential")code"));
TEST(SharedMemChannelService, IndirectAppGracefullyShutdown)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code([Application]
Mode = "Essential")code"));
ASSERT_TRUE(appcontrol.Startup(R"toml([Application]
Mode = "Essential")toml"));
LoadSupportServices();
sdv::process::IProcessControl* pProcessControl = sdv::core::GetObject<sdv::process::IProcessControl>("ProcessControlService");
@@ -1030,7 +1030,7 @@ Mode = "Essential")code"));
// Create the first control endpoint.
CSharedMemChannelMgnt mgntControl1;
EXPECT_NO_THROW(mgntControl1.Initialize(""));
EXPECT_NO_THROW(mgntControl1.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntControl1.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sEndpoint1 = mgntControl1.CreateEndpoint("");
EXPECT_NE(sEndpoint1.pConnection, nullptr);
@@ -1066,7 +1066,7 @@ Mode = "Essential")code"));
// Create the second control endpoint.
CSharedMemChannelMgnt mgntControl2;
EXPECT_NO_THROW(mgntControl2.Initialize(""));
EXPECT_NO_THROW(mgntControl2.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntControl2.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sEndpoint2 = mgntControl2.CreateEndpoint("");
EXPECT_NE(sEndpoint2.pConnection, nullptr);
@@ -1100,8 +1100,8 @@ Mode = "Essential")code"));
TEST(SharedMemChannelService, IndirectAppServerForceShutdown_Watchdog)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code([Application]
Mode = "Essential")code"));
ASSERT_TRUE(appcontrol.Startup(R"toml([Application]
Mode = "Essential")toml"));
LoadSupportServices();
sdv::process::IProcessControl* pProcessControl = sdv::core::GetObject<sdv::process::IProcessControl>("ProcessControlService");
@@ -1113,7 +1113,7 @@ Mode = "Essential")code"));
// Create the first control endpoint.
CSharedMemChannelMgnt mgntControl1;
EXPECT_NO_THROW(mgntControl1.Initialize(""));
EXPECT_NO_THROW(mgntControl1.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntControl1.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sEndpoint1 = mgntControl1.CreateEndpoint("");
EXPECT_NE(sEndpoint1.pConnection, nullptr);
@@ -1149,7 +1149,7 @@ Mode = "Essential")code"));
// Create the second control endpoint.
CSharedMemChannelMgnt mgntControl2;
EXPECT_NO_THROW(mgntControl2.Initialize(""));
EXPECT_NO_THROW(mgntControl2.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntControl2.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sEndpoint2 = mgntControl2.CreateEndpoint("");
EXPECT_NE(sEndpoint2.pConnection, nullptr);
@@ -1183,8 +1183,8 @@ Mode = "Essential")code"));
TEST(SharedMemChannelService, IndirectAppClientForceShutdown_Watchdog)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code([Application]
Mode = "Essential")code"));
ASSERT_TRUE(appcontrol.Startup(R"toml([Application]
Mode = "Essential")toml"));
LoadSupportServices();
sdv::process::IProcessControl* pProcessControl = sdv::core::GetObject<sdv::process::IProcessControl>("ProcessControlService");
@@ -1194,7 +1194,7 @@ Mode = "Essential")code"));
// Create the first control endpoint.
CSharedMemChannelMgnt mgntControl1;
EXPECT_NO_THROW(mgntControl1.Initialize(""));
EXPECT_NO_THROW(mgntControl1.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntControl1.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sEndpoint1 = mgntControl1.CreateEndpoint("");
EXPECT_NE(sEndpoint1.pConnection, nullptr);
@@ -1230,7 +1230,7 @@ Mode = "Essential")code"));
// Create the second control endpoint.
CSharedMemChannelMgnt mgntControl2;
EXPECT_NO_THROW(mgntControl2.Initialize(""));
EXPECT_NO_THROW(mgntControl2.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntControl2.GetObjectState(), sdv::EObjectState::initialized);
sdv::ipc::SChannelEndpoint sEndpoint2 = mgntControl2.CreateEndpoint("");
EXPECT_NE(sEndpoint2.pConnection, nullptr);

View File

@@ -90,7 +90,7 @@ public:
// Start the processing thread if needed
if (!m_threadDecoupledSend.joinable())
m_threadDecoupledSend = std::thread(&CLargeDataReceiver::DecoupledSendThread, this);
m_threadDecoupledSend = sdv::core::secure_thread(&CLargeDataReceiver::DecoupledSendThread, this);
// Store data into the queue for sending.
m_queueDecoupledSend.push(std::move(seqData));
@@ -262,7 +262,7 @@ private:
bool m_bForcedDisconnect = false; ///< Force disconnect.
std::atomic_size_t m_nCount = 0; ///< Receive counter.
std::condition_variable m_cvReceived; ///< Receive event.
std::thread m_threadDecoupledSend; ///< Decoupled send thread.
sdv::core::secure_thread m_threadDecoupledSend; ///< Decoupled send thread.
std::queue<sdv::sequence<sdv::pointer<uint8_t>>> m_queueDecoupledSend; ///< Data queue for sending.
std::condition_variable m_cvDecoupledSend; ///< Trigger decoupled sending.
std::atomic_bool m_bShutdown = false; ///< Shutdown send thread.
@@ -271,27 +271,29 @@ private:
TEST(SharedMemChannelService, CommunicateOneLargeBlock)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code(
ASSERT_TRUE(appcontrol.Startup(R"toml(
[Console]
Report = "Silent"
)code"));
)toml"));
appcontrol.SetConfigMode();
CSharedMemChannelMgnt mgntServer, mgntClient;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
mgntServer.SetOperationMode(sdv::EOperationMode::running);
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
EXPECT_NO_THROW(mgntClient.Initialize("service = \"client\""));
sdv::SObjectInfo sClientInfo{};
sClientInfo.ssConfig = "service = \"client\"";
EXPECT_NO_THROW(mgntClient.Initialize(sClientInfo));
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
mgntClient.SetOperationMode(sdv::EOperationMode::running);
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::running);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"toml(
[IpcChannel]
Size = 1024000
)code");
)toml");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
@@ -376,18 +378,20 @@ TEST(SharedMemChannelService, CommunicateMultiLargeBlock)
CSharedMemChannelMgnt mgntServer, mgntClient;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
mgntServer.SetOperationMode(sdv::EOperationMode::running);
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
EXPECT_NO_THROW(mgntClient.Initialize("service = \"client\""));
sdv::SObjectInfo sClientInfo{};
sClientInfo.ssConfig = "service = \"client\"";
EXPECT_NO_THROW(mgntClient.Initialize(sClientInfo));
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
mgntClient.SetOperationMode(sdv::EOperationMode::running);
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::running);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"toml(
[IpcChannel]
Size = 1024000
)code");
)toml");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
@@ -504,18 +508,20 @@ TEST(SharedMemChannelService, CommunicateFragmentedLargeBlock)
CSharedMemChannelMgnt mgntServer, mgntClient;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
mgntServer.SetOperationMode(sdv::EOperationMode::running);
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
EXPECT_NO_THROW(mgntClient.Initialize("service = \"client\""));
sdv::SObjectInfo sClientInfo{};
sClientInfo.ssConfig = "service = \"client\"";
EXPECT_NO_THROW(mgntClient.Initialize(sClientInfo));
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
mgntClient.SetOperationMode(sdv::EOperationMode::running);
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::running);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"toml(
[IpcChannel]
Size = 1024000
)code");
)toml");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
@@ -614,23 +620,23 @@ Size = 1024000
TEST(SharedMemChannelService, AppCommunicateOneLargeBlock)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code(
ASSERT_TRUE(appcontrol.Startup(R"toml(
[Application]
Mode="Essential")code"));
Mode="Essential")toml"));
LoadSupportServices();
appcontrol.SetConfigMode();
CSharedMemChannelMgnt mgntServer;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
mgntServer.SetOperationMode(sdv::EOperationMode::running);
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"toml(
[IpcChannel]
Size = 1024000
)code");
)toml");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
@@ -698,23 +704,23 @@ Size = 1024000
TEST(SharedMemChannelService, AppCommunicateMultiLargeBlock)
{
sdv::app::CAppControl appcontrol;
ASSERT_TRUE(appcontrol.Startup(R"code(
ASSERT_TRUE(appcontrol.Startup(R"toml(
[Application]
Mode="Essential")code"));
Mode="Essential")toml"));
LoadSupportServices();
appcontrol.SetConfigMode();
CSharedMemChannelMgnt mgntServer;
// Create an endpoint.
EXPECT_NO_THROW(mgntServer.Initialize(""));
EXPECT_NO_THROW(mgntServer.Initialize(sdv::SObjectInfo()));
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
mgntServer.SetOperationMode(sdv::EOperationMode::running);
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"toml(
[IpcChannel]
Size = 1024000
)code");
)toml");
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());