From 829599b3a387ec1ea24e133b389ee6ca2b4fbc45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Fri, 30 Nov 2018 10:10:15 +0100 Subject: [PATCH 1/5] Refs #3539. First step. --- test/communication/CMakeLists.txt | 25 ++++++++++++------- test/communication/Publisher.cpp | 28 ++++++++++++++-------- test/communication/Subscriber.cpp | 19 ++++++++++++++- test/communication/simple_communication.py | 17 +++++++------ 4 files changed, 61 insertions(+), 28 deletions(-) diff --git a/test/communication/CMakeLists.txt b/test/communication/CMakeLists.txt index b7021ca2bf0..1807a351a38 100644 --- a/test/communication/CMakeLists.txt +++ b/test/communication/CMakeLists.txt @@ -43,20 +43,29 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) target_include_directories(SimpleCommunicationSubscriber PRIVATE ${PROJECT_SOURCE_DIR}/test/blackbox) target_link_libraries(SimpleCommunicationSubscriber fastrtps fastcdr ${CMAKE_DL_LIBS}) + ############################################################################### + # Necessary files + ############################################################################### + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_communication.py + ${CMAKE_CURRENT_BINARY_DIR}/simple_communication.py COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_besteffort.xml + ${CMAKE_CURRENT_BINARY_DIR}/simple_besteffort.xml COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_reliable.xml + ${CMAKE_CURRENT_BINARY_DIR}/simple_reliable.xml COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_reliable_besteffort.xml + ${CMAKE_CURRENT_BINARY_DIR}/simple_reliable_besteffort.xml COPYONLY) + + if(PYTHONINTERP_FOUND) - add_test(NAME SimpleCommunication - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/simple_communication.py) + add_test(NAME SimpleCommunicationBestEffort + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/simple_communication.py) # Set test with label NoMemoryCheck - set_property(TEST SimpleCommunication PROPERTY LABELS "NoMemoryCheck") + set_property(TEST SimpleCommunicationBestEffort PROPERTY LABELS "NoMemoryCheck") - set_property(TEST SimpleCommunication PROPERTY ENVIRONMENT - "SIMPLE_COMMUNICATION_PUBLISHER_BIN=$") - set_property(TEST SimpleCommunication APPEND PROPERTY ENVIRONMENT - "SIMPLE_COMMUNICATION_SUBSCRIBER_BIN=$") if(WIN32) string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}") - set_property(TEST SimpleCommunication APPEND PROPERTY ENVIRONMENT + set_property(TEST SimpleCommunicationBestEffort APPEND PROPERTY ENVIRONMENT "PATH=$\\;$\\;${WIN_PATH}") endif() diff --git a/test/communication/Publisher.cpp b/test/communication/Publisher.cpp index 5c6219aa949..57f9eb35910 100644 --- a/test/communication/Publisher.cpp +++ b/test/communication/Publisher.cpp @@ -79,7 +79,6 @@ class PubListener : public PublisherListener void onPublicationMatched(Publisher* /*publisher*/, MatchingInfo& info) override { - std::unique_lock lock(mutex_); if(info.status == MATCHED_MATCHING) { std::cout << "Subscriber matched" << std::endl; @@ -90,11 +89,8 @@ class PubListener : public PublisherListener std::cout << "Subscriber unmatched" << std::endl; --matched_; } - cv_.notify_all(); } - std::mutex mutex_; - std::condition_variable cv_; unsigned int matched_; }; @@ -103,6 +99,7 @@ int main(int argc, char** argv) int arg_count = 1; bool exit_on_lost_liveliness = false; uint32_t seed = 7800; + char* xml_file = nullptr; while(arg_count < argc) { @@ -120,11 +117,27 @@ int main(int argc, char** argv) seed = strtol(argv[arg_count], nullptr, 10); } + else if(strcmp(argv[arg_count], "--xmlfile") == 0) + { + if(++arg_count >= argc) + { + std::cout << "--xmlfile expects a parameter" << std::endl; + return -1; + } + + xml_file = argv[arg_count]; + } ++arg_count; } + if(xml_file) + { + Domain::loadXMLProfilesFile(xml_file); + } + ParticipantAttributes participant_attributes; + Domain::getDefaultParticipantAttributes(participant_attributes); participant_attributes.rtps.builtin.domainId = seed % 230; participant_attributes.rtps.builtin.leaseDuration.seconds = 3; participant_attributes.rtps.builtin.leaseDuration_announcementperiod.seconds = 1; @@ -145,10 +158,10 @@ int main(int argc, char** argv) //CREATE THE PUBLISHER PublisherAttributes publisher_attributes; + Domain::getDefaultPublisherAttributes(publisher_attributes); publisher_attributes.topic.topicKind = NO_KEY; publisher_attributes.topic.topicDataType = type.getName(); publisher_attributes.topic.topicName = topic.str(); - publisher_attributes.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; Publisher* publisher = Domain::createPublisher(participant, publisher_attributes, &listener); if(publisher == nullptr) { @@ -156,11 +169,6 @@ int main(int argc, char** argv) return 1; } - { - std::unique_lock lock(listener.mutex_); - listener.cv_.wait(lock, [&]{return listener.matched_ > 0;}); - } - HelloWorld data; data.index(1); data.message("HelloWorld"); diff --git a/test/communication/Subscriber.cpp b/test/communication/Subscriber.cpp index 0d6891fdc28..c34386e76c9 100644 --- a/test/communication/Subscriber.cpp +++ b/test/communication/Subscriber.cpp @@ -79,6 +79,7 @@ int main(int argc, char** argv) int arg_count = 1; bool notexit = false; uint32_t seed = 7800; + char* xml_file = nullptr; while(arg_count < argc) { @@ -96,11 +97,27 @@ int main(int argc, char** argv) seed = strtol(argv[arg_count], nullptr, 10); } + else if(strcmp(argv[arg_count], "--xmlfile") == 0) + { + if(++arg_count >= argc) + { + std::cout << "--xmlfile expects a parameter" << std::endl; + return -1; + } + + xml_file = argv[arg_count]; + } ++arg_count; } + if(xml_file) + { + Domain::loadXMLProfilesFile(xml_file); + } + ParticipantAttributes participant_attributes; + Domain::getDefaultParticipantAttributes(participant_attributes); participant_attributes.rtps.builtin.domainId = seed % 230; participant_attributes.rtps.builtin.leaseDuration.seconds = 3; participant_attributes.rtps.builtin.leaseDuration_announcementperiod.seconds = 1; @@ -121,10 +138,10 @@ int main(int argc, char** argv) //CREATE THE SUBSCRIBER SubscriberAttributes subscriber_attributes; + Domain::getDefaultSubscriberAttributes(subscriber_attributes); subscriber_attributes.topic.topicKind = NO_KEY; subscriber_attributes.topic.topicDataType = type.getName(); subscriber_attributes.topic.topicName = topic.str(); - subscriber_attributes.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; Subscriber* subscriber = Domain::createSubscriber(participant, subscriber_attributes, &listener); if(subscriber == nullptr) diff --git a/test/communication/simple_communication.py b/test/communication/simple_communication.py index 79f5b1f15b4..e600d54f00c 100644 --- a/test/communication/simple_communication.py +++ b/test/communication/simple_communication.py @@ -14,16 +14,15 @@ import sys, os, subprocess -publisher_command = os.environ.get("SIMPLE_COMMUNICATION_PUBLISHER_BIN") -assert publisher_command -subscriber_command = os.environ.get("SIMPLE_COMMUNICATION_SUBSCRIBER_BIN") -assert subscriber_command +subscriber1_proc = subprocess.Popen(["./SimpleCommunicationSubscriber", "--seed", str(os.getpid())]) +publisher_proc = subprocess.Popen(["./SimpleCommunicationPublisher", "--seed", str(os.getpid())]) +subscriber2_proc = subprocess.Popen(["./SimpleCommunicationSubscriber", "--seed", str(os.getpid())]) -subscriber_proc = subprocess.Popen([subscriber_command, "--seed", str(os.getpid())]) -publisher_proc = subprocess.Popen([publisher_command, "--seed", str(os.getpid())]) - -subscriber_proc.communicate() -retvalue = subscriber_proc.returncode +subscriber1_proc.communicate() +retvalue = subscriber1_proc.returncode +subscriber2_proc.communicate() +if retvalue == 0: + retvalue = subscriber2_proc.returncode publisher_proc.kill() From 729b877003bcf58f50958bb85f46fbe58ff34cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Fri, 30 Nov 2018 11:23:16 +0100 Subject: [PATCH 2/5] Refs #3539. New python scripts. --- test/communication/CMakeLists.txt | 47 +++++++++++++++++++ test/communication/Publisher.cpp | 2 - test/communication/Subscriber.cpp | 2 - test/communication/liveliness_assertion.py | 21 +++++++-- test/communication/liveliness_assertion.xml | 20 ++++++++ test/communication/simple_besteffort.xml | 18 +++++++ test/communication/simple_communication.py | 27 +++++++++-- test/communication/simple_reliable.xml | 18 +++++++ .../simple_reliable_besteffort.xml | 18 +++++++ 9 files changed, 162 insertions(+), 11 deletions(-) create mode 100644 test/communication/liveliness_assertion.xml create mode 100644 test/communication/simple_besteffort.xml create mode 100644 test/communication/simple_reliable.xml create mode 100644 test/communication/simple_reliable_besteffort.xml diff --git a/test/communication/CMakeLists.txt b/test/communication/CMakeLists.txt index 1807a351a38..2537c2f3c1f 100644 --- a/test/communication/CMakeLists.txt +++ b/test/communication/CMakeLists.txt @@ -48,12 +48,16 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) ############################################################################### configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_communication.py ${CMAKE_CURRENT_BINARY_DIR}/simple_communication.py COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liveliness_assertion.py + ${CMAKE_CURRENT_BINARY_DIR}/liveliness_assertion.py COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_besteffort.xml ${CMAKE_CURRENT_BINARY_DIR}/simple_besteffort.xml COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_reliable.xml ${CMAKE_CURRENT_BINARY_DIR}/simple_reliable.xml COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_reliable_besteffort.xml ${CMAKE_CURRENT_BINARY_DIR}/simple_reliable_besteffort.xml COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liveliness_assertion.xml + ${CMAKE_CURRENT_BINARY_DIR}/liveliness_assertion.xml COPYONLY) if(PYTHONINTERP_FOUND) @@ -63,12 +67,55 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) # Set test with label NoMemoryCheck set_property(TEST SimpleCommunicationBestEffort PROPERTY LABELS "NoMemoryCheck") + set_property(TEST SimpleCommunicationBestEffort PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_PUBLISHER_BIN=$") + set_property(TEST SimpleCommunicationBestEffort APPEND PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_SUBSCRIBER_BIN=$") + set_property(TEST SimpleCommunicationBestEffort APPEND PROPERTY ENVIRONMENT + "XML_FILE=simple_besteffort.xml") if(WIN32) string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}") set_property(TEST SimpleCommunicationBestEffort APPEND PROPERTY ENVIRONMENT "PATH=$\\;$\\;${WIN_PATH}") endif() + add_test(NAME SimpleCommunicationReliable + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/simple_communication.py) + + # Set test with label NoMemoryCheck + set_property(TEST SimpleCommunicationReliable PROPERTY LABELS "NoMemoryCheck") + + set_property(TEST SimpleCommunicationReliable PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_PUBLISHER_BIN=$") + set_property(TEST SimpleCommunicationReliable APPEND PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_SUBSCRIBER_BIN=$") + set_property(TEST SimpleCommunicationReliable APPEND PROPERTY ENVIRONMENT + "XML_FILE=simple_reliable.xml") + if(WIN32) + string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}") + set_property(TEST SimpleCommunicationReliable APPEND PROPERTY ENVIRONMENT + "PATH=$\\;$\\;${WIN_PATH}") + endif() + + add_test(NAME SimpleCommunicationReliableBestEffort + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/simple_communication.py) + + # Set test with label NoMemoryCheck + set_property(TEST SimpleCommunicationReliableBestEffort PROPERTY LABELS "NoMemoryCheck") + + set_property(TEST SimpleCommunicationReliableBestEffort PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_PUBLISHER_BIN=$") + set_property(TEST SimpleCommunicationReliableBestEffort APPEND PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_SUBSCRIBER_BIN=$") + set_property(TEST SimpleCommunicationReliableBestEffort APPEND PROPERTY ENVIRONMENT + "XML_FILE=simple_reliable_besteffort.xml") + if(WIN32) + string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}") + set_property(TEST SimpleCommunicationReliableBestEffort APPEND PROPERTY ENVIRONMENT + "PATH=$\\;$\\;${WIN_PATH}") + endif() + + add_test(NAME LivelinessAssertion COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/liveliness_assertion.py) diff --git a/test/communication/Publisher.cpp b/test/communication/Publisher.cpp index 57f9eb35910..a0107e09ff3 100644 --- a/test/communication/Publisher.cpp +++ b/test/communication/Publisher.cpp @@ -139,8 +139,6 @@ int main(int argc, char** argv) ParticipantAttributes participant_attributes; Domain::getDefaultParticipantAttributes(participant_attributes); participant_attributes.rtps.builtin.domainId = seed % 230; - participant_attributes.rtps.builtin.leaseDuration.seconds = 3; - participant_attributes.rtps.builtin.leaseDuration_announcementperiod.seconds = 1; ParListener participant_listener(exit_on_lost_liveliness); Participant* participant = Domain::createParticipant(participant_attributes, &participant_listener); diff --git a/test/communication/Subscriber.cpp b/test/communication/Subscriber.cpp index c34386e76c9..e6cad4d86b3 100644 --- a/test/communication/Subscriber.cpp +++ b/test/communication/Subscriber.cpp @@ -119,8 +119,6 @@ int main(int argc, char** argv) ParticipantAttributes participant_attributes; Domain::getDefaultParticipantAttributes(participant_attributes); participant_attributes.rtps.builtin.domainId = seed % 230; - participant_attributes.rtps.builtin.leaseDuration.seconds = 3; - participant_attributes.rtps.builtin.leaseDuration_announcementperiod.seconds = 1; Participant* participant = Domain::createParticipant(participant_attributes); if(participant==nullptr) return 1; diff --git a/test/communication/liveliness_assertion.py b/test/communication/liveliness_assertion.py index 07889458d5d..e9dd87dba04 100644 --- a/test/communication/liveliness_assertion.py +++ b/test/communication/liveliness_assertion.py @@ -12,15 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys, os, subprocess +import sys, os, subprocess, glob + +script_dir = os.path.dirname(os.path.realpath(__file__)) publisher_command = os.environ.get("SIMPLE_COMMUNICATION_PUBLISHER_BIN") +if not publisher_command: + publisher_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationPublisher"), recursive=True) + publisher_command = next(iter(publisher_files), None) assert publisher_command subscriber_command = os.environ.get("SIMPLE_COMMUNICATION_SUBSCRIBER_BIN") +if not subscriber_command: + subscriber_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationSubscriber"), recursive=True) + subscriber_command = next(iter(subscriber_files), None) assert subscriber_command +xml_file = os.environ.get("XML_FILE") +if xml_file: + real_xml_file = os.path.join(script_dir, xml_file) +else: + real_xml_file = os.path.join(script_dir, "liveliness_assertion.xml") -subscriber_proc = subprocess.Popen([subscriber_command, "--seed", str(os.getpid()), "--notexit"]) -publisher_proc = subprocess.Popen([publisher_command, "--seed", str(os.getpid()), "--exit_on_lost_liveliness"], stdout=subprocess.PIPE) +subscriber_proc = subprocess.Popen([subscriber_command, "--seed", str(os.getpid()), "--notexit", + "--xmlfile", real_xml_file]) +publisher_proc = subprocess.Popen([publisher_command, "--seed", str(os.getpid()), "--exit_on_lost_liveliness", + "--xmlfile", real_xml_file], stdout=subprocess.PIPE) while True: line = publisher_proc.stdout.readline() diff --git a/test/communication/liveliness_assertion.xml b/test/communication/liveliness_assertion.xml new file mode 100644 index 00000000000..825bc918608 --- /dev/null +++ b/test/communication/liveliness_assertion.xml @@ -0,0 +1,20 @@ + + + + + + + + + 3 + + + + + 1 + + + + + + diff --git a/test/communication/simple_besteffort.xml b/test/communication/simple_besteffort.xml new file mode 100644 index 00000000000..e78905764c1 --- /dev/null +++ b/test/communication/simple_besteffort.xml @@ -0,0 +1,18 @@ + + + + + + BEST_EFFORT + + + + + + + + BEST_EFFORT + + + + diff --git a/test/communication/simple_communication.py b/test/communication/simple_communication.py index e600d54f00c..4c1a0e56f9a 100644 --- a/test/communication/simple_communication.py +++ b/test/communication/simple_communication.py @@ -12,11 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys, os, subprocess +import sys, os, subprocess, glob -subscriber1_proc = subprocess.Popen(["./SimpleCommunicationSubscriber", "--seed", str(os.getpid())]) -publisher_proc = subprocess.Popen(["./SimpleCommunicationPublisher", "--seed", str(os.getpid())]) -subscriber2_proc = subprocess.Popen(["./SimpleCommunicationSubscriber", "--seed", str(os.getpid())]) +script_dir = os.path.dirname(os.path.realpath(__file__)) + +publisher_command = os.environ.get("SIMPLE_COMMUNICATION_PUBLISHER_BIN") +if not publisher_command: + publisher_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationPublisher"), recursive=True) + publisher_command = next(iter(publisher_files), None) +assert publisher_command +subscriber_command = os.environ.get("SIMPLE_COMMUNICATION_SUBSCRIBER_BIN") +if not subscriber_command: + subscriber_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationSubscriber"), recursive=True) + subscriber_command = next(iter(subscriber_files), None) +assert subscriber_command +xml_file = os.environ.get("XML_FILE") +if xml_file: + real_xml_file = os.path.join(script_dir, xml_file) + +subscriber1_proc = subprocess.Popen([subscriber_command, "--seed", str(os.getpid())] + + (["--xmlfile", real_xml_file] if xml_file else [])) +publisher_proc = subprocess.Popen([publisher_command, "--seed", str(os.getpid())] + + (["--xmlfile", real_xml_file] if xml_file else [])) +subscriber2_proc = subprocess.Popen([subscriber_command, "--seed", str(os.getpid())] + + (["--xmlfile", real_xml_file] if xml_file else [])) subscriber1_proc.communicate() retvalue = subscriber1_proc.returncode diff --git a/test/communication/simple_reliable.xml b/test/communication/simple_reliable.xml new file mode 100644 index 00000000000..95770d83cc7 --- /dev/null +++ b/test/communication/simple_reliable.xml @@ -0,0 +1,18 @@ + + + + + + RELIABLE + + + + + + + + RELIABLE + + + + diff --git a/test/communication/simple_reliable_besteffort.xml b/test/communication/simple_reliable_besteffort.xml new file mode 100644 index 00000000000..cc7749af5be --- /dev/null +++ b/test/communication/simple_reliable_besteffort.xml @@ -0,0 +1,18 @@ + + + + + + RELIABLE + + + + + + + + BEST_EFFORT + + + + From ff84c663157e571046cae3bb2a7d5fe9723aadd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Fri, 30 Nov 2018 13:16:18 +0100 Subject: [PATCH 3/5] Refs #3539. New simple communication tests. --- test/certs/governance.txt | 1 - .../governance_helloworld_all_enable.smime | 72 +++++++++++++++ .../governance_helloworld_all_enable.xml | 31 +++++++ test/certs/permissions_helloworld.smime | 88 +++++++++++++++++++ test/certs/permissions_helloworld.xml | 47 ++++++++++ test/communication/CMakeLists.txt | 44 +++++++++- test/communication/Publisher.cpp | 22 ++++- test/communication/liveliness_assertion.py | 4 +- test/communication/simple_communication.py | 42 +++++++-- .../simple_secure_besteffort_pub.xml | 61 +++++++++++++ .../simple_secure_besteffort_sub.xml | 61 +++++++++++++ 11 files changed, 460 insertions(+), 13 deletions(-) create mode 100644 test/certs/governance_helloworld_all_enable.smime create mode 100644 test/certs/governance_helloworld_all_enable.xml create mode 100644 test/certs/permissions_helloworld.smime create mode 100644 test/certs/permissions_helloworld.xml create mode 100644 test/communication/simple_secure_besteffort_pub.xml create mode 100644 test/communication/simple_secure_besteffort_sub.xml diff --git a/test/certs/governance.txt b/test/certs/governance.txt index 825eae59502..095532e2347 100644 --- a/test/certs/governance.txt +++ b/test/certs/governance.txt @@ -1,5 +1,4 @@ openssl smime -sign -in governance.xml -text -out governance.smime -signer maincacert.pem -inkey maincakey.pem - openssl smime -sign -in permissions.xml -text -out permissions.smime -signer maincacert.pem -inkey maincakey.pem diff --git a/test/certs/governance_helloworld_all_enable.smime b/test/certs/governance_helloworld_all_enable.smime new file mode 100644 index 00000000000..efb07ff31c6 --- /dev/null +++ b/test/certs/governance_helloworld_all_enable.smime @@ -0,0 +1,72 @@ +MIME-Version: 1.0 +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----164906A0CF14A77A8223B425D3824F71" + +This is an S/MIME signed message + +------164906A0CF14A77A8223B425D3824F71 +Content-Type: text/plain + + + + + + + + 0 + 230 + + + false + true + ENCRYPT + ENCRYPT + ENCRYPT + + + HelloWorldTopic_* + true + true + true + true + ENCRYPT + ENCRYPT + + + + + + + +------164906A0CF14A77A8223B425D3824F71 +Content-Type: application/x-pkcs7-signature; name="smime.p7s" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename="smime.p7s" + +MIIEegYJKoZIhvcNAQcCoIIEazCCBGcCAQExDzANBglghkgBZQMEAgEFADALBgkq +hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC +MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu +dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV +BAMMFWVQcm9zaW1hIE1haW4gVGVzdCBDQTEiMCAGCSqGSIb3DQEJARYTbWFpbmNh +QGVwcm9zaW1hLmNvbTAeFw0xNzA5MDYwOTAzMDNaFw0yNzA5MDQwOTAzMDNaMIGa +MQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2FudG9z +MREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNVBAMM +FWVQcm9zaW1hIE1haW4gVGVzdCBDQTEiMCAGCSqGSIb3DQEJARYTbWFpbmNhQGVw +cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE +3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS +7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT +4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 +SVxpI+3UYs2kV5n0MYIB/jCCAfoCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h +MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 +IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz +G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc +BgkqhkiG9w0BCQUxDxcNMTgxMTMwMTE1MzE3WjAvBgkqhkiG9w0BCQQxIgQgRfiH +rgLPG4v5NHu+eyK3h7RsS0DXzTQPCjgjiwI6N+YweQYJKoZIhvcNAQkPMWwwajAL +BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D +BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI +hvcNAwICASgwCgYIKoZIzj0EAwIESDBGAiEAzh8X2N5oodm27sbFCmV79kbVEv3e ++uDsXpEUEzCmZaMCIQDDCIUmQ4Z0t+LVOOdzRCo72pmnKDZhT2HsX8Hnk3D7aw== + +------164906A0CF14A77A8223B425D3824F71-- + diff --git a/test/certs/governance_helloworld_all_enable.xml b/test/certs/governance_helloworld_all_enable.xml new file mode 100644 index 00000000000..86327572335 --- /dev/null +++ b/test/certs/governance_helloworld_all_enable.xml @@ -0,0 +1,31 @@ + + + + + + + 0 + 230 + + + false + true + ENCRYPT + ENCRYPT + ENCRYPT + + + HelloWorldTopic_* + true + true + true + true + ENCRYPT + ENCRYPT + + + + + + diff --git a/test/certs/permissions_helloworld.smime b/test/certs/permissions_helloworld.smime new file mode 100644 index 00000000000..3762139dbc7 --- /dev/null +++ b/test/certs/permissions_helloworld.smime @@ -0,0 +1,88 @@ +MIME-Version: 1.0 +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----1F82A5302084D025100F3FD8FDAD15C3" + +This is an S/MIME signed message + +------1F82A5302084D025100F3FD8FDAD15C3 +Content-Type: text/plain + + + + + + emailAddress=mainpub@eprosima.com, CN=Main Publisher, OU=eProsima, O=eProsima, ST=MA, C=ES + + 2013-06-01T13:00:00 + 2038-06-01T13:00:00 + + + + + 0 + 230 + + + + + HelloWorldTopic_* + + + + DENY + + + emailAddress=mainsub@eprosima.com, CN=Main Subscriber, OU=eProsima, O=eProsima, ST=MA, C=ES + + 2013-06-01T13:00:00 + 2038-06-01T13:00:00 + + + + + 0 + 230 + + + + + HelloWorldTopic_* + + + + DENY + + + + +------1F82A5302084D025100F3FD8FDAD15C3 +Content-Type: application/x-pkcs7-signature; name="smime.p7s" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename="smime.p7s" + +MIIEeQYJKoZIhvcNAQcCoIIEajCCBGYCAQExDzANBglghkgBZQMEAgEFADALBgkq +hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC +MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu +dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV +BAMMFWVQcm9zaW1hIE1haW4gVGVzdCBDQTEiMCAGCSqGSIb3DQEJARYTbWFpbmNh +QGVwcm9zaW1hLmNvbTAeFw0xNzA5MDYwOTAzMDNaFw0yNzA5MDQwOTAzMDNaMIGa +MQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2FudG9z +MREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNVBAMM +FWVQcm9zaW1hIE1haW4gVGVzdCBDQTEiMCAGCSqGSIb3DQEJARYTbWFpbmNhQGVw +cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE +3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS +7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT +4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 +SVxpI+3UYs2kV5n0MYIB/TCCAfkCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h +MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 +IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz +G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc +BgkqhkiG9w0BCQUxDxcNMTgxMTMwMTE1NzM0WjAvBgkqhkiG9w0BCQQxIgQg8Jau +J4cuVYqsY6gXCm3V1AubIShOsMGUP2ei1KmLiK4weQYJKoZIhvcNAQkPMWwwajAL +BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D +BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI +hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiBv3W4P/l1EOSHqzKaozvRFUL6E/K4I +CUOktT7YbkzWEQIhALKDGdtcwvwNUBkpUugccEQyaunDFc672Vcq3J1V8tek + +------1F82A5302084D025100F3FD8FDAD15C3-- + diff --git a/test/certs/permissions_helloworld.xml b/test/certs/permissions_helloworld.xml new file mode 100644 index 00000000000..638ceb7a3ae --- /dev/null +++ b/test/certs/permissions_helloworld.xml @@ -0,0 +1,47 @@ + + + + + emailAddress=mainpub@eprosima.com, CN=Main Publisher, OU=eProsima, O=eProsima, ST=MA, C=ES + + 2013-06-01T13:00:00 + 2038-06-01T13:00:00 + + + + + 0 + 230 + + + + + HelloWorldTopic_* + + + + DENY + + + emailAddress=mainsub@eprosima.com, CN=Main Subscriber, OU=eProsima, O=eProsima, ST=MA, C=ES + + 2013-06-01T13:00:00 + 2038-06-01T13:00:00 + + + + + 0 + 230 + + + + + HelloWorldTopic_* + + + + DENY + + + diff --git a/test/communication/CMakeLists.txt b/test/communication/CMakeLists.txt index 2537c2f3c1f..f9028b4e210 100644 --- a/test/communication/CMakeLists.txt +++ b/test/communication/CMakeLists.txt @@ -56,9 +56,28 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) ${CMAKE_CURRENT_BINARY_DIR}/simple_reliable.xml COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_reliable_besteffort.xml ${CMAKE_CURRENT_BINARY_DIR}/simple_reliable_besteffort.xml COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_secure_besteffort_pub.xml + ${CMAKE_CURRENT_BINARY_DIR}/simple_secure_besteffort_pub.xml COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_secure_besteffort_sub.xml + ${CMAKE_CURRENT_BINARY_DIR}/simple_secure_besteffort_sub.xml COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liveliness_assertion.xml ${CMAKE_CURRENT_BINARY_DIR}/liveliness_assertion.xml COPYONLY) - + if(SECURITY) + configure_file(${PROJECT_SOURCE_DIR}/test/certs/maincacert.pem + ${CMAKE_CURRENT_BINARY_DIR}/maincacert.pem COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/test/certs/mainpubcert.pem + ${CMAKE_CURRENT_BINARY_DIR}/mainpubcert.pem COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/test/certs/mainpubkey.pem + ${CMAKE_CURRENT_BINARY_DIR}/mainpubkey.pem COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/test/certs/mainsubcert.pem + ${CMAKE_CURRENT_BINARY_DIR}/mainsubcert.pem COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/test/certs/mainsubkey.pem + ${CMAKE_CURRENT_BINARY_DIR}/mainsubkey.pem COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/test/certs/governance_helloworld_all_enable.smime + ${CMAKE_CURRENT_BINARY_DIR}/governance_helloworld_all_enable.smime COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/test/certs/permissions_helloworld.smime + ${CMAKE_CURRENT_BINARY_DIR}/permissions_helloworld.smime COPYONLY) + endif() if(PYTHONINTERP_FOUND) add_test(NAME SimpleCommunicationBestEffort @@ -115,6 +134,29 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) "PATH=$\\;$\\;${WIN_PATH}") endif() + if(SECURITY) + add_test(NAME SimpleCommunicationSecureBestEffort + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/simple_communication.py) + + # Set test with label NoMemoryCheck + set_property(TEST SimpleCommunicationSecureBestEffort PROPERTY LABELS "NoMemoryCheck") + + set_property(TEST SimpleCommunicationSecureBestEffort PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_PUBLISHER_BIN=$") + set_property(TEST SimpleCommunicationSecureBestEffort APPEND PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_SUBSCRIBER_BIN=$") + set_property(TEST SimpleCommunicationSecureBestEffort APPEND PROPERTY ENVIRONMENT + "XML_FILE_PUB=simple_secure_besteffort_pub.xml") + set_property(TEST SimpleCommunicationSecureBestEffort APPEND PROPERTY ENVIRONMENT + "XML_FILE_SUB=simple_secure_besteffort_sub.xml") + set_property(TEST SimpleCommunicationSecureBestEffort APPEND PROPERTY ENVIRONMENT + "EXTRA_PUB_ARG=--wait 2") + if(WIN32) + string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}") + set_property(TEST SimpleCommunicationSecureBestEffort APPEND PROPERTY ENVIRONMENT + "PATH=$\\;$\\;${WIN_PATH}") + endif() + endif() add_test(NAME LivelinessAssertion COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/liveliness_assertion.py) diff --git a/test/communication/Publisher.cpp b/test/communication/Publisher.cpp index a0107e09ff3..1ea6488b452 100644 --- a/test/communication/Publisher.cpp +++ b/test/communication/Publisher.cpp @@ -79,6 +79,7 @@ class PubListener : public PublisherListener void onPublicationMatched(Publisher* /*publisher*/, MatchingInfo& info) override { + std::unique_lock lock(mutex_); if(info.status == MATCHED_MATCHING) { std::cout << "Subscriber matched" << std::endl; @@ -89,8 +90,11 @@ class PubListener : public PublisherListener std::cout << "Subscriber unmatched" << std::endl; --matched_; } + cv_.notify_all(); } + std::mutex mutex_; + std::condition_variable cv_; unsigned int matched_; }; @@ -98,7 +102,7 @@ int main(int argc, char** argv) { int arg_count = 1; bool exit_on_lost_liveliness = false; - uint32_t seed = 7800; + uint32_t seed = 7800, wait = 0; char* xml_file = nullptr; while(arg_count < argc) @@ -117,6 +121,16 @@ int main(int argc, char** argv) seed = strtol(argv[arg_count], nullptr, 10); } + else if(strcmp(argv[arg_count], "--wait") == 0) + { + if(++arg_count >= argc) + { + std::cout << "--wait expects a parameter" << std::endl; + return -1; + } + + wait = strtol(argv[arg_count], nullptr, 10); + } else if(strcmp(argv[arg_count], "--xmlfile") == 0) { if(++arg_count >= argc) @@ -167,6 +181,12 @@ int main(int argc, char** argv) return 1; } + if(wait > 0) + { + std::unique_lock lock(listener.mutex_); + listener.cv_.wait(lock, [&]{return listener.matched_ >= wait;}); + } + HelloWorld data; data.index(1); data.message("HelloWorld"); diff --git a/test/communication/liveliness_assertion.py b/test/communication/liveliness_assertion.py index e9dd87dba04..8fd306e433c 100644 --- a/test/communication/liveliness_assertion.py +++ b/test/communication/liveliness_assertion.py @@ -18,12 +18,12 @@ publisher_command = os.environ.get("SIMPLE_COMMUNICATION_PUBLISHER_BIN") if not publisher_command: - publisher_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationPublisher"), recursive=True) + publisher_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationPublisher*"), recursive=True) publisher_command = next(iter(publisher_files), None) assert publisher_command subscriber_command = os.environ.get("SIMPLE_COMMUNICATION_SUBSCRIBER_BIN") if not subscriber_command: - subscriber_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationSubscriber"), recursive=True) + subscriber_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationSubscriber*"), recursive=True) subscriber_command = next(iter(subscriber_files), None) assert subscriber_command xml_file = os.environ.get("XML_FILE") diff --git a/test/communication/simple_communication.py b/test/communication/simple_communication.py index 4c1a0e56f9a..07fb36a0eab 100644 --- a/test/communication/simple_communication.py +++ b/test/communication/simple_communication.py @@ -18,24 +18,50 @@ publisher_command = os.environ.get("SIMPLE_COMMUNICATION_PUBLISHER_BIN") if not publisher_command: - publisher_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationPublisher"), recursive=True) - publisher_command = next(iter(publisher_files), None) + publisher_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationPublisher*"), recursive=True) + pf = iter(publisher_files) + publisher_command = next(pf, None) + while publisher_command and (not os.path.isfile(publisher_command) or not os.access(publisher_command, + os.X_OK)): + publisher_command = next(pf, None) assert publisher_command subscriber_command = os.environ.get("SIMPLE_COMMUNICATION_SUBSCRIBER_BIN") if not subscriber_command: - subscriber_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationSubscriber"), recursive=True) - subscriber_command = next(iter(subscriber_files), None) + subscriber_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationSubscriber*"), recursive=True) + pf = iter(subscriber_files) + subscriber_command = next(pf, None) + while subscriber_command and (not os.path.isfile(subscriber_command) or not os.access(subscriber_command, + os.X_OK)): + subscriber_command = next(pf, None) assert subscriber_command + +extra_pub_arg = os.environ.get("EXTRA_PUB_ARG") +if extra_pub_arg: + extra_pub_args = extra_pub_arg.split() +else: + extra_pub_args = [] + +real_xml_file_pub = None +real_xml_file_sub = None xml_file = os.environ.get("XML_FILE") if xml_file: - real_xml_file = os.path.join(script_dir, xml_file) + real_xml_file_pub = os.path.join(script_dir, xml_file) + real_xml_file_sub = os.path.join(script_dir, xml_file) +else: + xml_file_pub = os.environ.get("XML_FILE_PUB") + if xml_file_pub: + real_xml_file_pub = os.path.join(script_dir, xml_file_pub) + xml_file_sub = os.environ.get("XML_FILE_SUB") + if xml_file_sub: + real_xml_file_sub = os.path.join(script_dir, xml_file_sub) subscriber1_proc = subprocess.Popen([subscriber_command, "--seed", str(os.getpid())] - + (["--xmlfile", real_xml_file] if xml_file else [])) + + (["--xmlfile", real_xml_file_sub] if real_xml_file_sub else [])) publisher_proc = subprocess.Popen([publisher_command, "--seed", str(os.getpid())] - + (["--xmlfile", real_xml_file] if xml_file else [])) + + (["--xmlfile", real_xml_file_pub] if real_xml_file_pub else []) + + extra_pub_args) subscriber2_proc = subprocess.Popen([subscriber_command, "--seed", str(os.getpid())] - + (["--xmlfile", real_xml_file] if xml_file else [])) + + (["--xmlfile", real_xml_file_sub] if real_xml_file_sub else [])) subscriber1_proc.communicate() retvalue = subscriber1_proc.returncode diff --git a/test/communication/simple_secure_besteffort_pub.xml b/test/communication/simple_secure_besteffort_pub.xml new file mode 100644 index 00000000000..964f7715e59 --- /dev/null +++ b/test/communication/simple_secure_besteffort_pub.xml @@ -0,0 +1,61 @@ + + + + + + + + + dds.sec.auth.plugin + builtin.PKI-DH + + + + dds.sec.auth.builtin.PKI-DH.identity_ca + file://maincacert.pem + + + dds.sec.auth.builtin.PKI-DH.identity_certificate + file://mainpubcert.pem + + + dds.sec.auth.builtin.PKI-DH.private_key + file://mainpubkey.pem + + + + dds.sec.access.plugin + builtin.Access-Permissions + + + + dds.sec.access.builtin.Access-Permissions.permissions_ca + file://maincacert.pem + + + dds.sec.access.builtin.Access-Permissions.governance + file://governance_helloworld_all_enable.smime + + + dds.sec.access.builtin.Access-Permissions.permissions + file://permissions_helloworld.smime + + + + dds.sec.crypto.plugin + builtin.AES-GCM-GMAC + + + + + + + + + + BEST_EFFORT + + + + + diff --git a/test/communication/simple_secure_besteffort_sub.xml b/test/communication/simple_secure_besteffort_sub.xml new file mode 100644 index 00000000000..368aeba4c5c --- /dev/null +++ b/test/communication/simple_secure_besteffort_sub.xml @@ -0,0 +1,61 @@ + + + + + + + + + dds.sec.auth.plugin + builtin.PKI-DH + + + + dds.sec.auth.builtin.PKI-DH.identity_ca + file://maincacert.pem + + + dds.sec.auth.builtin.PKI-DH.identity_certificate + file://mainsubcert.pem + + + dds.sec.auth.builtin.PKI-DH.private_key + file://mainsubkey.pem + + + + dds.sec.access.plugin + builtin.Access-Permissions + + + + dds.sec.access.builtin.Access-Permissions.permissions_ca + file://maincacert.pem + + + dds.sec.access.builtin.Access-Permissions.governance + file://governance_helloworld_all_enable.smime + + + dds.sec.access.builtin.Access-Permissions.permissions + file://permissions_helloworld.smime + + + + dds.sec.crypto.plugin + builtin.AES-GCM-GMAC + + + + + + + + + + BEST_EFFORT + + + + + From 41d0addf5dd3ca1c7fce2417ad64d4ac61bffc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Mon, 3 Dec 2018 07:43:34 +0100 Subject: [PATCH 4/5] Refs #3539. Fixed warnings. --- include/fastrtps/rtps/messages/CDRMessage.hpp | 4 ++-- test/blackbox/BlackboxTests.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fastrtps/rtps/messages/CDRMessage.hpp b/include/fastrtps/rtps/messages/CDRMessage.hpp index 89c07c8aade..1c934201fba 100644 --- a/include/fastrtps/rtps/messages/CDRMessage.hpp +++ b/include/fastrtps/rtps/messages/CDRMessage.hpp @@ -157,7 +157,7 @@ inline bool CDRMessage::readSequenceNumberSet(CDRMessage_t* msg,SequenceNumberSe { bool valid = true; valid &=CDRMessage::readSequenceNumber(msg,&sns->base); - uint32_t numBits; + uint32_t numBits = 0; valid &=CDRMessage::readUInt32(msg,&numBits); int32_t bitmap; SequenceNumber_t seqNum; @@ -183,7 +183,7 @@ inline bool CDRMessage::readFragmentNumberSet(CDRMessage_t* msg, FragmentNumberS { bool valid = true; valid &= CDRMessage::readUInt32(msg, &fns->base); - uint32_t numBits; + uint32_t numBits = 0; valid &= CDRMessage::readUInt32(msg, &numBits); int32_t bitmap; FragmentNumber_t fragNum; diff --git a/test/blackbox/BlackboxTests.cpp b/test/blackbox/BlackboxTests.cpp index ee6940fdb38..46e6e2bf477 100644 --- a/test/blackbox/BlackboxTests.cpp +++ b/test/blackbox/BlackboxTests.cpp @@ -1094,7 +1094,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubWithFlowController64kb) slowWriter.send(data); // In 1 second only one of the messages has time to arrive std::this_thread::sleep_for(std::chrono::milliseconds(500)); - ASSERT_EQ(reader.getReceivedCount(), 1); + ASSERT_EQ(reader.getReceivedCount(), 1u); } BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData300kbInLossyConditions) From d9c5a31cefead87a41bbb5bbb70180384e5a40bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Mon, 3 Dec 2018 07:48:43 +0100 Subject: [PATCH 5/5] Refs #3539. Removed an auto. --- src/cpp/rtps/messages/RTPSMessageGroup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/rtps/messages/RTPSMessageGroup.cpp b/src/cpp/rtps/messages/RTPSMessageGroup.cpp index 7040c2284d6..bb22ec2589a 100644 --- a/src/cpp/rtps/messages/RTPSMessageGroup.cpp +++ b/src/cpp/rtps/messages/RTPSMessageGroup.cpp @@ -118,7 +118,7 @@ void get_participants_from_endpoints(const std::vector& endpoints, std:: { participants.clear(); - for (auto& endpoint : endpoints) + for (const GUID_t& endpoint : endpoints) { if (std::find(participants.begin(), participants.end(), endpoint.guidPrefix) == participants.end()) participants.push_back(endpoint.guidPrefix);