Skip to content

Commit

Permalink
Tests for CacheChangePool [5599] (#557)
Browse files Browse the repository at this point in the history
* Refs #5551. First tests for CacheChangePool

* Ignoring files for Eclipse and Visual Studio Code

* Refs #5551. Tests for reserve_Cache function

* Refs #5551. Improved tests for reserve_Cache function. Deleted CacheChangePoolAttributes, it uses a tuple and the Combine method instead.

* Refs #5551. Added two more tests for CacheChangePool
Checks the initialized status of a reserved cache_changed
Checks the size of allChanges and freeChanges vectors

* Refs #5552. Blackbox run with prealloc memory mode only

* Refs #5552. Fixed certificate xml files and regenerated smime files
Also fixed bug in BlackboxTestsPersistence. Byte for Prealloc Memory Mode is '3'

* Refs #5551. Fixed gtest comparisons between signed and unsigned types
Replaced EXPECT with ASSERT

* Refs #5551. Fixed Instanciation tests for Mac
  • Loading branch information
Álvaro Molinillo authored and richiware committed Jun 11, 2019
1 parent 2e89320 commit 0eb30f7
Show file tree
Hide file tree
Showing 49 changed files with 723 additions and 622 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,11 @@ target/
# Eclipse
.cproject
.project
.settings

.pydevproject

compile_commands.json

# Visual Studio Code
.vscode
15 changes: 0 additions & 15 deletions test/blackbox/BlackboxTests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@
#ifndef __BLACKBOX_BLACKBOXTESTS_HPP__
#define __BLACKBOX_BLACKBOXTESTS_HPP__

#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST)
#define MEMORY_MODE_STRING ReallocMem
#define MEMORY_MODE_BYTE 1
#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST)
#define MEMORY_MODE_STRING DynMem
#define MEMORY_MODE_BYTE 2
#else
#define MEMORY_MODE_STRING PreallocMem
#define MEMORY_MODE_BYTE 3
#endif

#define PASTER(x, y) x ## _ ## y
#define EVALUATOR(x, y) PASTER(x, y)
#define BLACKBOXTEST(test_case_name, test_name) TEST(EVALUATOR(test_case_name, MEMORY_MODE_STRING), test_name)
#define BLACKBOXTEST_F(test_case_name, test_name) TEST_F(EVALUATOR(test_case_name, MEMORY_MODE_STRING), test_name)
#define TEST_TOPIC_NAME std::string(test_info_->test_case_name() + std::string("_") + test_info_->name())

#if defined(_WIN32)
Expand Down
4 changes: 2 additions & 2 deletions test/blackbox/BlackboxTestsAcknackQos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

BLACKBOXTEST(AcknackQos, RecoverAfterLosingCommunicationWithDisablePositiveAck)
TEST(AcknackQos, RecoverAfterLosingCommunicationWithDisablePositiveAck)
{
// This test makes the writer send a few samples
// and checks that those changes were received by the reader.
Expand Down Expand Up @@ -91,7 +91,7 @@ BLACKBOXTEST(AcknackQos, RecoverAfterLosingCommunicationWithDisablePositiveAck)
reader.block_for_all();
}

BLACKBOXTEST(AcknackQos, NotRecoverAfterLosingCommunicationWithDisablePositiveAck)
TEST(AcknackQos, NotRecoverAfterLosingCommunicationWithDisablePositiveAck)
{
// This test makes the writer send a few samples
// and checks that those changes were received by the reader.
Expand Down
8 changes: 4 additions & 4 deletions test/blackbox/BlackboxTestsDeadlineQos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

BLACKBOXTEST(DeadlineQos, NoKeyTopicLongDeadline)
TEST(DeadlineQos, NoKeyTopicLongDeadline)
{
// This test sets a long deadline (long in comparison to the write rate),
// makes the writer send a few samples and checks that the deadline was
Expand Down Expand Up @@ -71,7 +71,7 @@ BLACKBOXTEST(DeadlineQos, NoKeyTopicLongDeadline)
EXPECT_EQ(reader.missed_deadlines(), 0u);
}

BLACKBOXTEST(DeadlineQos, NoKeyTopicShortDeadline)
TEST(DeadlineQos, NoKeyTopicShortDeadline)
{
// This test sets a short deadline (short compared to the write rate),
// makes the writer send a few samples and checks that the deadline was missed every time
Expand Down Expand Up @@ -118,7 +118,7 @@ BLACKBOXTEST(DeadlineQos, NoKeyTopicShortDeadline)
EXPECT_GE(reader.missed_deadlines(), writer_samples);
}

BLACKBOXTEST(DeadlineQos, KeyedTopicLongDeadline)
TEST(DeadlineQos, KeyedTopicLongDeadline)
{
// This test sets a long deadline (long in comparison to the write rate),
// makes the writer send a few samples and checks that the deadline was met
Expand Down Expand Up @@ -167,7 +167,7 @@ BLACKBOXTEST(DeadlineQos, KeyedTopicLongDeadline)
EXPECT_EQ(reader.missed_deadlines(), 0u);
}

BLACKBOXTEST(DeadlineQos, KeyedTopicShortDeadline)
TEST(DeadlineQos, KeyedTopicShortDeadline)
{
// This test sets a short deadline (short compared to the write rate),
// makes the writer send a few samples and checks that the deadline was missed every time
Expand Down
20 changes: 10 additions & 10 deletions test/blackbox/BlackboxTestsDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

BLACKBOXTEST(BlackBox, ParticipantRemoval)
TEST(BlackBox, ParticipantRemoval)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -53,7 +53,7 @@ BLACKBOXTEST(BlackBox, ParticipantRemoval)
reader.wait_participant_undiscovery();
}

BLACKBOXTEST(BlackBox, StaticDiscovery)
TEST(BlackBox, StaticDiscovery)
{
//Log::SetVerbosity(Log::Info);
char* value = nullptr;
Expand Down Expand Up @@ -163,7 +163,7 @@ BLACKBOXTEST(BlackBox, StaticDiscovery)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, EDPSlaveReaderAttachment)
TEST(BlackBox, EDPSlaveReaderAttachment)
{
PubSubWriter<HelloWorldType> checker(TEST_TOPIC_NAME);
PubSubReader<HelloWorldType>* reader = new PubSubReader<HelloWorldType>(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -196,7 +196,7 @@ BLACKBOXTEST(BlackBox, EDPSlaveReaderAttachment)
}

// Used to detect Github issue #155
BLACKBOXTEST(BlackBox, EndpointRediscovery)
TEST(BlackBox, EndpointRediscovery)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -235,7 +235,7 @@ BLACKBOXTEST(BlackBox, EndpointRediscovery)
}

// Used to detect Github issue #457
BLACKBOXTEST(BlackBox, EndpointRediscovery_2)
TEST(BlackBox, EndpointRediscovery_2)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -267,7 +267,7 @@ BLACKBOXTEST(BlackBox, EndpointRediscovery_2)
}

// Regression test of Refs #2535, github micro-RTPS #1
BLACKBOXTEST(BlackBox, PubXmlLoadedPartition)
TEST(BlackBox, PubXmlLoadedPartition)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -301,7 +301,7 @@ BLACKBOXTEST(BlackBox, PubXmlLoadedPartition)
}

