Restore in-scope files missing from the merge and scope-aware CMakeLists
The merge from story/release-validation-scope only carried files that existed at the common base or on that branch. In-scope files added on story/release-2-cleanup after the base (per-module unit-test dirs, the Release 2 driver and rpmbuild script) were missing, breaking ADD_SUBDIRECTORY(unit-test) references. - Restore the 33 missing in-scope files from story/release-2-cleanup. - Lts/Common/CMakeLists.txt and LtsUtilsGui/CMakeLists.txt: take the story/release-2-cleanup versions (the validation versions still reference out-of-scope subdirectories: httq, LtsRestClient, LtsWebSocket, ConnectDialog, StyleManager).
This commit is contained in:
1 parent
cfe15c72c4
commit
262fd226f9
35 files changed
+6856
-16
No files matched your search
@@ -0,0 +1,190 @@
|
||||
//
|
||||
// Unit tests for the ddsQoS module (Lts/DDS/QosProfile): DDS_DefaultQos.
|
||||
// The functions under test only read QoS profiles through the RTI QosProvider
|
||||
// (policy structs) - no DomainParticipant, Publication or Subscription is
|
||||
// created and no DDS runtime/network access happens.
|
||||
//
|
||||
// The location of the default_profile.xml shipped with the module is passed
|
||||
// via the DDSQOS_UNIT_TEST_PROFILE_XML compile definition
|
||||
// (see Lts/DDS/QosProfile/unit-test/CMakeLists.txt).
|
||||
//
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QUrl>
|
||||
|
||||
#include <QosProfile/DDS_DefaultQos.h>
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtTest/QTest>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace DDS::QosProfile;
|
||||
|
||||
const QString &profileXml()
|
||||
{
|
||||
static const QString path = QStringLiteral(DDSQOS_UNIT_TEST_PROFILE_XML);
|
||||
return path;
|
||||
}
|
||||
|
||||
bool containsPeer(const dds::core::StringSeq &seq, const std::string &needle)
|
||||
{
|
||||
for (const std::string &s : seq)
|
||||
if (s == needle)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ddsqos_unit_test : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
||||
void setDefaultLoadsProfile();
|
||||
void shmUdpParticipantQos();
|
||||
void shmParticipantQos();
|
||||
void shmUdpLocalhostParticipantQos();
|
||||
void domainParticipantTcpBindPort();
|
||||
void domainParticipantTcpV4LanPeers();
|
||||
void dataWriterDefaults();
|
||||
void dataWriterFunctionTopic();
|
||||
void dataReaderDefaults();
|
||||
void dataReaderFunctionTopic();
|
||||
void dataReaderDefaultByConnectionType();
|
||||
void printSmokeTest();
|
||||
};
|
||||
|
||||
void ddsqos_unit_test::initTestCase()
|
||||
{
|
||||
NGL::NGLLoggerBootstrap::createNGLRootLogger("log4cxx.props", false);
|
||||
|
||||
if (!QFile::exists(profileXml()))
|
||||
QSKIP("default_profile.xml not available");
|
||||
QVERIFY(setDefault(QStringList{profileXml()}));
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::setDefaultLoadsProfile()
|
||||
{
|
||||
// Re-loading the known-good profile into the default provider must succeed.
|
||||
QVERIFY(setDefault(QStringList{profileXml()}));
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::shmUdpParticipantQos()
|
||||
{
|
||||
const dds::domain::qos::DomainParticipantQos qos = domainParticipantShmUdp();
|
||||
const uint64_t expected = (rti::core::policy::TransportBuiltinMask::shmem()
|
||||
| rti::core::policy::TransportBuiltinMask::udpv4()).to_ulong();
|
||||
QCOMPARE(qos->transport_builtin.mask().to_ulong(), expected);
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::shmParticipantQos()
|
||||
{
|
||||
const dds::domain::qos::DomainParticipantQos qos = domainParticipantShm();
|
||||
QCOMPARE(qos->transport_builtin.mask().to_ulong(),
|
||||
rti::core::policy::TransportBuiltinMask::shmem().to_ulong());
|
||||
const dds::core::StringSeq peers = qos->discovery.initial_peers();
|
||||
QCOMPARE(peers.size(), 1u);
|
||||
QCOMPARE(peers.at(0), std::string("30@builtin.shmem://"));
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::shmUdpLocalhostParticipantQos()
|
||||
{
|
||||
const dds::domain::qos::DomainParticipantQos qos = domainParticipantShmUdpLocalhost();
|
||||
const dds::core::StringSeq peers = qos->discovery.initial_peers();
|
||||
QVERIFY(containsPeer(peers, "builtin.shmem://"));
|
||||
QVERIFY(containsPeer(peers, "builtin.udpv4://127.0.0.1"));
|
||||
QVERIFY(qos->property.exists("dds.transport.UDPv4.builtin.multicast_enabled"));
|
||||
QCOMPARE(qos->property.get("dds.transport.UDPv4.builtin.multicast_enabled"),
|
||||
std::string("0"));
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::domainParticipantTcpBindPort()
|
||||
{
|
||||
// Non-tcpv4lan scheme: the port is written into the TCPv4 transport property.
|
||||
const dds::domain::qos::DomainParticipantQos qos =
|
||||
domainParticipantShmTcp(QUrl(QStringLiteral("tcp://10.0.0.5:9999")));
|
||||
QVERIFY(qos->property.exists("dds.transport.TCPv4.tcp1.server_bind_port"));
|
||||
QCOMPARE(qos->property.get("dds.transport.TCPv4.tcp1.server_bind_port"),
|
||||
std::string("9999"));
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::domainParticipantTcpV4LanPeers()
|
||||
{
|
||||
// tcpv4lan scheme: the fixed-up URL becomes the single initial peer with
|
||||
// the "0@" domain prefix (fixupSchemeName in DDS_DefaultQos).
|
||||
const dds::domain::qos::DomainParticipantQos qos =
|
||||
domainParticipantShmTcp(QUrl(QStringLiteral("tcpv4lan://10.0.0.5:9999")));
|
||||
const dds::core::StringSeq peers = qos->discovery.initial_peers();
|
||||
QCOMPARE(peers.size(), 1u);
|
||||
QCOMPARE(peers.at(0), std::string("0@tcpv4_lan://10.0.0.5:9999"));
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::dataWriterDefaults()
|
||||
{
|
||||
// Default (DataTopic) writer QoS comes from the is_default_qos "Base" profile.
|
||||
const dds::pub::qos::DataWriterQos qos = dataWriterDefault(TopicType::DataTopic);
|
||||
QCOMPARE(qos->reliability.kind(), dds::core::policy::ReliabilityKind::RELIABLE);
|
||||
QCOMPARE(qos->durability.kind(), dds::core::policy::DurabilityKind::TRANSIENT_LOCAL);
|
||||
QCOMPARE(qos->history.kind(), dds::core::policy::HistoryKind::KEEP_LAST);
|
||||
QCOMPARE(qos->history.depth(), 1);
|
||||
QCOMPARE(qos->publish_mode.kind(), rti::core::policy::PublishModeKind::ASYNCHRONOUS);
|
||||
QCOMPARE(qos->resource_limits.max_samples(), 8000);
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::dataWriterFunctionTopic()
|
||||
{
|
||||
const dds::pub::qos::DataWriterQos qos = dataWriterDefault(TopicType::FunctionTopic);
|
||||
QCOMPARE(qos->durability.kind(), dds::core::policy::DurabilityKind::TRANSIENT_LOCAL);
|
||||
QCOMPARE(qos->history.kind(), dds::core::policy::HistoryKind::KEEP_LAST);
|
||||
QCOMPARE(qos->history.depth(), 1);
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::dataReaderDefaults()
|
||||
{
|
||||
const dds::sub::qos::DataReaderQos qos = dataReaderDefault(TopicType::DataTopic);
|
||||
QCOMPARE(qos->reliability.kind(), dds::core::policy::ReliabilityKind::RELIABLE);
|
||||
QCOMPARE(qos->durability.kind(), dds::core::policy::DurabilityKind::TRANSIENT_LOCAL);
|
||||
QCOMPARE(qos->history.kind(), dds::core::policy::HistoryKind::KEEP_LAST);
|
||||
QCOMPARE(qos->history.depth(), 1);
|
||||
QCOMPARE(qos->resource_limits.max_samples(), 8000);
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::dataReaderFunctionTopic()
|
||||
{
|
||||
// The FT reader profile overrides the Base reader history with KEEP_ALL.
|
||||
const dds::sub::qos::DataReaderQos ftQos = dataReaderDefault(TopicType::FunctionTopic);
|
||||
QCOMPARE(ftQos->history.kind(), dds::core::policy::HistoryKind::KEEP_ALL);
|
||||
|
||||
const dds::sub::qos::DataReaderQos dataQos = dataReaderDefault(TopicType::DataTopic);
|
||||
QCOMPARE(dataQos->history.kind(), dds::core::policy::HistoryKind::KEEP_LAST);
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::dataReaderDefaultByConnectionType()
|
||||
{
|
||||
// The ShmUdp participant profile inherits the Base reader QoS.
|
||||
const dds::sub::qos::DataReaderQos qos = dataReaderDefault(ConnectionType::ShmUdp);
|
||||
QCOMPARE(qos->reliability.kind(), dds::core::policy::ReliabilityKind::RELIABLE);
|
||||
QCOMPARE(qos->history.kind(), dds::core::policy::HistoryKind::KEEP_LAST);
|
||||
QCOMPARE(qos->resource_limits.max_samples(), 8000);
|
||||
}
|
||||
|
||||
void ddsqos_unit_test::printSmokeTest()
|
||||
{
|
||||
// print() walks the profile policies - must not throw.
|
||||
NGL::INGLLogger &logger =
|
||||
NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("DDS.DefaultQosTest");
|
||||
print(domainParticipantShmUdp(), logger);
|
||||
print(dataWriterDefault(TopicType::DataTopic), logger);
|
||||
print(dataReaderDefault(TopicType::DataTopic), logger);
|
||||
}
|
||||
|
||||
QTEST_MAIN(ddsqos_unit_test)
|
||||
#include "ddsqos_unit_test.moc"
|
||||
Reference in new issue
Block a user