mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-07-02 05:35:11 +00:00
Update sdv_packager (#6)
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
#*******************************************************************************
|
||||
# Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
#
|
||||
# This program and the accompanying materials are made available under the
|
||||
# terms of the Apache License Version 2.0 which is available at
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Contributors:
|
||||
# Erik Verhoeven - initial API and implementation
|
||||
#*******************************************************************************
|
||||
|
||||
# Define project (multiple EXEs)
|
||||
project(CommunicationTests VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
@@ -138,9 +151,9 @@ add_custom_command(TARGET UnitTest_SharedMemLargeDataTests POST_BUILD
|
||||
)
|
||||
|
||||
# Build dependencies
|
||||
add_dependencies(UnitTest_SharedMemTests_App_Repeater core_services)
|
||||
add_dependencies(UnitTest_SharedMemTests_App_Connect core_services)
|
||||
add_dependencies(UnitTest_InprocMemTests core_services)
|
||||
add_dependencies(UnitTest_SharedMemTests_App_Repeater dependency_sdv_components)
|
||||
add_dependencies(UnitTest_SharedMemTests_App_Connect dependency_sdv_components)
|
||||
add_dependencies(UnitTest_InprocMemTests dependency_sdv_components)
|
||||
add_dependencies(UnitTest_SharedMemBufferTests UnitTest_SharedMemTests_App_Repeater)
|
||||
add_dependencies(UnitTest_SharedMemConnectTests UnitTest_SharedMemTests_App_Connect)
|
||||
add_dependencies(UnitTest_SharedMemLargeDataTests UnitTest_SharedMemTests_App_Connect)
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#include <support/mem_access.h>
|
||||
#include <support/app_control.h>
|
||||
#include "../../../global/base64.h"
|
||||
@@ -310,9 +323,9 @@ extern "C" int main(int argc, char* argv[])
|
||||
// Create an control management channel (if required).
|
||||
CSharedMemChannelMgnt mgntControlMgntChannel;
|
||||
mgntControlMgntChannel.Initialize("");
|
||||
if (mgntControlMgntChannel.GetStatus() != sdv::EObjectStatus::initialized) return -11;
|
||||
if (mgntControlMgntChannel.GetObjectState() != sdv::EObjectState::initialized) return -11;
|
||||
mgntControlMgntChannel.SetOperationMode(sdv::EOperationMode::running);
|
||||
if (mgntControlMgntChannel.GetStatus() != sdv::EObjectStatus::running) return -11;
|
||||
if (mgntControlMgntChannel.GetObjectState() != sdv::EObjectState::running) return -11;
|
||||
|
||||
// Open the control channel endpoint
|
||||
sdv::TObjectPtr ptrControlConnection;
|
||||
@@ -337,9 +350,9 @@ extern "C" int main(int argc, char* argv[])
|
||||
// Create the data management channel.
|
||||
CSharedMemChannelMgnt mgntDataMgntChannel;
|
||||
mgntDataMgntChannel.Initialize("");
|
||||
if (mgntDataMgntChannel.GetStatus() != sdv::EObjectStatus::initialized) return -1;
|
||||
if (mgntDataMgntChannel.GetObjectState() != sdv::EObjectState::initialized) return -1;
|
||||
mgntDataMgntChannel.SetOperationMode(sdv::EOperationMode::running);
|
||||
if (mgntDataMgntChannel.GetStatus() != sdv::EObjectStatus::running) return -1;
|
||||
if (mgntDataMgntChannel.GetObjectState() != sdv::EObjectState::running) return -1;
|
||||
|
||||
// If this is a server, create a data endpoint and communicate this endpoint over the control channel.
|
||||
// If not, open the data endpoint.
|
||||
@@ -420,11 +433,11 @@ Size = 1024000
|
||||
if (pDataConnect && uiDataEventCookie) pDataConnect->UnregisterStatusEventCallback(uiDataEventCookie);
|
||||
ptrDataConnection.Clear();
|
||||
mgntDataMgntChannel.Shutdown();
|
||||
if (mgntDataMgntChannel.GetStatus() != sdv::EObjectStatus::destruction_pending) return -6;
|
||||
if (mgntDataMgntChannel.GetObjectState() != sdv::EObjectState::destruction_pending) return -6;
|
||||
if (pControlConnect && uiControlEventCookie) pControlConnect->UnregisterStatusEventCallback(uiControlEventCookie);
|
||||
ptrControlConnection.Clear();
|
||||
mgntControlMgntChannel.Shutdown();
|
||||
if (mgntControlMgntChannel.GetStatus() != sdv::EObjectStatus::destruction_pending) return -16;
|
||||
if (mgntControlMgntChannel.GetObjectState() != sdv::EObjectState::destruction_pending) return -16;
|
||||
|
||||
TRACE("Shutdown of app ", bServer ? "server" : "client", " connect process...");
|
||||
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
// App process providing repeating functionality
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../../sdv_services/ipc_shared_mem/in_process_mem_buffer.h"
|
||||
#include <support/app_control.h>
|
||||
@@ -146,9 +159,6 @@ TEST(InProcessMemoryBufferTest, TriggerTestRxTx)
|
||||
std::unique_lock<std::mutex> lockSender(mtxSenderStart);
|
||||
lockSender.unlock();
|
||||
cvSenderStart.notify_all();
|
||||
std::unique_lock<std::mutex> lockReceiver(mtxReceiverStart);
|
||||
cvReceiverStart.wait(lockReceiver);
|
||||
lockReceiver.unlock();
|
||||
while (!bShutdown)
|
||||
{
|
||||
bool bResult = sender.WaitForFreeSpace(200);
|
||||
@@ -159,11 +169,11 @@ 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);
|
||||
cvSenderStart.wait(lockStartSender);
|
||||
lockStartSender.unlock();
|
||||
std::unique_lock<std::mutex> lockStartReceiver(mtxReceiverStart);
|
||||
std::thread threadReceiver(fnWaitForTriggerReceiver);
|
||||
cvReceiverStart.wait(lockStartReceiver);
|
||||
lockStartReceiver.unlock();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(25)); // Needed for the threads to enter their loop.
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../../global/process_watchdog.h"
|
||||
#define TIME_TRACKING
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef PATTERN_GEN_H
|
||||
#define PATTERN_GEN_H
|
||||
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <atomic>
|
||||
@@ -199,7 +212,6 @@ TEST(SharedMemoryBufferTest, TriggerTestRxTx)
|
||||
std::thread threadReceiver(fnWaitForTriggerReceiver);
|
||||
cvSenderStart.wait(lockStartSender);
|
||||
lockStartSender.unlock();
|
||||
//CHECKPOINT();
|
||||
cvReceiverStart.wait(lockStartReceiver);
|
||||
lockStartReceiver.unlock();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(25)); // Needed for the threads to enter their loop.
|
||||
@@ -211,7 +223,7 @@ TEST(SharedMemoryBufferTest, TriggerTestRxTx)
|
||||
}
|
||||
|
||||
// Let the buffer finish its sending.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
|
||||
bShutdown = true;
|
||||
threadSender.join();
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../../sdv_services/ipc_shared_mem/channel_mgnt.h"
|
||||
#include "../../../sdv_services/ipc_shared_mem/connection.h"
|
||||
@@ -192,11 +205,11 @@ TEST(SharedMemChannelService, Instantiate)
|
||||
CSharedMemChannelMgnt mgnt;
|
||||
EXPECT_NO_THROW(mgnt.Initialize(""));
|
||||
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
|
||||
|
||||
EXPECT_NO_THROW(mgnt.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
|
||||
appcontrol.Shutdown();
|
||||
}
|
||||
@@ -209,11 +222,11 @@ TEST(SharedMemChannelService, ChannelConfigString)
|
||||
CSharedMemChannelMgnt mgnt;
|
||||
EXPECT_NO_THROW(mgnt.Initialize(""));
|
||||
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
|
||||
|
||||
EXPECT_NO_THROW(mgnt.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, CreateRandomEndpoint)
|
||||
@@ -225,14 +238,14 @@ TEST(SharedMemChannelService, CreateRandomEndpoint)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgnt.Initialize(""));
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgnt.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
if (sChannelEndpoint.pConnection) sdv::TObjectPtr(sChannelEndpoint.pConnection);
|
||||
EXPECT_NO_THROW(mgnt.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, CreateExplicitEndpoint)
|
||||
@@ -244,7 +257,7 @@ TEST(SharedMemChannelService, CreateExplicitEndpoint)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgnt.Initialize(""));
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgnt.CreateEndpoint(R"code([IpcChannel]
|
||||
Name = "CHANNEL_1234"
|
||||
Size = 10240
|
||||
@@ -254,7 +267,7 @@ Size = 10240
|
||||
if (sChannelEndpoint.pConnection) sdv::TObjectPtr(sChannelEndpoint.pConnection);
|
||||
EXPECT_NO_THROW(mgnt.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, GetRandomEndpointAccess)
|
||||
@@ -266,9 +279,9 @@ TEST(SharedMemChannelService, GetRandomEndpointAccess)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
EXPECT_NO_THROW(mgntClient.Initialize(""));
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -281,8 +294,8 @@ TEST(SharedMemChannelService, GetRandomEndpointAccess)
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
EXPECT_NO_THROW(mgntClient.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, GetExplicitEndpointAccess)
|
||||
@@ -294,9 +307,9 @@ TEST(SharedMemChannelService, GetExplicitEndpointAccess)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
EXPECT_NO_THROW(mgntClient.Initialize(""));
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code([IpcChannel]
|
||||
Name = "CHANNEL_1234"
|
||||
Size = 10240
|
||||
@@ -312,8 +325,8 @@ Size = 10240
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
EXPECT_NO_THROW(mgntClient.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, WaitForConnection)
|
||||
@@ -325,7 +338,7 @@ TEST(SharedMemChannelService, WaitForConnection)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgnt.Initialize(""));
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgnt.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -360,7 +373,7 @@ TEST(SharedMemChannelService, WaitForConnection)
|
||||
|
||||
EXPECT_NO_THROW(mgnt.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgnt.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgnt.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, AsyncConnect)
|
||||
@@ -372,9 +385,9 @@ TEST(SharedMemChannelService, AsyncConnect)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
EXPECT_NO_THROW(mgntClient.Initialize(""));
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -456,8 +469,8 @@ TEST(SharedMemChannelService, AsyncConnect)
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
EXPECT_NO_THROW(mgntClient.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, EstablishConnectionEvents)
|
||||
@@ -469,9 +482,9 @@ TEST(SharedMemChannelService, EstablishConnectionEvents)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
EXPECT_NO_THROW(mgntClient.Initialize(""));
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -572,8 +585,8 @@ TEST(SharedMemChannelService, EstablishConnectionEvents)
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
EXPECT_NO_THROW(mgntClient.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, EstablishReconnect)
|
||||
@@ -585,11 +598,11 @@ TEST(SharedMemChannelService, EstablishReconnect)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
EXPECT_NO_THROW(mgntClient1.Initialize(""));
|
||||
EXPECT_EQ(mgntClient1.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient1.GetObjectState(), sdv::EObjectState::initialized);
|
||||
EXPECT_NO_THROW(mgntClient2.Initialize(""));
|
||||
EXPECT_EQ(mgntClient2.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient2.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -656,7 +669,7 @@ TEST(SharedMemChannelService, EstablishReconnect)
|
||||
|
||||
EXPECT_NO_THROW(ptrServerConnection.Clear());
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, EstablishReconnectEvents)
|
||||
@@ -668,11 +681,11 @@ TEST(SharedMemChannelService, EstablishReconnectEvents)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
EXPECT_NO_THROW(mgntClient1.Initialize(""));
|
||||
EXPECT_EQ(mgntClient1.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient1.GetObjectState(), sdv::EObjectState::initialized);
|
||||
EXPECT_NO_THROW(mgntClient2.Initialize(""));
|
||||
EXPECT_EQ(mgntClient2.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient2.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -760,7 +773,7 @@ TEST(SharedMemChannelService, EstablishReconnectEvents)
|
||||
|
||||
EXPECT_NO_THROW(ptrServerConnection.Clear());
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, AppEstablishConnection)
|
||||
@@ -774,7 +787,7 @@ Mode = "Essential")code"));
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -838,7 +851,7 @@ Mode = "Essential")code"));
|
||||
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
|
||||
// Wait for process termination
|
||||
pProcessLifetime->WaitForTerminate(tProcessID, 0xffffffff);
|
||||
@@ -855,7 +868,7 @@ Mode = "Essential")code"));
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -918,7 +931,7 @@ Mode = "Essential")code"));
|
||||
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, AppForcedShutdown_Watchdog)
|
||||
@@ -932,7 +945,7 @@ Mode = "Essential")code"));
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint("");
|
||||
EXPECT_NE(sChannelEndpoint.pConnection, nullptr);
|
||||
EXPECT_FALSE(sChannelEndpoint.ssConnectString.empty());
|
||||
@@ -997,7 +1010,7 @@ Mode = "Essential")code"));
|
||||
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
|
||||
// Wait for process termination
|
||||
pProcessLifetime->WaitForTerminate(tProcessID, 0xffffffff);
|
||||
@@ -1018,7 +1031,7 @@ Mode = "Essential")code"));
|
||||
// Create the first control endpoint.
|
||||
CSharedMemChannelMgnt mgntControl1;
|
||||
EXPECT_NO_THROW(mgntControl1.Initialize(""));
|
||||
EXPECT_EQ(mgntControl1.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntControl1.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sEndpoint1 = mgntControl1.CreateEndpoint("");
|
||||
EXPECT_NE(sEndpoint1.pConnection, nullptr);
|
||||
EXPECT_FALSE(sEndpoint1.ssConnectString.empty());
|
||||
@@ -1054,7 +1067,7 @@ Mode = "Essential")code"));
|
||||
// Create the second control endpoint.
|
||||
CSharedMemChannelMgnt mgntControl2;
|
||||
EXPECT_NO_THROW(mgntControl2.Initialize(""));
|
||||
EXPECT_EQ(mgntControl2.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntControl2.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sEndpoint2 = mgntControl2.CreateEndpoint("");
|
||||
EXPECT_NE(sEndpoint2.pConnection, nullptr);
|
||||
EXPECT_FALSE(sEndpoint2.ssConnectString.empty());
|
||||
@@ -1101,7 +1114,7 @@ Mode = "Essential")code"));
|
||||
// Create the first control endpoint.
|
||||
CSharedMemChannelMgnt mgntControl1;
|
||||
EXPECT_NO_THROW(mgntControl1.Initialize(""));
|
||||
EXPECT_EQ(mgntControl1.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntControl1.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sEndpoint1 = mgntControl1.CreateEndpoint("");
|
||||
EXPECT_NE(sEndpoint1.pConnection, nullptr);
|
||||
EXPECT_FALSE(sEndpoint1.ssConnectString.empty());
|
||||
@@ -1137,7 +1150,7 @@ Mode = "Essential")code"));
|
||||
// Create the second control endpoint.
|
||||
CSharedMemChannelMgnt mgntControl2;
|
||||
EXPECT_NO_THROW(mgntControl2.Initialize(""));
|
||||
EXPECT_EQ(mgntControl2.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntControl2.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sEndpoint2 = mgntControl2.CreateEndpoint("");
|
||||
EXPECT_NE(sEndpoint2.pConnection, nullptr);
|
||||
EXPECT_FALSE(sEndpoint2.ssConnectString.empty());
|
||||
@@ -1182,7 +1195,7 @@ Mode = "Essential")code"));
|
||||
// Create the first control endpoint.
|
||||
CSharedMemChannelMgnt mgntControl1;
|
||||
EXPECT_NO_THROW(mgntControl1.Initialize(""));
|
||||
EXPECT_EQ(mgntControl1.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntControl1.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sEndpoint1 = mgntControl1.CreateEndpoint("");
|
||||
EXPECT_NE(sEndpoint1.pConnection, nullptr);
|
||||
EXPECT_FALSE(sEndpoint1.ssConnectString.empty());
|
||||
@@ -1218,7 +1231,7 @@ Mode = "Essential")code"));
|
||||
// Create the second control endpoint.
|
||||
CSharedMemChannelMgnt mgntControl2;
|
||||
EXPECT_NO_THROW(mgntControl2.Initialize(""));
|
||||
EXPECT_EQ(mgntControl2.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntControl2.GetObjectState(), sdv::EObjectState::initialized);
|
||||
sdv::ipc::SChannelEndpoint sEndpoint2 = mgntControl2.CreateEndpoint("");
|
||||
EXPECT_NE(sEndpoint2.pConnection, nullptr);
|
||||
EXPECT_FALSE(sEndpoint2.ssConnectString.empty());
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#define TIME_TRACKING
|
||||
#include "../../../sdv_services/ipc_shared_mem/channel_mgnt.h"
|
||||
@@ -268,13 +281,13 @@ Report = "Silent"
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
mgntServer.SetOperationMode(sdv::EOperationMode::running);
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::running);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
|
||||
EXPECT_NO_THROW(mgntClient.Initialize("service = \"client\""));
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
|
||||
mgntClient.SetOperationMode(sdv::EOperationMode::running);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::running);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::running);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
|
||||
[IpcChannel]
|
||||
Size = 1024000
|
||||
@@ -350,8 +363,8 @@ Size = 1024000
|
||||
|
||||
EXPECT_NO_THROW(mgntClient.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, CommunicateMultiLargeBlock)
|
||||
@@ -364,13 +377,13 @@ TEST(SharedMemChannelService, CommunicateMultiLargeBlock)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
mgntServer.SetOperationMode(sdv::EOperationMode::running);
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::running);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
|
||||
EXPECT_NO_THROW(mgntClient.Initialize("service = \"client\""));
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
|
||||
mgntClient.SetOperationMode(sdv::EOperationMode::running);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::running);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::running);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
|
||||
[IpcChannel]
|
||||
Size = 1024000
|
||||
@@ -478,8 +491,8 @@ Size = 1024000
|
||||
|
||||
EXPECT_NO_THROW(mgntClient.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, CommunicateFragmentedLargeBlock)
|
||||
@@ -492,13 +505,13 @@ TEST(SharedMemChannelService, CommunicateFragmentedLargeBlock)
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
mgntServer.SetOperationMode(sdv::EOperationMode::running);
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::running);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
|
||||
EXPECT_NO_THROW(mgntClient.Initialize("service = \"client\""));
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::initialized);
|
||||
mgntClient.SetOperationMode(sdv::EOperationMode::running);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::running);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::running);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
|
||||
[IpcChannel]
|
||||
Size = 1024000
|
||||
@@ -594,8 +607,8 @@ Size = 1024000
|
||||
|
||||
EXPECT_NO_THROW(mgntClient.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
EXPECT_EQ(mgntClient.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
}
|
||||
|
||||
TEST(SharedMemChannelService, AppCommunicateOneLargeBlock)
|
||||
@@ -611,9 +624,9 @@ Mode="Essential")code"));
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
mgntServer.SetOperationMode(sdv::EOperationMode::running);
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::running);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
|
||||
[IpcChannel]
|
||||
Size = 1024000
|
||||
@@ -676,7 +689,7 @@ Size = 1024000
|
||||
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
|
||||
// Wait for process termination
|
||||
pProcessLifetime->WaitForTerminate(tProcessID, 0xffffffff);
|
||||
@@ -695,9 +708,9 @@ Mode="Essential")code"));
|
||||
|
||||
// Create an endpoint.
|
||||
EXPECT_NO_THROW(mgntServer.Initialize(""));
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::initialized);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::initialized);
|
||||
mgntServer.SetOperationMode(sdv::EOperationMode::running);
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::running);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::running);
|
||||
sdv::ipc::SChannelEndpoint sChannelEndpoint = mgntServer.CreateEndpoint(R"code(
|
||||
[IpcChannel]
|
||||
Size = 1024000
|
||||
@@ -788,7 +801,7 @@ Size = 1024000
|
||||
|
||||
EXPECT_NO_THROW(mgntServer.Shutdown());
|
||||
|
||||
EXPECT_EQ(mgntServer.GetStatus(), sdv::EObjectStatus::destruction_pending);
|
||||
EXPECT_EQ(mgntServer.GetObjectState(), sdv::EObjectState::destruction_pending);
|
||||
|
||||
// Wait for process termination
|
||||
pProcessLifetime->WaitForTerminate(tProcessID, 0xffffffff);
|
||||
|
||||
Reference in New Issue
Block a user