// Used to detect Github issue #154
BLACKBOXTEST(BlackBox, LocalInitialPeers)
TEST(BlackBox, LocalInitialPeers)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -351,7 +351,7 @@ BLACKBOXTEST(BlackBox, LocalInitialPeers)
}

// Test created to check bug #2010 (Github #90)
BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldPartitions)
TEST(BlackBox, PubSubAsReliableHelloworldPartitions)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -405,7 +405,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldPartitions)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldParticipantDiscovery)
TEST(BlackBox, PubSubAsReliableHelloworldParticipantDiscovery)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -449,7 +449,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldParticipantDiscovery)
reader.wait_discovery_result();
}

BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldUserData)
TEST(BlackBox, PubSubAsReliableHelloworldUserData)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down
4 changes: 2 additions & 2 deletions test/blackbox/BlackboxTestsLifespanQoS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

BLACKBOXTEST(LifespanQos, LongLifespan)
TEST(LifespanQos, LongLifespan)
{
// This test sets a long lifespan, makes the writer send a few samples
// and checks that those changes can be removed from the history
Expand Down Expand Up @@ -74,7 +74,7 @@ BLACKBOXTEST(LifespanQos, LongLifespan)
EXPECT_EQ(reader.takeNextData(&msg, &info), true);
}

