Adds ktexttemplate as apt package to new_docker_build.sh and builds successfully

This commit is contained in:
torsten committed 2026-09-21 15:43:39 +02:00
1 parent 9e38583785
commit 7cd3e43959
39 files changed
+647 -208

No files matched your search

@@ -4,7 +4,19 @@
# $Author$
#
IF(BUILD_TESTING AND BUILD_RTI AND TARGET ddsgen AND TARGET ddsdtc AND TARGET ddsfts AND TARGET ddsQoS)
# Check for required targets - use simpler condition for INTERFACE library compatibility
IF(BUILD_TESTING AND BUILD_RTI)
# Verify required targets exist
SET(_required_targets ddsgen ddsdtc ddsfts ddsQoS)
SET(_targets_found TRUE)
FOREACH(_tgt ${_required_targets})
IF(NOT TARGET ${_tgt})
SET(_targets_found FALSE)
MESSAGE(WARNING "Required target ${_tgt} not found - DDS unit tests will not be built")
ENDIF()
ENDFOREACH()
IF(_targets_found)
SET(xml_FILE ddsut.xml)
@@ -106,6 +118,10 @@ TARGET_LINK_LIBRARIES(ddsGenericDataTests
Qt6::Test
ddsut_common
)
TARGET_INCLUDE_DIRECTORIES(ddsGenericDataTests PRIVATE
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/Lts/DDS
)
ADD_TEST(NAME ddsGenericDataTests COMMAND $<TARGET_FILE:ddsGenericDataTests>)
# Testing DataTopic Functionality (DTS/DTC)
@@ -123,6 +139,11 @@ TARGET_LINK_LIBRARIES(ddsDataTopicTests
Qt6::Test
ddsut_common
)
TARGET_INCLUDE_DIRECTORIES(ddsDataTopicTests PRIVATE
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/Lts
${CMAKE_SOURCE_DIR}/Lts/DDS
)
ADD_TEST(NAME ddsDataTopicTests COMMAND $<TARGET_FILE:ddsDataTopicTests>)
# Testing FunctionTopic Functionality (FTS/FTC)
@@ -140,8 +161,15 @@ TARGET_LINK_LIBRARIES(ddsFunctionTopicTests
Qt6::Test
ddsut_common
)
TARGET_INCLUDE_DIRECTORIES(ddsFunctionTopicTests PRIVATE
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/Lts
${CMAKE_SOURCE_DIR}/Lts/DDS
)
ADD_TEST(NAME ddsFunctionTopicTests COMMAND $<TARGET_FILE:ddsFunctionTopicTests>)
ENDIF() # _targets_found
IF(NOT BUILD_RPM)
NGL_INSTALL(AAR SV TARGETS ddsut_common DESTINATION bin/test)
NGL_INSTALL(AAR SV TARGETS ddsGenericDataTests DESTINATION bin/test)
@@ -11,18 +11,18 @@
#include <QtCore/QVariant>
#include <QtTest/QTest>
DataTopicTests::DataTopicTests() : m_domainParticipantPub(nullptr)
, m_domainParticipantSub(nullptr)
, m_domainId(0)
, m_partitionId(1)
, m_ddsPublisher(nullptr)
, m_testPart(nullptr)
, m_ddsSubscriber(nullptr)
, m_subscriberListener(nullptr)
, m_dtcTestPart(nullptr)
, m_mainThreadId(QThread::currentThreadId())
.getNGLLogger("UnitTests.DataTopicTests")),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
DataTopicTests::DataTopicTests()
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("UnitTests.DataTopicTests"))
, m_domainParticipantPub(nullptr)
, m_domainParticipantSub(nullptr)
, m_domainId(0)
, m_partitionId(1)
, m_ddsPublisher(nullptr)
, m_testPart(nullptr)
, m_ddsSubscriber(nullptr)
, m_subscriberListener(nullptr)
, m_dtcTestPart(nullptr)
, m_mainThreadId(QThread::currentThreadId())
{
if (!DDS::QosProfile::setDefault())
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
@@ -63,8 +63,8 @@ bool DataTopicTests::initPublisher()
bool DataTopicTests::write(const DdsUnitTests::TestParticipant& data)
{
INFO_LOG(m_logger) << "Publish topic TestParticipant ";
DEBUG_LOG(m_logger) << "ParticipantId: " << data.location().participantId()
<< ", equipNo = " << data.location().equipNo();
DEBUG_LOG(m_logger) << "ParticipantId: " << data.location.participantId
<< ", equipNo = " << data.location.equipNo;
return m_testPart->write(data);
}
@@ -119,8 +119,8 @@ void DataTopicTests::processData(const DdsUnitTests::TestParticipant& instance,
{
INFO_LOG(m_logger) << "process data in topic TestParticipant, Sampleinfo: " << si.source_timestamp().sec();
DEBUG_LOG(m_logger) << "participantId: " << instance.location().participantId();
DEBUG_LOG(m_logger) << "equipNo: " << instance.location().equipNo();
DEBUG_LOG(m_logger) << "participantId: " << instance.location.participantId;
DEBUG_LOG(m_logger) << "equipNo: " << instance.location.equipNo;
m_receivedParticipantData = instance;
@@ -6,6 +6,8 @@
#include <DdsUnitTests/ddsut_dtc_types.h>
#include <DdsUnitTests/ddsut_dts_types.h>
#include <QtCore/QObject>
#include <dds/pub/Publisher.hpp>
#include <dds/sub/Subscriber.hpp>
namespace NGL
{
@@ -44,9 +44,9 @@ void DataTopicTestsMain::publishTestCase()
{
DEBUG_LOG(m_logger) << "DataTopicTestsMain: publish TestParticipant";
m_sentParticipantData.location().participantId(100);
m_sentParticipantData.location().equipNo(1010);
m_sentParticipantData.testId(100);
m_sentParticipantData.location.participantId = 100;
m_sentParticipantData.location.equipNo = 1010;
m_sentParticipantData.testId = 100;
QVERIFY2(m_dtTest->write(m_sentParticipantData), "Publishing Topic TestParticipant failed");
DEBUG_LOG(m_logger) << "DataTopicTestsMain: publish ready";
@@ -60,8 +60,8 @@ void DataTopicTestsMain::subscribeTestCase()
DdsUnitTests::TestParticipant recvPartiticpant = m_dtTest->getReceivedParticipantData();
QCOMPARE(recvPartiticpant.location().participantId(), m_sentParticipantData.location().participantId());
QCOMPARE(recvPartiticpant.location().equipNo(), m_sentParticipantData.location().equipNo());
QCOMPARE(recvPartiticpant.location.participantId, m_sentParticipantData.location.participantId);
QCOMPARE(recvPartiticpant.location.equipNo, m_sentParticipantData.location.equipNo);
}
void DataTopicTestsMain::deleteDataReaderTestCase()
@@ -69,19 +69,19 @@ void DataTopicTestsMain::deleteDataReaderTestCase()
DdsUnitTests::TestParticipant data;
for (int i = 0; i < 1000; ++i)
{
m_sentParticipantData.id(i);
m_sentParticipantData.id = i;
m_dtTest->write(m_sentParticipantData);
}
m_dtTest->deleteDTC();
for (int i = 0; i < 1000; ++i)
{
m_sentParticipantData.id(i);
m_sentParticipantData.id = i;
m_dtTest->write(m_sentParticipantData);
}
m_dtTest->deleteSubscriber();
for (int i = 0; i < 1000; ++i)
{
m_sentParticipantData.id(i);
m_sentParticipantData.id = i;
m_dtTest->write(m_sentParticipantData);
}
}
@@ -23,9 +23,9 @@ int main(int argc, char* argv[])
return retCode;
}
FunctionTopicTests::FunctionTopicTests() : m_mainThreadId(QThread::currentThreadId())
.getNGLLogger("UnitTests.FunctionTopicTests")),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
FunctionTopicTests::FunctionTopicTests()
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("UnitTests.FunctionTopicTests"))
, m_mainThreadId(QThread::currentThreadId())
{
qRegisterMetaType<DdsUnitTests::FunctionReply>("DdsUnitTests::FunctionReply");
qRegisterMetaType<DdsUnitTests::FunctionReplyWithState>("DdsUnitTests::FunctionReplyWithState");
@@ -98,14 +98,14 @@ void FunctionTopicTests::requestWithState()
DdsUnitTests::FunctionRequestWithState data;
data.id(1);
data.info(std::string("Test request"));
data.value(1000.0);
data.id = 1;
data.info = std::string("Test request");
data.value = 1000.0;
int uniqueId = 0;
bool bRet = m_ftcWS->requestDataClassic(
data, SLOT(slotRequestedData(DdsUnitTests::FunctionTopicTestWithStateReply, int, bool)),
SLOT(slotRequestedDataError(int, int, int)), uniqueId);
data, SLOT(slotRequestedData(DdsUnitTests::FunctionTopicTestWithStateReply,int,bool)),
SLOT(slotRequestedDataError(int,int,int)), uniqueId);
QVERIFY2(bRet, "Could not request data!");
@@ -123,14 +123,14 @@ void FunctionTopicTests::requestTestCase2()
DdsUnitTests::FunctionRequest data;
data.id(1);
data.info(std::string("Test request"));
data.value(1000.0);
data.id = 1;
data.info = std::string("Test request");
data.value = 1000.0;
int uniqueId = 0;
bool bRet =
m_ftc->requestDataClassic(data, SLOT(slotRequestedData(DdsUnitTests::FunctionTopicTestReply, int, bool)),
SLOT(slotRequestedDataError(int, int, int)), uniqueId);
m_ftc->requestDataClassic(data, SLOT(slotRequestedData(DdsUnitTests::FunctionTopicTestReply,int,bool)),
SLOT(slotRequestedDataError(int,int,int)), uniqueId);
QVERIFY2(bRet, "Could not request data!");
@@ -157,16 +157,16 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity&
INFO_LOG(m_logger) << "Got function topic request (with status member)";
m_requestTopicWithState = request;
QCOMPARE(m_requestTopicWithState.id(), 1);
QCOMPARE(m_requestTopicWithState.info().get(), std::string("Test request"));
QCOMPARE(m_requestTopicWithState.value(), 1000.0);
QCOMPARE(m_requestTopicWithState.id, 1);
QCOMPARE(m_requestTopicWithState.info.get(), std::string("Test request"));
QCOMPARE(m_requestTopicWithState.value, 1000.0);
DdsUnitTests::FunctionReplyWithState reply;
DEBUG_LOG(m_logger) << "Send sample with status REPLY_COMPLETED";
reply.id(1);
reply.errorString("Hello");
reply.replyState(Core::FtReplyState::Completed);
reply.id = 1;
reply.errorString = "Hello";
reply.replyState = Core::FtReplyState::Completed;
bool bRet = m_ftsWS->sendReply(sampleId, reply);
QVERIFY2(bRet, "Sending Reply failed");
@@ -185,8 +185,8 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity&
DdsUnitTests::FunctionReply reply;
reply.id(2);
reply.errorString("What?");
reply.id = 2;
reply.errorString = "What?";
bool bRet = m_fts->sendReply(sampleId, reply);
QVERIFY2(bRet, "Sending Reply failed");
@@ -200,21 +200,21 @@ void FunctionTopicTests::slotRequestedData(const DdsUnitTests::FunctionTopicTest
Q_UNUSED(seqNo);
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
INFO_LOG(m_logger) << "Got reply from FTS: " << reply.replyState();
INFO_LOG(m_logger) << "Got reply from FTS: " << reply.replyState;
m_replyTopicWithState = reply;
if (m_replyTopicWithState.replyState() == Core::FtReplyState::InProgress)
if (m_replyTopicWithState.replyState == Core::FtReplyState::InProgress)
{
QVERIFY(!bFinished);
QCOMPARE(m_replyTopicWithState.id(), 0);
QCOMPARE(m_replyTopicWithState.id, 0);
}
else
{
QVERIFY(bFinished);
QCOMPARE(m_replyTopicWithState.id(), 1);
QCOMPARE(m_replyTopicWithState.errorString(), std::string("Hello"));
QCOMPARE(m_replyTopicWithState.replyState().underlying(), Core::FtReplyState::Completed);
QCOMPARE(m_replyTopicWithState.id, 1);
QCOMPARE(m_replyTopicWithState.errorString, std::string("Hello"));
QCOMPARE(static_cast<int>(m_replyTopicWithState.replyState), static_cast<int>(Core::FtReplyState::Completed));
}
emit functionTopicReply();
}
@@ -226,8 +226,8 @@ void FunctionTopicTests::slotRequestedData(const DdsUnitTests::FunctionTopicTest
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
m_replyTopic = reply;
QCOMPARE(m_replyTopic.id(), 2);
QCOMPARE(m_replyTopic.errorString(), std::string("What?"));
QCOMPARE(m_replyTopic.id, 2);
QCOMPARE(m_replyTopic.errorString, std::string("What?"));
emit functionTopicReply();
}
@@ -50,8 +50,6 @@ class FunctionTopicTests : public QObject
NGL::INGLLogger& m_logger;
void requestWithState();
private:
NGL::INGLLogger& m_logger;
std::unique_ptr<FTS::FunctionTopicTest> m_fts;
std::unique_ptr<FTS::FunctionTopicTestWithState> m_ftsWS;
@@ -26,9 +26,9 @@ int main(int argc, char* argv[])
GenericDataTests::GenericDataTests()
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("UnitTests.GenericDataTests"))
{
m_spatialData.equipNo(0);
m_testPart.location().equipNo(0);
m_testPart.location().participantId(0);
m_spatialData.equipNo = 0;
m_testPart.location.equipNo = 0;
m_testPart.location.participantId = 0;
}
void GenericDataTests::initTestCase()
@@ -82,38 +82,38 @@ void GenericDataTests::dataWriterTestCase()
DdsUnitTests::SpatialData data;
data.participantId(100);
data.equipNo(999);
data.gpsPosition().lon(70000);
data.gpsPosition().lat(90000);
data.gpsPosition().z(10);
data.participantId = 100;
data.equipNo = 999;
data.gpsPosition.lon = 70000;
data.gpsPosition.lat = 90000;
data.gpsPosition.z = 10;
data.orientation().heave(10);
data.orientation().pitch(10);
data.orientation().roll(10);
data.orientation.heave = 10;
data.orientation.pitch = 10;
data.orientation.roll = 10;
data.velocity().x(10);
data.velocity().y(2);
data.velocity().z(1);
data.velocity.x = 10;
data.velocity.y = 2;
data.velocity.z = 1;
data.changedAt(11111);
data.changedAt = 11111;
QVERIFY2(m_dataWriterSd->write(data), "Publishing Topic (SpatialData) failed");
DdsUnitTests::TestParticipant allData;
allData.name("************************ Name of TestParticpant ***********************");
allData.location() = data;
allData.id(10000);
allData.name = "************************ Name of TestParticpant ***********************";
allData.location = data;
allData.id = 10000;
QVERIFY2(m_dataWriter->write(allData), "Publishing Topic (TestParticipant) failed");
allData.id(11000);
allData.id = 11000;
QVERIFY2(m_dataWriter->write(allData), "Publishing Topic (TestParticipant) failed");
allData.id(11100);
allData.id = 11100;
QVERIFY2(m_dataWriter->write(allData), "Publishing Topic (TestParticipant) failed");
allData.id(11110);
allData.id = 11110;
QVERIFY2(m_dataWriter->write(allData), "Publishing Topic (TestParticipant) failed");
allData.id(11111);
allData.id = 11111;
QVERIFY2(m_dataWriter->write(allData), "Publishing Topic (TestParticipant) failed");
}
@@ -122,30 +122,30 @@ void GenericDataTests::dataReaderTestCase()
{
DEBUG_LOG(m_logger) << "GenericDataTests: dataReader";
QTRY_COMPARE(m_spatialData.equipNo(), 999);
QCOMPARE(m_spatialData.changedAt(), 11111);
QTRY_COMPARE(m_spatialData.equipNo, 999);
QCOMPARE(m_spatialData.changedAt, 11111);
QTRY_COMPARE(m_testPart.location().equipNo(), 999);
QCOMPARE(m_testPart.location().participantId(), 100);
QTRY_COMPARE(m_testPart.location.equipNo, 999);
QCOMPARE(m_testPart.location.participantId, 100);
bool bSeenUnreadSamples = false;
dds::sub::LoanedSamples<DdsUnitTests::TestParticipant> vecTp = m_dataReader->readAlive(bSeenUnreadSamples);
INFO_LOG(m_logger) << "vecTp size: " << vecTp.length();
QCOMPARE(vecTp.length(), static_cast<decltype(vecTp.length())>(5));
QCOMPARE(vecTp[0].data().id(), 10000);
QCOMPARE(vecTp[1].data().id(), 11000);
QCOMPARE(vecTp[2].data().id(), 11100);
QCOMPARE(vecTp[3].data().id(), 11110);
QCOMPARE(vecTp[4].data().id(), 11111);
QCOMPARE(vecTp[0].data().id, 10000);
QCOMPARE(vecTp[1].data().id, 11000);
QCOMPARE(vecTp[2].data().id, 11100);
QCOMPARE(vecTp[3].data().id, 11110);
QCOMPARE(vecTp[4].data().id, 11111);
dds::sub::LoanedSamples<DdsUnitTests::TestParticipant> vecTpLoaned = m_dataReader->takeAlive(bSeenUnreadSamples);
INFO_LOG(m_logger) << "vecTpLoaned size: " << vecTp.length();
QCOMPARE(vecTpLoaned.length(), static_cast<decltype(vecTpLoaned.length())>(5));
QCOMPARE(vecTpLoaned[0].data().id(), 10000);
QCOMPARE(vecTpLoaned[1].data().id(), 11000);
QCOMPARE(vecTpLoaned[2].data().id(), 11100);
QCOMPARE(vecTpLoaned[3].data().id(), 11110);
QCOMPARE(vecTpLoaned[4].data().id(), 11111);
QCOMPARE(vecTpLoaned[0].data().id, 10000);
QCOMPARE(vecTpLoaned[1].data().id, 11000);
QCOMPARE(vecTpLoaned[2].data().id, 11100);
QCOMPARE(vecTpLoaned[3].data().id, 11110);
QCOMPARE(vecTpLoaned[4].data().id, 11111);
}
void GenericDataTests::deleteDataReaderTestCase()
@@ -153,7 +153,7 @@ void GenericDataTests::deleteDataReaderTestCase()
DdsUnitTests::TestParticipant data;
for (int i = 0; i < 1000; ++i)
{
data.id(i);
data.id = i;
m_dataWriter->write(data);
}
m_init->getSubscriberListener()->removeCallback(m_dataReader->getDataReader(), this);
@@ -161,7 +161,7 @@ void GenericDataTests::deleteDataReaderTestCase()
m_dataReader = nullptr;
for (int i = 0; i < 1000; ++i)
{
data.id(i);
data.id = i;
m_dataWriter->write(data);
}
}
@@ -188,14 +188,14 @@ void GenericDataTests::cleanupTestCase()
void GenericDataTests::processData(const DdsUnitTests::SpatialData& data, DataModification modType)
{
DEBUG_LOG(m_logger) << "SpatialData: equipNo = " << data.equipNo() << " modType: " << modType;
DEBUG_LOG(m_logger) << "SpatialData: equipNo = " << data.equipNo << " modType: " << modType;
m_spatialData = data;
}
void GenericDataTests::processData(const DdsUnitTests::TestParticipant& data, const dds::sub::SampleInfo& si)
{
Q_UNUSED(si);
DEBUG_LOG(m_logger) << "TestParticipant: equipNo = " << data.location().equipNo();
DEBUG_LOG(m_logger) << "TestParticipant: equipNo = " << data.location.equipNo;
m_testPart = data;
}
@@ -6,15 +6,15 @@
#include <Lts/Common/ProjectConfig/project_defines.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
Initialisation::Initialisation() : m_domainParticipant(nullptr)
, m_domainParticipantSub(nullptr)
, m_domainId(0)
, m_exerciseId(-1)
, m_ddsPublisher(nullptr)
, m_ddsSubscriber(nullptr)
, m_subListener(new DDSGeneric::SubscriberListener)
.getNGLLogger("UnitTests.Initialisation")),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
Initialisation::Initialisation()
: m_domainParticipant(nullptr)
, m_domainParticipantSub(nullptr)
, m_domainId(0)
, m_exerciseId(-1)
, m_ddsPublisher(nullptr)
, m_ddsSubscriber(nullptr)
, m_subListener(new DDSGeneric::SubscriberListener)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("UnitTests.Initialisation"))
{
if (!DDS::QosProfile::setDefault())
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
@@ -4,6 +4,8 @@
#include <DDS/Generic/generic_base.h>
#include <DDS/Generic/subscriber_listener.h>
#include <dds/pub/Publisher.hpp>
#include <dds/sub/Subscriber.hpp>
namespace NGL
{