BLACKBOXTEST(LifespanQos, ShortLifespan)
TEST(LifespanQos, ShortLifespan)
{
// This test sets a short lifespan, makes the writer send a few samples
// and checks that those samples cannot be removed from the history as
Expand Down
6 changes: 3 additions & 3 deletions test/blackbox/BlackboxTestsNetworkConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void GetIP4s(std::vector<IPFinder::info_IP>& interfaces)
}

//Verify that outLocatorList is used to select the desired output channel
BLACKBOXTEST(BlackBox, PubSubOutLocatorSelection)
TEST(BlackBox, PubSubOutLocatorSelection)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -87,7 +87,7 @@ BLACKBOXTEST(BlackBox, PubSubOutLocatorSelection)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, PubSubInterfaceWhitelistLocalhost)
TEST(BlackBox, PubSubInterfaceWhitelistLocalhost)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -123,7 +123,7 @@ BLACKBOXTEST(BlackBox, PubSubInterfaceWhitelistLocalhost)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, PubSubInterfaceWhitelistUnicast)
TEST(BlackBox, PubSubInterfaceWhitelistUnicast)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down
12 changes: 6 additions & 6 deletions test/blackbox/BlackboxTestsPersistence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

class EVALUATOR(BlackBoxPersistence, MEMORY_MODE_STRING) : public ::testing::Test
class BlackBoxPersistence : public ::testing::Test
{
public:
const std::string& db_file_name() const
Expand Down Expand Up @@ -97,7 +97,7 @@ class EVALUATOR(BlackBoxPersistence, MEMORY_MODE_STRING) : public ::testing::Tes
*p_value++ = info->line();
*p_value = GET_PID();
guid_prefix_.value[8] = HAVE_SECURITY;
guid_prefix_.value[9] = MEMORY_MODE_BYTE;
guid_prefix_.value[9] = 3; //PREALLOCATED_MEMORY_MODE
eprosima::fastrtps::rtps::LocatorList_t loc;
eprosima::fastrtps::rtps::IPFinder::getIP4Address(&loc);
if (loc.size() > 0)
Expand All @@ -118,7 +118,7 @@ class EVALUATOR(BlackBoxPersistence, MEMORY_MODE_STRING) : public ::testing::Tes
}
};

BLACKBOXTEST_F(BlackBoxPersistence, RTPSAsNonReliableWithPersistence)
TEST_F(BlackBoxPersistence, RTPSAsNonReliableWithPersistence)
{
RTPSWithRegistrationReader<HelloWorldType> reader(TEST_TOPIC_NAME);
RTPSWithRegistrationWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -151,7 +151,7 @@ BLACKBOXTEST_F(BlackBoxPersistence, RTPSAsNonReliableWithPersistence)
std::cout << "Second round finished." << std::endl;
}

BLACKBOXTEST_F(BlackBoxPersistence, AsyncRTPSAsNonReliableWithPersistence)
TEST_F(BlackBoxPersistence, AsyncRTPSAsNonReliableWithPersistence)
{
RTPSWithRegistrationReader<HelloWorldType> reader(TEST_TOPIC_NAME);
RTPSWithRegistrationWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -183,7 +183,7 @@ BLACKBOXTEST_F(BlackBoxPersistence, AsyncRTPSAsNonReliableWithPersistence)
std::cout << "Second round finished." << std::endl;
}

BLACKBOXTEST_F(BlackBoxPersistence, RTPSAsReliableWithPersistence)
TEST_F(BlackBoxPersistence, RTPSAsReliableWithPersistence)
{
RTPSWithRegistrationReader<HelloWorldType> reader(TEST_TOPIC_NAME);
RTPSWithRegistrationWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -215,7 +215,7 @@ BLACKBOXTEST_F(BlackBoxPersistence, RTPSAsReliableWithPersistence)
std::cout << "Second round finished." << std::endl;
}

BLACKBOXTEST_F(BlackBoxPersistence, AsyncRTPSAsReliableWithPersistence)
TEST_F(BlackBoxPersistence, AsyncRTPSAsReliableWithPersistence)
{
RTPSWithRegistrationReader<HelloWorldType> reader(TEST_TOPIC_NAME);
RTPSWithRegistrationWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down
16 changes: 8 additions & 8 deletions test/blackbox/BlackboxTestsPubSubBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

BLACKBOXTEST(BlackBox, PubSubAsNonReliableHelloworld)
TEST(BlackBox, PubSubAsNonReliableHelloworld)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -50,7 +50,7 @@ BLACKBOXTEST(BlackBox, PubSubAsNonReliableHelloworld)
reader.block_for_at_least(2);
}

BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableHelloworld)
TEST(BlackBox, AsyncPubSubAsNonReliableHelloworld)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -80,7 +80,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableHelloworld)
reader.block_for_at_least(2);
}

BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworld)
TEST(BlackBox, PubSubAsReliableHelloworld)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -111,7 +111,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworld)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableHelloworld)
TEST(BlackBox, AsyncPubSubAsReliableHelloworld)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -143,7 +143,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableHelloworld)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, ReqRepAsReliableHelloworld)
TEST(BlackBox, ReqRepAsReliableHelloworld)
{
ReqRepAsReliableHelloWorldRequester requester;
ReqRepAsReliableHelloWorldReplier replier;
Expand All @@ -167,7 +167,7 @@ BLACKBOXTEST(BlackBox, ReqRepAsReliableHelloworld)
}
}

BLACKBOXTEST(BlackBox, PubSubAsReliableData64kb)
TEST(BlackBox, PubSubAsReliableData64kb)
{
PubSubReader<Data64kbType> reader(TEST_TOPIC_NAME);
PubSubWriter<Data64kbType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -198,7 +198,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableData64kb)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, PubSubMoreThan256Unacknowledged)
TEST(BlackBox, PubSubMoreThan256Unacknowledged)
{
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);

Expand All @@ -225,7 +225,7 @@ BLACKBOXTEST(BlackBox, PubSubMoreThan256Unacknowledged)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldMulticastDisabled)
TEST(BlackBox, PubSubAsReliableHelloworldMulticastDisabled)
{
PubSubReader<HelloWorldType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldType> writer(TEST_TOPIC_NAME);
Expand Down
8 changes: 4 additions & 4 deletions test/blackbox/BlackboxTestsPubSubFlowControllers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControl)
TEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControl)
{
PubSubReader<Data64kbType> reader(TEST_TOPIC_NAME);
PubSubWriter<Data64kbType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -56,7 +56,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControl)
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControlAndUserTransport)
TEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControlAndUserTransport)
{
PubSubReader<Data64kbType> reader(TEST_TOPIC_NAME);
PubSubWriter<Data64kbType> writer(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -96,7 +96,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControlAn
reader.block_for_all();
}

BLACKBOXTEST(BlackBox, AsyncPubSubWithFlowController64kb)
TEST(BlackBox, AsyncPubSubWithFlowController64kb)
{
PubSubReader<Data64kbType> reader(TEST_TOPIC_NAME);
PubSubWriter<Data64kbType> slowWriter(TEST_TOPIC_NAME);
Expand Down Expand Up @@ -125,7 +125,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubWithFlowController64kb)
ASSERT_EQ(reader.getReceivedCount(), 1u);
}

BLACKBOXTEST(BlackBox, FlowControllerIfNotAsync)
TEST(BlackBox, FlowControllerIfNotAsync)
{
PubSubWriter<Data64kbType> writer(TEST_TOPIC_NAME);

Expand Down
Loading

0 comments on commit 0eb30f7

Please sign in to comment.