diff --git a/Android.bp b/Android.bp index b4ece3279..c6caa4de8 100644 --- a/Android.bp +++ b/Android.bp @@ -80,7 +80,8 @@ cc_library_shared { cflags: [ "-DWITHOUT_SYSTEMD", - "-DVSOMEIP_COMPAT_VERSION=\"3.4.9\"", + "-DVSOMEIP_VERSION=\"3.4.10\"", + "-DVSOMEIP_COMPAT_VERSION=\"3.4.10\"", "-DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\"", "-DUSE_DLT", ], diff --git a/Android.mk b/Android.mk index 57366a36b..67530094e 100644 --- a/Android.mk +++ b/Android.mk @@ -100,7 +100,7 @@ LOCAL_CFLAGS := \ -frtti \ -fexceptions \ -DWITHOUT_SYSTEMD \ - -DVSOMEIP_VERSION=\"3.4.9\" \ + -DVSOMEIP_VERSION=\"3.4.10\" \ -DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \ -Wno-unused-parameter \ -Wno-non-virtual-dtor \ @@ -147,7 +147,7 @@ LOCAL_CFLAGS := \ -frtti \ -fexceptions \ -DWITHOUT_SYSTEMD \ - -DVSOMEIP_VERSION=\"3.4.9\" \ + -DVSOMEIP_VERSION=\"3.4.10\" \ -DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \ -Wno-unused-parameter \ -Wno-non-virtual-dtor \ @@ -194,8 +194,8 @@ LOCAL_CFLAGS := \ -frtti \ -fexceptions \ -DWITHOUT_SYSTEMD \ - -DVSOMEIP_VERSION=\"3.4.9\" \ - -DVSOMEIP_COMPAT_VERSION=\"3.4.9\" \ + -DVSOMEIP_VERSION=\"3.4.10\" \ + -DVSOMEIP_COMPAT_VERSION=\"3.4.10\" \ -DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \ -Wno-unused-parameter \ -Wno-non-virtual-dtor \ diff --git a/CHANGES b/CHANGES index 0db219b46..f4e7081aa 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,30 @@ Changes ======= +v3.4.10 +- Fix QNX build +- Fix missing Stop Offer +- Apply extra fixes to QNX environment +- Remove key from the offer_commands_ +- COVESA#478: deleted unused param _use_exclusive_proxy +- Fix code smell related to condition variable +- COVESA#462: Fix IPv6 Service Discovery +- Added multicast_mutex to async function that makes use of multicast socket +- COVESA#479: Allow service_discovery to continue without random_device +- Fix availability handler sending false on offer +- Set host/port in vsomeip_sec_client_t whenever possible +- Use executor_work_guard instead of io_context::work for boost v1.66 and higher +- Update Windows build +- Added profile 07 as an option for E2E protection +- ASIO: use heap-allocation to avoid using garbage data +- Fix integer underflow in server_endpoint_impl.cpp +- Cleanup prepare_stop_handlers_ +- Automatic unsubscribe +- Debounce now works without routingmanagerd running +- Debouncing: Send last received value after debounce time + X +- Fix resource deadlock avoided crash +- Use closure instead of callable struct + v3.4.9 - Merge COVESA PR447 with support for QNX 7.1 - Merge COVESA PR470 with changes to not instantiate diff --git a/CMakeLists.txt b/CMakeLists.txt index 55f6c4de7..ab399a69e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ set (VSOMEIP_COMPAT_NAME vsomeip) set (VSOMEIP_MAJOR_VERSION 3) set (VSOMEIP_MINOR_VERSION 4) -set (VSOMEIP_PATCH_VERSION 9) -set (VSOMEIP_HOTFIX_VERSION 1) +set (VSOMEIP_PATCH_VERSION 10) +set (VSOMEIP_HOTFIX_VERSION 0) set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION}) set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentation/doxygen.in @@ -251,7 +251,6 @@ if (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_ASIO_DISABLE_IOCP /EHsc /std:c++14 /wd4250") set(USE_RT "") link_directories(${Boost_LIBRARY_DIR_DEBUG}) - ADD_DEFINITIONS( -DBOOST_ALL_DYN_LINK ) elseif(${CMAKE_SYSTEM_NAME} MATCHES "QNX") set(USE_RT "") else() diff --git a/documentation/vsomeipUserGuide b/documentation/vsomeipUserGuide index facc942ac..4c1f9842e 100644 --- a/documentation/vsomeipUserGuide +++ b/documentation/vsomeipUserGuide @@ -982,6 +982,10 @@ Specifies if the event shall be debounced based on elapsed time interval. Specifies if interval timer is reset when payload change was detected. (valid values: _false_, _true_). Defaults to _false_. +*** `send_current_value_after` (optional) +Specifies if last message should be sent after interval timeout. +(valid values: _false_, _true_). Defaults to _false_. + * `routing` (optional) + Specifies the properties of the routing. Either a string that specifies the application that hosts the diff --git a/examples/hello_world/hello_world_service.hpp b/examples/hello_world/hello_world_service.hpp index b88b73cfc..7ac3b1e7c 100644 --- a/examples/hello_world/hello_world_service.hpp +++ b/examples/hello_world/hello_world_service.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -39,7 +39,13 @@ class hello_world_service { ~hello_world_service() { - stop_thread_.join(); + if (std::this_thread::get_id() != stop_thread_.get_id()) { + if (stop_thread_.joinable()) { + stop_thread_.join(); + } + } else { + stop_thread_.detach(); + } } bool init() diff --git a/examples/notify-sample.cpp b/examples/notify-sample.cpp index 2aafa9d1d..933b01652 100644 --- a/examples/notify-sample.cpp +++ b/examples/notify-sample.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -89,8 +89,20 @@ class service_sample { notify_condition_.notify_one(); app_->clear_all_handler(); stop_offer(); - offer_thread_.join(); - notify_thread_.join(); + if (std::this_thread::get_id() != offer_thread_.get_id()) { + if (offer_thread_.joinable()) { + offer_thread_.join(); + } + } else { + offer_thread_.detach(); + } + if (std::this_thread::get_id() != notify_thread_.get_id()) { + if (notify_thread_.joinable()) { + notify_thread_.join(); + } + } else { + notify_thread_.detach(); + } app_->stop(); } #endif diff --git a/examples/request-sample.cpp b/examples/request-sample.cpp index dbf5afa1d..629af8527 100644 --- a/examples/request-sample.cpp +++ b/examples/request-sample.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -94,7 +94,13 @@ class client_sample { app_->clear_all_handler(); app_->release_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID); condition_.notify_one(); - sender_.join(); + if (std::this_thread::get_id() != sender_.get_id()) { + if (sender_.joinable()) { + sender_.join(); + } + } else { + sender_.detach(); + } app_->stop(); } #endif diff --git a/examples/response-sample.cpp b/examples/response-sample.cpp index ab1a9a1d2..3cfd9641b 100644 --- a/examples/response-sample.cpp +++ b/examples/response-sample.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -61,7 +61,13 @@ class service_sample { app_->clear_all_handler(); stop_offer(); condition_.notify_one(); - offer_thread_.join(); + if (std::this_thread::get_id() != offer_thread_.get_id()) { + if (offer_thread_.joinable()) { + offer_thread_.join(); + } + } else { + offer_thread_.detach(); + } app_->stop(); } #endif diff --git a/examples/routingmanagerd/routingmanagerd.cpp b/examples/routingmanagerd/routingmanagerd.cpp index 7290808ff..65d9d016a 100644 --- a/examples/routingmanagerd/routingmanagerd.cpp +++ b/examples/routingmanagerd/routingmanagerd.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -120,17 +120,31 @@ int routingmanagerd_process(bool _is_quiet) { if (its_application->is_routing()) { its_application->start(); #ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING - sighandler_thread.join(); + if (std::this_thread::get_id() != sighandler_thread.get_id()) { + if (sighandler_thread.joinable()) { + sighandler_thread.join(); + } + } else { + sighandler_thread.detach(); + } #endif return 0; } VSOMEIP_ERROR << "routingmanagerd has not been configured as routing - abort"; } #ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING - std::unique_lock its_lock(sighandler_mutex); - stop_sighandler = true; - sighandler_condition.notify_one(); - sighandler_thread.join(); + { + std::unique_lock its_lock(sighandler_mutex); + stop_sighandler = true; + sighandler_condition.notify_one(); + } + if (std::this_thread::get_id() != sighandler_thread.get_id()) { + if (sighandler_thread.joinable()) { + sighandler_thread.join(); + } + } else { + sighandler_thread.detach(); + } #endif return -1; } diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp index 748dfd013..ca1bd1dc7 100644 --- a/implementation/configuration/src/configuration_impl.cpp +++ b/implementation/configuration/src/configuration_impl.cpp @@ -111,6 +111,17 @@ configuration_impl::configuration_impl(const std::string &_path) netmask_ = netmask_.from_string(VSOMEIP_NETMASK); for (auto i = 0; i < ET_MAX; i++) is_configured_[i] = false; + +#ifdef _WIN32 +#if VSOMEIP_BOOST_VERSION < 106600 + routing_.host_.unicast_ = boost::asio::ip::address::from_string("127.0.0.1"); +#else + routing_.host_.unicast_ = boost::asio::ip::make_address("127.0.0.1"); +#endif + routing_.host_.port_ = 31490; + routing_.guests_.unicast_ = routing_.host_.unicast_; + routing_.guests_.ports_[{ ANY_UID, ANY_GID }].emplace(31492, 31999); +#endif } configuration_impl::configuration_impl(const configuration_impl &_other) @@ -4083,6 +4094,8 @@ configuration_impl::load_event_debounce( its_converter << std::dec << its_value; its_converter >> its_debounce->interval_; } + } else if (its_key == "send_current_value_after") { + its_debounce->send_current_value_after_ = (its_value == "true"); } } diff --git a/implementation/e2e_protection/include/crc/crc.hpp b/implementation/e2e_protection/include/crc/crc.hpp index de0ccec1b..ab7b959e7 100644 --- a/implementation/e2e_protection/include/crc/crc.hpp +++ b/implementation/e2e_protection/include/crc/crc.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -17,12 +17,15 @@ class e2e_crc { const uint8_t _start_value = 0x00U); static uint32_t calculate_profile_04(buffer_view _buffer_view, const uint32_t _start_value = 0x00000000U); + static uint64_t calculate_profile_07(buffer_view _buffer_view, + const uint64_t _start_value = 0x0000000000000000U); static uint32_t calculate_profile_custom(buffer_view _buffer_view); private: static const uint8_t lookup_table_profile_01_[256]; static const uint32_t lookup_table_profile_04_[256]; + static const uint64_t lookup_table_profile_07_[256]; static const uint32_t lookup_table_profile_custom_[256]; }; diff --git a/implementation/e2e_protection/include/e2e/profile/profile07/checker.hpp b/implementation/e2e_protection/include/e2e/profile/profile07/checker.hpp new file mode 100644 index 000000000..6aa9a887a --- /dev/null +++ b/implementation/e2e_protection/include/e2e/profile/profile07/checker.hpp @@ -0,0 +1,47 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_E2E_PROFILE07_CHECKER_HPP +#define VSOMEIP_V3_E2E_PROFILE07_CHECKER_HPP + +#include + +#include "../profile07/profile_07.hpp" +#include "../profile_interface/checker.hpp" + +namespace vsomeip_v3 { +namespace e2e { +namespace profile07 { + +class profile_07_checker final : public e2e::profile_interface::checker { + +public: + profile_07_checker(void) = delete; + + // [SWS_E2E_00389] initialize state + explicit profile_07_checker(const profile_config &_config) : + config_(_config) {} + + void check(const e2e_buffer &_buffer, instance_t _instance, + e2e::profile_interface::check_status_t &_generic_check_status) override final; + +private: + bool verify_input(const e2e_buffer &_buffer) const; + bool verify_counter(instance_t _instance, uint32_t _received_counter); + + bool read_32(const e2e_buffer &_buffer, uint32_t &_data, size_t _index) const; + bool read_64(const e2e_buffer &_buffer, uint64_t &_data, size_t _index) const; + + std::mutex check_mutex_; + + profile_config config_; + std::map counter_; +}; + +} // namespace profile_07 +} // namespace e2e +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_E2E_PROFILE07_CHECKER_HPP diff --git a/implementation/e2e_protection/include/e2e/profile/profile07/profile_07.hpp b/implementation/e2e_protection/include/e2e/profile/profile07/profile_07.hpp new file mode 100644 index 000000000..86c909fd1 --- /dev/null +++ b/implementation/e2e_protection/include/e2e/profile/profile07/profile_07.hpp @@ -0,0 +1,63 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_E2E_PROFILE07_PROFILE07_HPP +#define VSOMEIP_V3_E2E_PROFILE07_PROFILE07_HPP + +#include + +#include + +#include "../../../buffer/buffer.hpp" + +namespace vsomeip_v3 { +namespace e2e { +namespace profile07 { + +const uint8_t PROFILE_07_SIZE_OFFSET = 8; +const uint8_t PROFILE_07_COUNTER_OFFSET = 12; +const uint8_t PROFILE_07_DATAID_OFFSET = 16; +const uint8_t PROFILE_07_CRC_OFFSET = 0; + +struct profile_config; + +class profile_07 { +public: + static uint64_t compute_crc(const profile_config &_config, const e2e_buffer &_buffer); +}; + +// [SWS_E2E_00200] +struct profile_config { + profile_config() = delete; + + profile_config(uint32_t _data_id, size_t _offset, + size_t _min_data_length, size_t _max_data_length, + uint32_t _max_delta_counter) + : data_id_(_data_id), offset_(_offset), + min_data_length_(_min_data_length), max_data_length_(_max_data_length), + max_delta_counter_(_max_delta_counter), + base_(VSOMEIP_SOMEIP_HEADER_SIZE) { + } + profile_config(const profile_config &_config) = default; + profile_config &operator=(const profile_config &_config) = default; + + uint32_t data_id_; + size_t offset_; // This must be configured in bit but as a multiple of 8. + // As we must use it as an index, we do the math once at + // configuration time and use the correct data type here. + // Thus, this value is always the byte where the CRC starts. + size_t min_data_length_; + size_t max_data_length_; + uint32_t max_delta_counter_; + + // SOME/IP base + size_t base_; +}; + +} // namespace profile_07 +} // namespace e2e +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_E2E_PROFILE07_PROFILE07_HPP diff --git a/implementation/e2e_protection/include/e2e/profile/profile07/protector.hpp b/implementation/e2e_protection/include/e2e/profile/profile07/protector.hpp new file mode 100644 index 000000000..90ea990d9 --- /dev/null +++ b/implementation/e2e_protection/include/e2e/profile/profile07/protector.hpp @@ -0,0 +1,46 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_E2E_PROFILE07_PROTECTOR_HPP +#define VSOMEIP_V3_E2E_PROFILE07_PROTECTOR_HPP + +#include +#include + +#include "../profile07/profile_07.hpp" +#include "../profile_interface/protector.hpp" + +namespace vsomeip_v3 { +namespace e2e { +namespace profile07 { + +class protector final : public e2e::profile_interface::protector { +public: + protector(void) = delete; + + explicit protector(const profile_config &_config) + : config_(_config) {} + + void protect(e2e_buffer &_buffer, instance_t _instance) override final; + +private: + bool verify_inputs(e2e_buffer &_buffer); + uint32_t get_counter(instance_t _instance) const; + void increment_counter(instance_t _instance); + + void write_32(e2e_buffer &_buffer, uint32_t _data, size_t _index); + void write_64(e2e_buffer &_buffer, uint64_t _data, size_t _index); + +private: + profile_config config_; + std::map counter_; + std::mutex protect_mutex_; +}; + +} // namespace profile_07 +} // namespace e2e +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_E2E_PROFILE07_PROTECTOR_HPP diff --git a/implementation/e2e_protection/src/crc/crc.cpp b/implementation/e2e_protection/src/crc/crc.cpp index 18c7ec739..4c79c9f41 100644 --- a/implementation/e2e_protection/src/crc/crc.cpp +++ b/implementation/e2e_protection/src/crc/crc.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -184,4 +184,65 @@ const uint32_t e2e_crc::lookup_table_profile_custom_[256] = { 0xB3667A2EU, 0xC4614AB8U, 0x5D681B02U, 0x2A6F2B94U, 0xB40BBE37U, 0xC30C8EA1U, 0x5A05DF1BU, 0x2D02EF8DU }; +/** +* Calculates the CRC over the provided range. +* +* @param begin Constant iterator pointing to begin of the range. +* @param end Constant iterator pointing to end of the range. +* @param startValue The CRC value from previous call. +* @return The calculated CRC value. +* +* Parameters of the CRC: +* - Width = 64 +* - Poly = 0x42F0E1EBA9EA3693 +* - XorIn = 0xFFFFFFFFFFFFFFFF +* - ReflectIn = true +* - XorOut = 0xFFFFFFFFFFFFFFFF +* - ReflectOut = true +*/ +uint64_t e2e_crc::calculate_profile_07(buffer_view _buffer_view, const uint64_t _start_value) { + + uint64_t crc = (_start_value ^ 0xFFFFFFFFFFFFFFFFU); + + for (uint8_t byte : _buffer_view) + crc = lookup_table_profile_07_[static_cast(byte ^ crc)] ^ (crc >> 8U); + + return (crc ^ 0xFFFFFFFFFFFFFFFFU); +} + +const uint64_t e2e_crc::lookup_table_profile_07_[256] = { + 0x0000000000000000, 0xB32E4CBE03A75F6F, 0xF4843657A840A05B, 0x47AA7AE9ABE7FF34, 0x7BD0C384FF8F5E33, 0xC8FE8F3AFC28015C, 0x8F54F5D357CFFE68, 0x3C7AB96D5468A107, + 0xF7A18709FF1EBC66, 0x448FCBB7FCB9E309, 0x0325B15E575E1C3D, 0xB00BFDE054F94352, 0x8C71448D0091E255, 0x3F5F08330336BD3A, 0x78F572DAA8D1420E, 0xCBDB3E64AB761D61, + 0x7D9BA13851336649, 0xCEB5ED8652943926, 0x891F976FF973C612, 0x3A31DBD1FAD4997D, 0x064B62BCAEBC387A, 0xB5652E02AD1B6715, 0xF2CF54EB06FC9821, 0x41E11855055BC74E, + 0x8A3A2631AE2DDA2F, 0x39146A8FAD8A8540, 0x7EBE1066066D7A74, 0xCD905CD805CA251B, 0xF1EAE5B551A2841C, 0x42C4A90B5205DB73, 0x056ED3E2F9E22447, 0xB6409F5CFA457B28, + 0xFB374270A266CC92, 0x48190ECEA1C193FD, 0x0FB374270A266CC9, 0xBC9D3899098133A6, 0x80E781F45DE992A1, 0x33C9CD4A5E4ECDCE, 0x7463B7A3F5A932FA, 0xC74DFB1DF60E6D95, + 0x0C96C5795D7870F4, 0xBFB889C75EDF2F9B, 0xF812F32EF538D0AF, 0x4B3CBF90F69F8FC0, 0x774606FDA2F72EC7, 0xC4684A43A15071A8, 0x83C230AA0AB78E9C, 0x30EC7C140910D1F3, + 0x86ACE348F355AADB, 0x3582AFF6F0F2F5B4, 0x7228D51F5B150A80, 0xC10699A158B255EF, 0xFD7C20CC0CDAF4E8, 0x4E526C720F7DAB87, 0x09F8169BA49A54B3, 0xBAD65A25A73D0BDC, + 0x710D64410C4B16BD, 0xC22328FF0FEC49D2, 0x85895216A40BB6E6, 0x36A71EA8A7ACE989, 0x0ADDA7C5F3C4488E, 0xB9F3EB7BF06317E1, 0xFE5991925B84E8D5, 0x4D77DD2C5823B7BA, + 0x64B62BCAEBC387A1, 0xD7986774E864D8CE, 0x90321D9D438327FA, 0x231C512340247895, 0x1F66E84E144CD992, 0xAC48A4F017EB86FD, 0xEBE2DE19BC0C79C9, 0x58CC92A7BFAB26A6, + 0x9317ACC314DD3BC7, 0x2039E07D177A64A8, 0x67939A94BC9D9B9C, 0xD4BDD62ABF3AC4F3, 0xE8C76F47EB5265F4, 0x5BE923F9E8F53A9B, 0x1C4359104312C5AF, 0xAF6D15AE40B59AC0, + 0x192D8AF2BAF0E1E8, 0xAA03C64CB957BE87, 0xEDA9BCA512B041B3, 0x5E87F01B11171EDC, 0x62FD4976457FBFDB, 0xD1D305C846D8E0B4, 0x96797F21ED3F1F80, 0x2557339FEE9840EF, + 0xEE8C0DFB45EE5D8E, 0x5DA24145464902E1, 0x1A083BACEDAEFDD5, 0xA9267712EE09A2BA, 0x955CCE7FBA6103BD, 0x267282C1B9C65CD2, 0x61D8F8281221A3E6, 0xD2F6B4961186FC89, + 0x9F8169BA49A54B33, 0x2CAF25044A02145C, 0x6B055FEDE1E5EB68, 0xD82B1353E242B407, 0xE451AA3EB62A1500, 0x577FE680B58D4A6F, 0x10D59C691E6AB55B, 0xA3FBD0D71DCDEA34, + 0x6820EEB3B6BBF755, 0xDB0EA20DB51CA83A, 0x9CA4D8E41EFB570E, 0x2F8A945A1D5C0861, 0x13F02D374934A966, 0xA0DE61894A93F609, 0xE7741B60E174093D, 0x545A57DEE2D35652, + 0xE21AC88218962D7A, 0x5134843C1B317215, 0x169EFED5B0D68D21, 0xA5B0B26BB371D24E, 0x99CA0B06E7197349, 0x2AE447B8E4BE2C26, 0x6D4E3D514F59D312, 0xDE6071EF4CFE8C7D, + 0x15BB4F8BE788911C, 0xA6950335E42FCE73, 0xE13F79DC4FC83147, 0x521135624C6F6E28, 0x6E6B8C0F1807CF2F, 0xDD45C0B11BA09040, 0x9AEFBA58B0476F74, 0x29C1F6E6B3E0301B, + 0xC96C5795D7870F42, 0x7A421B2BD420502D, 0x3DE861C27FC7AF19, 0x8EC62D7C7C60F076, 0xB2BC941128085171, 0x0192D8AF2BAF0E1E, 0x4638A2468048F12A, 0xF516EEF883EFAE45, + 0x3ECDD09C2899B324, 0x8DE39C222B3EEC4B, 0xCA49E6CB80D9137F, 0x7967AA75837E4C10, 0x451D1318D716ED17, 0xF6335FA6D4B1B278, 0xB199254F7F564D4C, 0x02B769F17CF11223, + 0xB4F7F6AD86B4690B, 0x07D9BA1385133664, 0x4073C0FA2EF4C950, 0xF35D8C442D53963F, 0xCF273529793B3738, 0x7C0979977A9C6857, 0x3BA3037ED17B9763, 0x888D4FC0D2DCC80C, + 0x435671A479AAD56D, 0xF0783D1A7A0D8A02, 0xB7D247F3D1EA7536, 0x04FC0B4DD24D2A59, 0x3886B22086258B5E, 0x8BA8FE9E8582D431, 0xCC0284772E652B05, 0x7F2CC8C92DC2746A, + 0x325B15E575E1C3D0, 0x8175595B76469CBF, 0xC6DF23B2DDA1638B, 0x75F16F0CDE063CE4, 0x498BD6618A6E9DE3, 0xFAA59ADF89C9C28C, 0xBD0FE036222E3DB8, 0x0E21AC88218962D7, + 0xC5FA92EC8AFF7FB6, 0x76D4DE52895820D9, 0x317EA4BB22BFDFED, 0x8250E80521188082, 0xBE2A516875702185, 0x0D041DD676D77EEA, 0x4AAE673FDD3081DE, 0xF9802B81DE97DEB1, + 0x4FC0B4DD24D2A599, 0xFCEEF8632775FAF6, 0xBB44828A8C9205C2, 0x086ACE348F355AAD, 0x34107759DB5DFBAA, 0x873E3BE7D8FAA4C5, 0xC094410E731D5BF1, 0x73BA0DB070BA049E, + 0xB86133D4DBCC19FF, 0x0B4F7F6AD86B4690, 0x4CE50583738CB9A4, 0xFFCB493D702BE6CB, 0xC3B1F050244347CC, 0x709FBCEE27E418A3, 0x3735C6078C03E797, 0x841B8AB98FA4B8F8, + 0xADDA7C5F3C4488E3, 0x1EF430E13FE3D78C, 0x595E4A08940428B8, 0xEA7006B697A377D7, 0xD60ABFDBC3CBD6D0, 0x6524F365C06C89BF, 0x228E898C6B8B768B, 0x91A0C532682C29E4, + 0x5A7BFB56C35A3485, 0xE955B7E8C0FD6BEA, 0xAEFFCD016B1A94DE, 0x1DD181BF68BDCBB1, 0x21AB38D23CD56AB6, 0x9285746C3F7235D9, 0xD52F0E859495CAED, 0x6601423B97329582, + 0xD041DD676D77EEAA, 0x636F91D96ED0B1C5, 0x24C5EB30C5374EF1, 0x97EBA78EC690119E, 0xAB911EE392F8B099, 0x18BF525D915FEFF6, 0x5F1528B43AB810C2, 0xEC3B640A391F4FAD, + 0x27E05A6E926952CC, 0x94CE16D091CE0DA3, 0xD3646C393A29F297, 0x604A2087398EADF8, 0x5C3099EA6DE60CFF, 0xEF1ED5546E415390, 0xA8B4AFBDC5A6ACA4, 0x1B9AE303C601F3CB, + 0x56ED3E2F9E224471, 0xE5C372919D851B1E, 0xA26908783662E42A, 0x114744C635C5BB45, 0x2D3DFDAB61AD1A42, 0x9E13B115620A452D, 0xD9B9CBFCC9EDBA19, 0x6A978742CA4AE576, + 0xA14CB926613CF817, 0x1262F598629BA778, 0x55C88F71C97C584C, 0xE6E6C3CFCADB0723, 0xDA9C7AA29EB3A624, 0x69B2361C9D14F94B, 0x2E184CF536F3067F, 0x9D36004B35545910, + 0x2B769F17CF112238, 0x9858D3A9CCB67D57, 0xDFF2A94067518263, 0x6CDCE5FE64F6DD0C, 0x50A65C93309E7C0B, 0xE388102D33392364, 0xA4226AC498DEDC50, 0x170C267A9B79833F, + 0xDCD7181E300F9E5E, 0x6FF954A033A8C131, 0x28532E49984F3E05, 0x9B7D62F79BE8616A, 0xA707DB9ACF80C06D, 0x14299724CC279F02, 0x5383EDCD67C06036, 0xE0ADA17364673F59 +}; + } // namespace vsomeip_v3 diff --git a/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp b/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp index 82f0bced0..e441b5323 100644 --- a/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp +++ b/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -22,6 +22,10 @@ #include "../../../../e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp" #include "../../../../e2e_protection/include/e2e/profile/profile_custom/protector.hpp" +#include "../../../../e2e_protection/include/e2e/profile/profile07/checker.hpp" +#include "../../../../e2e_protection/include/e2e/profile/profile07/profile_07.hpp" +#include "../../../../e2e_protection/include/e2e/profile/profile07/protector.hpp" + namespace { template @@ -82,6 +86,11 @@ bool e2e_provider_impl::add_configuration(std::shared_ptr config) return true; } + if (config->profile == "P07") { + process_e2e_profile(config); + return true; + } + return false; } @@ -176,5 +185,30 @@ e2e_provider_impl::make_e2e_profile_config(const std::shared_ptr& conf return e2e::profile_custom::profile_config(crc_offset); } +template<> +vsomeip_v3::e2e::profile07::profile_config +e2e_provider_impl::make_e2e_profile_config(const std::shared_ptr &_config) { + + uint32_t data_id = read_value_from_config(_config, "data_id"); + + size_t offset = read_value_from_config(_config, "crc_offset"); + if (offset % 8) + VSOMEIP_ERROR << "Offset in E2E P07 configuration must be multiple of 8" + " (" << offset << ")"; + offset /= 8; + + size_t min_data_length = read_value_from_config(_config, + "min_data_length", 0); + + size_t max_data_length = read_value_from_config(_config, + "max_data_length", size_t(0xffffffff)); + + uint32_t max_delta_counter = read_value_from_config(_config, + "max_delta_counter", uint32_t(0xffffffff)); + + return e2e::profile07::profile_config(data_id, offset, + min_data_length, max_data_length, max_delta_counter); +} + } // namespace e2e } // namespace vsomeip_v3 diff --git a/implementation/e2e_protection/src/e2e/profile/profile07/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile07/checker.cpp new file mode 100644 index 000000000..f069046bc --- /dev/null +++ b/implementation/e2e_protection/src/e2e/profile/profile07/checker.cpp @@ -0,0 +1,116 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#include + +#include "../../../../include/e2e/profile/profile07/checker.hpp" +#include "../../../../../utility/include/byteorder.hpp" + +namespace vsomeip_v3 { +namespace e2e { +namespace profile07 { + +// [SWS_E2E_00495] +void profile_07_checker::check(const e2e_buffer &_buffer, instance_t _instance, + e2e::profile_interface::check_status_t &_generic_check_status) { + + std::lock_guard lock(check_mutex_); + _generic_check_status = e2e::profile_interface::generic_check_status::E2E_ERROR; + + /** @req [SWS_E2E_00496] */ + if (verify_input(_buffer)) { + /** @req [SWS_E2E_00497] */ + uint32_t its_received_length; + if (read_32(_buffer, its_received_length, PROFILE_07_SIZE_OFFSET)) { + /** @req [SWS_E2E_00498] */ + uint32_t its_received_counter; + if (read_32(_buffer, its_received_counter, PROFILE_07_COUNTER_OFFSET)) { + /** @req [SWS_E2E_00499] */ + uint32_t its_received_data_id; + if (read_32(_buffer, its_received_data_id, PROFILE_07_DATAID_OFFSET)) { + /** @req [SWS_E2E_00500] */ + uint64_t its_received_crc; + if (read_64(_buffer, its_received_crc, PROFILE_07_CRC_OFFSET)) { + uint64_t its_crc = profile_07::compute_crc(config_, _buffer); + /** @req [SWS_E2E_00501] */ + if (its_received_crc != its_crc) { + _generic_check_status = e2e::profile_interface::generic_check_status::E2E_WRONG_CRC; + VSOMEIP_ERROR << std::hex << "E2E P07 protection: CRC32 does not match: calculated CRC: " + << its_crc << " received CRC: " << its_received_crc; + } else { + if (its_received_data_id == config_.data_id_ + && static_cast(its_received_length) == _buffer.size() + && verify_counter(_instance, its_received_counter)) { + _generic_check_status = e2e::profile_interface::generic_check_status::E2E_OK; + } + } + } + } + } + } + } +} + +bool +profile_07_checker::verify_input(const e2e_buffer &_buffer) const { + + auto its_length = _buffer.size(); + return (its_length >= config_.min_data_length_ + && its_length <= config_.max_data_length_); +} + +bool +profile_07_checker::verify_counter(instance_t _instance, uint32_t _received_counter) { + + uint32_t its_delta(0); + + auto find_counter = counter_.find(_instance); + if (find_counter != counter_.end()) { + uint32_t its_counter = find_counter->second; + if (its_counter < _received_counter) + its_delta = uint32_t(_received_counter - its_counter); + else + its_delta = uint32_t(uint32_t(0xffffffff) - its_counter + _received_counter); + } else { + counter_[_instance] = _received_counter; + } + + return (its_delta <= config_.max_delta_counter_); +} + +// Read uint32_t as big-endian +bool +profile_07_checker::read_32(const e2e_buffer &_buffer, + uint32_t &_data, size_t _index) const { + + _data = VSOMEIP_BYTES_TO_LONG(_buffer[config_.offset_ + _index], + _buffer[config_.offset_ + _index + 1], + _buffer[config_.offset_ + _index + 2], + _buffer[config_.offset_ + _index + 3]); + return true; +} + +// Read uint64_t as big-endian +bool +profile_07_checker::read_64(const e2e_buffer &_buffer, + uint64_t &_data, size_t _index) const { + + _data = VSOMEIP_BYTES_TO_LONG_LONG(_buffer[config_.offset_ + _index], + _buffer[config_.offset_ + _index + 1], + _buffer[config_.offset_ + _index + 2], + _buffer[config_.offset_ + _index + 3], + _buffer[config_.offset_ + _index + 4], + _buffer[config_.offset_ + _index + 5], + _buffer[config_.offset_ + _index + 6], + _buffer[config_.offset_ + _index + 7]); + return true; +} + + +} // namespace profile01 +} // namespace e2e +} // namespace vsomeip_v3 diff --git a/implementation/e2e_protection/src/e2e/profile/profile07/profile_07.cpp b/implementation/e2e_protection/src/e2e/profile/profile07/profile_07.cpp new file mode 100644 index 000000000..6c9b7ce1a --- /dev/null +++ b/implementation/e2e_protection/src/e2e/profile/profile07/profile_07.cpp @@ -0,0 +1,28 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "../../../../include/crc/crc.hpp" +#include "../../../../include/e2e/profile/profile07/profile_07.hpp" + +namespace vsomeip_v3 { +namespace e2e { +namespace profile07 { + +uint64_t profile_07::compute_crc(const profile_config &_config, const e2e_buffer &_buffer) { + + buffer_view its_before(_buffer, _config.offset_); + uint64_t computed_crc = e2e_crc::calculate_profile_07(its_before); + + if (_config.offset_ + 8 < _buffer.size()) { + buffer_view its_after(_buffer, _config.offset_ + 8, _buffer.size()); + computed_crc = e2e_crc::calculate_profile_07(its_after, computed_crc); + } + + return computed_crc; +} + +} // namespace profile07 +} // namespace e2e +} // namespace vsomeip_v3 diff --git a/implementation/e2e_protection/src/e2e/profile/profile07/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile07/protector.cpp new file mode 100644 index 000000000..311bc5ad5 --- /dev/null +++ b/implementation/e2e_protection/src/e2e/profile/profile07/protector.cpp @@ -0,0 +1,99 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#include +#include "../../../../include/e2e/profile/profile07/protector.hpp" +#include "../../../../../utility/include/byteorder.hpp" + +namespace vsomeip_v3 { +namespace e2e { +namespace profile07 { + +/** @req [SWS_E2E_00486] */ +void +protector::protect(e2e_buffer &_buffer, instance_t _instance) { + std::lock_guard lock(protect_mutex_); + + /** @req: [SWS_E2E_00487] */ + if (verify_inputs(_buffer)) { + + /** @req [SWS_E2E_00489] */ + write_32(_buffer, static_cast(_buffer.size()), PROFILE_07_SIZE_OFFSET); + + /** @req [SWS_E2E_00490] */ + write_32(_buffer, get_counter(_instance), PROFILE_07_COUNTER_OFFSET); + + /** @req [SWS_E2E_00491] */ + write_32(_buffer, config_.data_id_, PROFILE_07_DATAID_OFFSET); + + /** @req [SWS_E2E_00492] */ + uint64_t its_crc = profile_07::compute_crc(config_, _buffer); + + /** @req [SWS_E2E_00493] */ + write_64(_buffer, its_crc, PROFILE_07_CRC_OFFSET); + + /** @req [SWS_E2E_00494] */ + increment_counter(_instance); + } +} + +bool +protector::verify_inputs(e2e_buffer &_buffer) { + + return (_buffer.size() >= config_.min_data_length_ + && _buffer.size() <= config_.max_data_length_); +} + +// Write uint32_t as big-endian +void +protector::write_32(e2e_buffer &_buffer, uint32_t _data, size_t _index) { + + _buffer[config_.offset_ + _index] = VSOMEIP_LONG_BYTE3(_data); + _buffer[config_.offset_ + _index + 1] = VSOMEIP_LONG_BYTE2(_data); + _buffer[config_.offset_ + _index + 2] = VSOMEIP_LONG_BYTE1(_data); + _buffer[config_.offset_ + _index + 3] = VSOMEIP_LONG_BYTE0(_data); +} + +// Write uint64_t as big-endian +void +protector::write_64(e2e_buffer &_buffer, uint64_t _data, size_t _index) { + + _buffer[config_.offset_ + _index] = VSOMEIP_LONG_LONG_BYTE7(_data); + _buffer[config_.offset_ + _index + 1] = VSOMEIP_LONG_LONG_BYTE6(_data); + _buffer[config_.offset_ + _index + 2] = VSOMEIP_LONG_LONG_BYTE5(_data); + _buffer[config_.offset_ + _index + 3] = VSOMEIP_LONG_LONG_BYTE4(_data); + _buffer[config_.offset_ + _index + 4] = VSOMEIP_LONG_LONG_BYTE3(_data); + _buffer[config_.offset_ + _index + 5] = VSOMEIP_LONG_LONG_BYTE2(_data); + _buffer[config_.offset_ + _index + 6] = VSOMEIP_LONG_LONG_BYTE1(_data); + _buffer[config_.offset_ + _index + 7] = VSOMEIP_LONG_LONG_BYTE0(_data); +} + +uint32_t +protector::get_counter(instance_t _instance) const { + + uint32_t its_counter(0); + + auto find_counter = counter_.find(_instance); + if (find_counter != counter_.end()) + its_counter = find_counter->second; + + return its_counter; +} + +void +protector::increment_counter(instance_t _instance) { + + auto find_counter = counter_.find(_instance); + if (find_counter != counter_.end()) + find_counter->second++; + else + counter_[_instance] = 1; +} + +} // namespace profile07 +} // namespace e2e +} // namespace vsomeip_v3 diff --git a/implementation/endpoints/include/endpoint.hpp b/implementation/endpoints/include/endpoint.hpp index 74206505d..82347d9b3 100644 --- a/implementation/endpoints/include/endpoint.hpp +++ b/implementation/endpoints/include/endpoint.hpp @@ -43,6 +43,7 @@ class endpoint { virtual void add_default_target(service_t _service, const std::string &_address, uint16_t _port) = 0; virtual void remove_default_target(service_t _service) = 0; + virtual void remove_stop_handler(service_t _service) = 0; virtual std::uint16_t get_local_port() const = 0; virtual void set_local_port(uint16_t _port) = 0; diff --git a/implementation/endpoints/include/endpoint_impl.hpp b/implementation/endpoints/include/endpoint_impl.hpp index fb0cb6a23..9d2b303c2 100644 --- a/implementation/endpoints/include/endpoint_impl.hpp +++ b/implementation/endpoints/include/endpoint_impl.hpp @@ -40,6 +40,7 @@ class endpoint_impl: public virtual endpoint { void add_default_target(service_t, const std::string &, uint16_t); void remove_default_target(service_t); + void remove_stop_handler(service_t); virtual std::uint16_t get_local_port() const = 0; virtual void set_local_port(uint16_t _port) = 0; diff --git a/implementation/endpoints/include/local_server_endpoint_impl_receive_op.hpp b/implementation/endpoints/include/local_server_endpoint_impl_receive_op.hpp index b729e37f5..53f4769a8 100644 --- a/implementation/endpoints/include/local_server_endpoint_impl_receive_op.hpp +++ b/implementation/endpoints/include/local_server_endpoint_impl_receive_op.hpp @@ -10,29 +10,52 @@ #if defined(__linux__) || defined(ANDROID) || defined(__QNX__) #include +#include namespace vsomeip_v3 { +namespace local_endpoint_receive_op { typedef boost::asio::local::stream_protocol::socket socket_type_t; typedef std::function< void (boost::system::error_code const &_error, size_t _size, - const uint32_t &, const uint32_t &)> receive_handler_t; - -struct local_server_endpoint_impl_receive_op { + const std::uint32_t &, const std::uint32_t &)> receive_handler_t; +struct storage : + public std::enable_shared_from_this +{ socket_type_t &socket_; receive_handler_t handler_; byte_t *buffer_; - size_t length_; + std::size_t length_; uid_t uid_; gid_t gid_; size_t bytes_; - void operator()(boost::system::error_code _error) { + storage( + socket_type_t &_socket, + receive_handler_t _handler, + byte_t *_buffer, + size_t _length, + uid_t _uid, + gid_t _gid, + size_t _bytes + ) : socket_(_socket), + handler_(_handler), + buffer_(_buffer), + length_(_length), + uid_(_uid), + gid_(_gid), + bytes_(_bytes) + {} +}; +inline +std::function +receive_cb (std::shared_ptr _data) { + return [_data](boost::system::error_code _error) { if (!_error) { - if (!socket_.native_non_blocking()) - socket_.native_non_blocking(true, _error); + if (!_data->socket_.native_non_blocking()) + _data->socket_.native_non_blocking(true, _error); for (;;) { ssize_t its_result; @@ -40,8 +63,8 @@ struct local_server_endpoint_impl_receive_op { // Set buffer struct iovec its_vec[1]; - its_vec[0].iov_base = buffer_; - its_vec[0].iov_len = length_; + its_vec[0].iov_base = _data->buffer_; + its_vec[0].iov_len = _data->length_; union { struct cmsghdr cmh; @@ -62,24 +85,24 @@ struct local_server_endpoint_impl_receive_op { // Call recvmsg and handle its result errno = 0; - its_result = ::recvmsg(socket_.native_handle(), &its_header, its_flags); + its_result = ::recvmsg(_data->socket_.native_handle(), &its_header, its_flags); _error = boost::system::error_code(its_result < 0 ? errno : 0, boost::asio::error::get_system_category()); - bytes_ += _error ? 0 : static_cast(its_result); + _data->bytes_ += _error ? 0 : static_cast(its_result); if (_error == boost::asio::error::interrupted) continue; if (_error == boost::asio::error::would_block || _error == boost::asio::error::try_again) { - socket_.async_wait(socket_type_t::wait_read, *this); + _data->socket_.async_wait(socket_type_t::wait_read, receive_cb(_data)); return; } if (_error) break; - if (bytes_ == 0) + if (_data->bytes_ == 0) _error = boost::asio::error::eof; // Extract credentials (UID/GID) @@ -94,8 +117,8 @@ struct local_server_endpoint_impl_receive_op { its_credentials = (struct ucred *) CMSG_DATA(cmsg); if (its_credentials) { - uid_ = its_credentials->uid; - gid_ = its_credentials->gid; + _data->uid_ = its_credentials->uid; + _data->gid_ = its_credentials->gid; break; } } @@ -106,10 +129,11 @@ struct local_server_endpoint_impl_receive_op { } // Call the handler - handler_(_error, bytes_, uid_, gid_); - } -}; + _data->handler_(_error, _data->bytes_, _data->uid_, _data->gid_); + }; +} +} // namespace local_endpoint_receive_op } // namespace vsomeip #endif // __linux__ || ANDROID diff --git a/implementation/endpoints/include/local_tcp_client_endpoint_impl.hpp b/implementation/endpoints/include/local_tcp_client_endpoint_impl.hpp index 28a83d3ae..9ea300756 100644 --- a/implementation/endpoints/include/local_tcp_client_endpoint_impl.hpp +++ b/implementation/endpoints/include/local_tcp_client_endpoint_impl.hpp @@ -34,8 +34,7 @@ class local_tcp_client_endpoint_impl: public local_tcp_client_endpoint_base_impl bool is_local() const; - bool get_remote_address(boost::asio::ip::address &_address) const; - std::uint16_t get_remote_port() const; + std::uint16_t get_local_port() const; void restart(bool _force); void print_status(); diff --git a/implementation/endpoints/include/server_endpoint_impl.hpp b/implementation/endpoints/include/server_endpoint_impl.hpp index 62a7ce514..b543d97b4 100644 --- a/implementation/endpoints/include/server_endpoint_impl.hpp +++ b/implementation/endpoints/include/server_endpoint_impl.hpp @@ -102,6 +102,7 @@ class server_endpoint_impl: public endpoint_impl, boost::system::error_code const &_error, std::size_t _bytes); void flush_cbk(endpoint_type _key, const boost::system::error_code &_error_code); + void remove_stop_handler(service_t _service); protected: virtual bool send_intern(endpoint_type _target, const byte_t *_data, diff --git a/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp b/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp index e9d5a6fa6..1e4f0fe03 100644 --- a/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp +++ b/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp @@ -7,54 +7,226 @@ #define VSOMEIP_V3_UDP_SERVER_ENDPOINT_IMPL_RECEIVE_OP_HPP_ #if VSOMEIP_BOOST_VERSION >= 106600 -#if defined(__linux__) || defined(ANDROID) || defined(__QNX__) + +#ifdef _WIN32 +#include +#endif #include +#include #include #include namespace vsomeip_v3 { - -struct udp_server_endpoint_impl_receive_op { - - typedef boost::asio::ip::udp::socket socket_type_t; - typedef boost::asio::ip::udp::endpoint endpoint_type_t; - typedef std::function< - void (boost::system::error_code const &_error, size_t _size, - uint8_t, const boost::asio::ip::address &)> receive_handler_t; - +namespace udp_endpoint_receive_op { + +typedef boost::asio::ip::udp::socket socket_type_t; +typedef boost::asio::ip::udp::endpoint endpoint_type_t; +typedef std::function< + void (boost::system::error_code const &_error, size_t _size, + std::uint8_t, const boost::asio::ip::address &)> receive_handler_t; + +struct storage : + public std::enable_shared_from_this +{ + std::recursive_mutex &multicast_mutex_; socket_type_t &socket_; endpoint_type_t &sender_; receive_handler_t handler_; byte_t *buffer_; size_t length_; - uint8_t multicast_id_; + std::uint8_t multicast_id_; bool is_v4_; boost::asio::ip::address destination_; size_t bytes_; - void operator()(boost::system::error_code _error) { + storage( + std::recursive_mutex &_multicast_mutex, + socket_type_t &_socket, + endpoint_type_t &_sender, + receive_handler_t _handler, + byte_t *_buffer, + size_t _length, + std::uint8_t _multicast_id, + bool _is_v4, + boost::asio::ip::address _destination, + size_t _bytes + ) : multicast_mutex_(_multicast_mutex), + socket_(_socket), + sender_(_sender), + handler_(_handler), + buffer_(_buffer), + length_(_length), + multicast_id_(_multicast_id), + is_v4_(_is_v4), + destination_(_destination), + bytes_(_bytes) + {} +}; - sender_ = endpoint_type_t(); // reset +std::function +receive_cb (std::shared_ptr _data) { + return [_data](boost::system::error_code _error) { + _data->sender_ = endpoint_type_t(); // reset if (!_error) { - if (!socket_.native_non_blocking()) - socket_.native_non_blocking(true, _error); + std::lock_guard its_lock(_data->multicast_mutex_); + + if (!_data->socket_.native_non_blocking()) + _data->socket_.native_non_blocking(true, _error); for (;;) { +#ifdef _WIN32 + GUID WSARecvMsg_GUID = WSAID_WSARECVMSG; + LPFN_WSARECVMSG WSARecvMsg; + DWORD its_bytes; + SOCKET its_socket { _data->socket_.native_handle() }; + + WSAIoctl(its_socket, SIO_GET_EXTENSION_FUNCTION_POINTER, + &WSARecvMsg_GUID, sizeof WSARecvMsg_GUID, + &WSARecvMsg, sizeof WSARecvMsg, + &its_bytes, NULL, NULL); + + int its_result; + int its_flags { 0 }; + + WSABUF its_buf; + WSAMSG its_msg; + + its_buf.buf = reinterpret_cast(_data->buffer_); + its_buf.len = _data->length_; + + its_msg.lpBuffers = &its_buf; + its_msg.dwBufferCount = 1; + its_msg.dwFlags = its_flags; + + // Sender & destination address info + union { + struct sockaddr_in v4; + struct sockaddr_in6 v6; + } addr; + + union { + struct cmsghdr cmh; + union { + char v4[CMSG_SPACE(sizeof(struct in_pktinfo))]; + char v6[CMSG_SPACE(sizeof(struct in6_pktinfo))]; + } control; + } control_un; + + // Prepare + if (_data->is_v4_) { + its_msg.name = reinterpret_cast(&addr); + its_msg.namelen = sizeof(sockaddr_in); + + its_msg.Control.buf = control_un.control.v4; + its_msg.Control.len = sizeof(control_un.control.v4); + } else { + its_msg.name = reinterpret_cast(&addr); + its_msg.namelen = sizeof(sockaddr_in6); + + its_msg.Control.buf = control_un.control.v6; + its_msg.Control.len = sizeof(control_un.control.v6); + } + + errno = 0; + its_result = WSARecvMsg(its_socket, &its_msg, &its_bytes, + NULL, NULL); + + _error = boost::system::error_code(its_result < 0 ? errno : 0, + boost::asio::error::get_system_category()); + _data->bytes_ += _error ? 0 : static_cast(its_bytes); + + if (_error == boost::asio::error::interrupted) + continue; + + if (_error == boost::asio::error::would_block + || _error == boost::asio::error::try_again) { + + _data->socket_.async_wait( + socket_type_t::wait_read, + receive_cb(_data) + ); + return; + } + + if (_error) + break; + + if (_data->bytes_ == 0) + _error = boost::asio::error::eof; + + // Extract sender & destination addresses + if (_data->is_v4_) { + // sender + boost::asio::ip::address_v4 its_sender_address( + ntohl(addr.v4.sin_addr.s_addr)); + std::uint16_t its_sender_port(ntohs(addr.v4.sin_port)); + _data->sender_ = endpoint_type_t(its_sender_address, its_sender_port); + + // destination + struct in_pktinfo *its_pktinfo_v4; + for (struct cmsghdr *cmsg = WSA_CMSG_FIRSTHDR(&its_msg); + cmsg != NULL; + cmsg = WSA_CMSG_NXTHDR(&its_msg, cmsg)) { + + if (cmsg->cmsg_level == IPPROTO_IP + && cmsg->cmsg_type == IP_PKTINFO + && cmsg->cmsg_len == CMSG_LEN(sizeof(*its_pktinfo_v4))) { + + its_pktinfo_v4 = (struct in_pktinfo*) WSA_CMSG_DATA(cmsg); + if (its_pktinfo_v4) { + _data->destination_ = boost::asio::ip::address_v4( + ntohl(its_pktinfo_v4->ipi_addr.s_addr)); + break; + } + } + } + } else { + boost::asio::ip::address_v6::bytes_type its_bytes; + + // sender + boost::asio::ip::address_v6 its_sender_address; + for (size_t i = 0; i < its_bytes.size(); i++) + its_bytes[i] = addr.v6.sin6_addr.s6_addr[i]; + std::uint16_t its_sender_port(ntohs(addr.v6.sin6_port)); + _data->sender_ = endpoint_type_t(its_sender_address, its_sender_port); + + struct in6_pktinfo *its_pktinfo_v6; + for (struct cmsghdr *cmsg = WSA_CMSG_FIRSTHDR(&its_msg); + cmsg != NULL; + cmsg = CMSG_NXTHDR(&its_msg, cmsg)) { + + if (cmsg->cmsg_level == IPPROTO_IPV6 + && cmsg->cmsg_type == IPV6_PKTINFO + && cmsg->cmsg_len == WSA_CMSG_LEN(sizeof(*its_pktinfo_v6))) { + + its_pktinfo_v6 = (struct in6_pktinfo *) WSA_CMSG_DATA(cmsg); + if (its_pktinfo_v6) { + for (size_t i = 0; i < its_bytes.size(); i++) + its_bytes[i] = its_pktinfo_v6->ipi6_addr.s6_addr[i]; + _data->destination_ = boost::asio::ip::address_v6(its_bytes); + break; + } + } + } + } + + break; +#else ssize_t its_result; - int its_flags(0); + int its_flags { 0 }; // Create control elements msghdr its_header = msghdr(); struct iovec its_vec[1]; // Prepare - its_vec[0].iov_base = buffer_; - its_vec[0].iov_len = length_; + its_vec[0].iov_base = _data->buffer_; + its_vec[0].iov_len = _data->length_; // Add io buffer its_header.msg_iov = its_vec; @@ -75,7 +247,7 @@ struct udp_server_endpoint_impl_receive_op { } control_un; // Prepare - if (is_v4_) { + if (_data->is_v4_) { its_header.msg_name = &addr; its_header.msg_namelen = sizeof(sockaddr_in); @@ -91,35 +263,37 @@ struct udp_server_endpoint_impl_receive_op { // Call recvmsg and handle its result errno = 0; - its_result = ::recvmsg(socket_.native_handle(), &its_header, its_flags); + its_result = ::recvmsg(_data->socket_.native_handle(), &its_header, its_flags); _error = boost::system::error_code(its_result < 0 ? errno : 0, boost::asio::error::get_system_category()); - bytes_ += _error ? 0 : static_cast(its_result); + _data->bytes_ += _error ? 0 : static_cast(its_result); if (_error == boost::asio::error::interrupted) continue; if (_error == boost::asio::error::would_block || _error == boost::asio::error::try_again) { - - socket_.async_wait(socket_type_t::wait_read, *this); + _data->socket_.async_wait( + socket_type_t::wait_read, + receive_cb(_data) + ); return; } if (_error) break; - if (bytes_ == 0) + if (_data->bytes_ == 0) _error = boost::asio::error::eof; // Extract sender & destination addresses - if (is_v4_) { + if (_data->is_v4_) { // sender boost::asio::ip::address_v4 its_sender_address( ntohl(addr.v4.sin_addr.s_addr)); in_port_t its_sender_port(ntohs(addr.v4.sin_port)); - sender_ = endpoint_type_t(its_sender_address, its_sender_port); + _data->sender_ = endpoint_type_t(its_sender_address, its_sender_port); // destination struct in_pktinfo *its_pktinfo_v4; @@ -133,7 +307,7 @@ struct udp_server_endpoint_impl_receive_op { its_pktinfo_v4 = (struct in_pktinfo*) CMSG_DATA(cmsg); if (its_pktinfo_v4) { - destination_ = boost::asio::ip::address_v4( + _data->destination_ = boost::asio::ip::address_v4( ntohl(its_pktinfo_v4->ipi_addr.s_addr)); break; } @@ -147,7 +321,7 @@ struct udp_server_endpoint_impl_receive_op { its_bytes[i] = addr.v6.sin6_addr.s6_addr[i]; boost::asio::ip::address_v6 its_sender_address(its_bytes); in_port_t its_sender_port(ntohs(addr.v6.sin6_port)); - sender_ = endpoint_type_t(its_sender_address, its_sender_port); + _data->sender_ = endpoint_type_t(its_sender_address, its_sender_port); struct in6_pktinfo *its_pktinfo_v6; for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&its_header); @@ -162,7 +336,7 @@ struct udp_server_endpoint_impl_receive_op { if (its_pktinfo_v6) { for (size_t i = 0; i < its_bytes.size(); i++) its_bytes[i] = its_pktinfo_v6->ipi6_addr.s6_addr[i]; - destination_ = boost::asio::ip::address_v6(its_bytes); + _data->destination_ = boost::asio::ip::address_v6(its_bytes); break; } } @@ -170,17 +344,18 @@ struct udp_server_endpoint_impl_receive_op { } break; +#endif // _WIN32 } } // Call the handler - handler_(_error, bytes_, multicast_id_, destination_); - } -}; + _data->handler_(_error, _data->bytes_, _data->multicast_id_, _data->destination_); + }; +} -} // namespace vsomeip +} // namespace udp_endpoint_receive_op +} // namespace vsomeip_v3 -#endif // __linux__ || ANDROID #endif // VSOMEIP_BOOST_VERSION >= 106600 #endif // VSOMEIP_V3_UDP_SERVER_ENDPOINT_IMPL_RECEIVE_OP_HPP_ diff --git a/implementation/endpoints/include/virtual_server_endpoint_impl.hpp b/implementation/endpoints/include/virtual_server_endpoint_impl.hpp index 98b3958e8..1739f8406 100644 --- a/implementation/endpoints/include/virtual_server_endpoint_impl.hpp +++ b/implementation/endpoints/include/virtual_server_endpoint_impl.hpp @@ -50,6 +50,7 @@ class virtual_server_endpoint_impl : public endpoint, public std::enable_shared_ void add_default_target(service_t _service, const std::string &_address, uint16_t _port); void remove_default_target(service_t _service); + void remove_stop_handler(service_t _service); bool get_remote_address(boost::asio::ip::address &_address) const; std::uint16_t get_local_port() const; diff --git a/implementation/endpoints/src/endpoint_impl.cpp b/implementation/endpoints/src/endpoint_impl.cpp index 196a22adc..757d3b4c4 100644 --- a/implementation/endpoints/src/endpoint_impl.cpp +++ b/implementation/endpoints/src/endpoint_impl.cpp @@ -110,6 +110,10 @@ template void endpoint_impl::remove_default_target(service_t) { } +template +void endpoint_impl::remove_stop_handler(service_t) { +} + template void endpoint_impl::increment_use_count() { use_count_++; diff --git a/implementation/endpoints/src/endpoint_manager_base.cpp b/implementation/endpoints/src/endpoint_manager_base.cpp index 540ef3103..9dff9785a 100644 --- a/implementation/endpoints/src/endpoint_manager_base.cpp +++ b/implementation/endpoints/src/endpoint_manager_base.cpp @@ -141,6 +141,8 @@ std::shared_ptr endpoint_manager_base::create_local_server( VSOMEIP_INFO << __func__ << ": Connecting to other clients from " << its_address.to_string() << ":" << std::dec << local_port_; + rm_->set_sec_client_port(local_port_); + } catch (const boost::system::system_error &e) { if (e.code() == boost::asio::error::address_in_use) { its_used_ports.insert(its_port); diff --git a/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp index 6445dab9a..693f8f210 100644 --- a/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp @@ -291,14 +291,17 @@ void local_tcp_client_endpoint_impl::receive_cbk( } } -bool local_tcp_client_endpoint_impl::get_remote_address( - boost::asio::ip::address &_address) const { - (void)_address; - return false; -} +std::uint16_t local_tcp_client_endpoint_impl::get_local_port() const { + + std::lock_guard its_lock(socket_mutex_); + if (socket_->is_open()) { + boost::system::error_code its_error; + endpoint_type its_local = socket_->local_endpoint(its_error); + if (!its_error) + return its_local.port(); + } -std::uint16_t local_tcp_client_endpoint_impl::get_remote_port() const { - return 0; + return local_.port(); } void local_tcp_client_endpoint_impl::set_local_port() { diff --git a/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp index 219262e9c..e9ff0ee40 100644 --- a/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp @@ -47,8 +47,10 @@ local_tcp_server_endpoint_impl::local_tcp_server_endpoint_impl( acceptor_.open(_local.protocol(), ec); boost::asio::detail::throw_error(ec, "acceptor open"); +#ifndef _WIN32 acceptor_.set_option(boost::asio::socket_base::reuse_address(true), ec); boost::asio::detail::throw_error(ec, "acceptor set_option"); +#endif acceptor_.bind(_local, ec); boost::asio::detail::throw_error(ec, "acceptor bind"); @@ -649,7 +651,7 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk( sec_client_.host = htonl(uint32_t(its_address.to_v4().to_ulong())); } - sec_client_.port = its_port; + sec_client_.port = htons(its_port); security::sync_client(&sec_client_); its_host->on_message(&recv_buffer_[its_start], diff --git a/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp b/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp index e23b59864..948fe9258 100644 --- a/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp @@ -477,7 +477,7 @@ void local_uds_server_endpoint_impl::connection::start() { is_stopped_ = false; #if VSOMEIP_BOOST_VERSION >= 106600 - local_server_endpoint_impl_receive_op its_operation { + auto its_storage = std::make_shared( socket_, std::bind( &local_uds_server_endpoint_impl::connection::receive_cbk, @@ -489,11 +489,12 @@ void local_uds_server_endpoint_impl::connection::start() { ), &recv_buffer_[recv_buffer_size_], left_buffer_size, - std::numeric_limits::max(), - std::numeric_limits::max(), - std::numeric_limits::min() - }; - socket_.async_wait(socket_type::wait_read, its_operation); + std::numeric_limits::max(), + std::numeric_limits::max(), + std::numeric_limits::min() + ); + + socket_.async_wait(socket_type::wait_read, local_endpoint_receive_op::receive_cb(its_storage)); #else socket_.async_receive( boost::asio::buffer(&recv_buffer_[recv_buffer_size_], left_buffer_size), diff --git a/implementation/endpoints/src/server_endpoint_impl.cpp b/implementation/endpoints/src/server_endpoint_impl.cpp index 90e4b85c8..120175367 100644 --- a/implementation/endpoints/src/server_endpoint_impl.cpp +++ b/implementation/endpoints/src/server_endpoint_impl.cpp @@ -686,8 +686,56 @@ void server_endpoint_impl::send_cbk( boost::system::error_code ec; its_data.sent_timer_.cancel(ec); + // Extracts some information for logging puposes. + // + // TODO(brunoldsilva): Code like this is used in a lot of places. It might be worth moving this + // into a proper function. + auto parse_message_ids = [] ( + const message_buffer_ptr_t& buffer, + service_t& its_service, + method_t& its_method, + client_t& its_client, + session_t& its_session + ) { + if (buffer && buffer->size() > VSOMEIP_SESSION_POS_MAX) { + its_service = VSOMEIP_BYTES_TO_WORD( + (*buffer)[VSOMEIP_SERVICE_POS_MIN], + (*buffer)[VSOMEIP_SERVICE_POS_MAX]); + its_method = VSOMEIP_BYTES_TO_WORD( + (*buffer)[VSOMEIP_METHOD_POS_MIN], + (*buffer)[VSOMEIP_METHOD_POS_MAX]); + its_client = VSOMEIP_BYTES_TO_WORD( + (*buffer)[VSOMEIP_CLIENT_POS_MIN], + (*buffer)[VSOMEIP_CLIENT_POS_MAX]); + its_session = VSOMEIP_BYTES_TO_WORD( + (*buffer)[VSOMEIP_SESSION_POS_MIN], + (*buffer)[VSOMEIP_SESSION_POS_MAX]); + } + }; + + message_buffer_ptr_t its_buffer; + if (its_data.queue_.size()) { + its_buffer = its_data.queue_.front().first; + } + service_t its_service(0); + method_t its_method(0); + client_t its_client(0); + session_t its_session(0); + if (!_error) { - its_data.queue_size_ -= its_data.queue_.front().first->size(); + const std::size_t payload_size = its_data.queue_.front().first->size(); + if (payload_size <= its_data.queue_size_) { + its_data.queue_size_ -= payload_size; + } else { + parse_message_ids(its_buffer, its_service, its_method, its_client, its_session); + VSOMEIP_WARNING << __func__ << ": prevented queue_size underflow. queue_size: " + << its_data.queue_size_ << " payload_size: " << payload_size << " payload: (" + << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): [" + << std::hex << std::setw(4) << std::setfill('0') << its_service << "." + << std::hex << std::setw(4) << std::setfill('0') << its_method << "." + << std::hex << std::setw(4) << std::setfill('0') << its_session << "]"; + its_data.queue_size_ = 0; + } its_data.queue_.pop_front(); update_last_departure(its_data); @@ -709,30 +757,9 @@ void server_endpoint_impl::send_cbk( its_data.is_sending_ = false; } } else { - message_buffer_ptr_t its_buffer; - if (its_data.queue_.size()) { - its_buffer = its_data.queue_.front().first; - } - service_t its_service(0); - method_t its_method(0); - client_t its_client(0); - session_t its_session(0); - if (its_buffer && its_buffer->size() > VSOMEIP_SESSION_POS_MAX) { - its_service = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_SERVICE_POS_MIN], - (*its_buffer)[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_METHOD_POS_MIN], - (*its_buffer)[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_CLIENT_POS_MIN], - (*its_buffer)[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_SESSION_POS_MIN], - (*its_buffer)[VSOMEIP_SESSION_POS_MAX]); - } // error: sending of outstanding responses isn't started again // delete remaining outstanding responses + parse_message_ids(its_buffer, its_service, its_method, its_client, its_session); VSOMEIP_WARNING << "sei::send_cbk received error: " << _error.message() << " (" << std::dec << _error.value() << ") " << get_remote_information(it) << " " @@ -769,6 +796,19 @@ void server_endpoint_impl::flush_cbk( } } +template +void server_endpoint_impl::remove_stop_handler(service_t _service) { + + std::ostream&& its_services_log{VSOMEIP_INFO}; + its_services_log << __func__ << ": "; + + std::lock_guard its_lock{mutex_}; + for (const auto &its_service : prepare_stop_handlers_) + its_services_log << std::hex << std::setw(4) << std::setfill('0') << its_service.first << ' '; + + prepare_stop_handlers_.erase(_service); +} + template size_t server_endpoint_impl::get_queue_size() const { size_t its_queue_size(0); @@ -838,9 +878,10 @@ void server_endpoint_impl::update_last_departure( // Instantiate template #ifdef __linux__ -template class server_endpoint_impl; #if VSOMEIP_BOOST_VERSION < 106600 template class server_endpoint_impl; +#else +template class server_endpoint_impl; #endif #endif diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp index 440cbcfe8..48e35c5d3 100644 --- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/udp_server_endpoint_impl.cpp @@ -21,11 +21,11 @@ #include "../include/tp.hpp" #include "../include/udp_server_endpoint_impl.hpp" #include "../include/udp_server_endpoint_impl_receive_op.hpp" -#include "../../routing/include/routing_host.hpp" #include "../../configuration/include/configuration.hpp" +#include "../../routing/include/routing_host.hpp" +#include "../../service_discovery/include/defines.hpp" #include "../../utility/include/byteorder.hpp" #include "../../utility/include/utility.hpp" -#include "../../service_discovery/include/defines.hpp" namespace ip = boost::asio::ip; @@ -240,7 +240,8 @@ void udp_server_endpoint_impl::receive_multicast(uint8_t _multicast_id) { if (_multicast_id == multicast_id_ && multicast_socket_ && multicast_socket_->is_open()) { #if VSOMEIP_BOOST_VERSION >= 106600 - udp_server_endpoint_impl_receive_op its_operation { + auto its_storage = std::make_shared( + multicast_mutex_, *multicast_socket_, multicast_remote_, std::bind( @@ -257,9 +258,9 @@ void udp_server_endpoint_impl::receive_multicast(uint8_t _multicast_id) { _multicast_id, is_v4_, boost::asio::ip::address(), - std::numeric_limits::min() - }; - multicast_socket_->async_wait(socket_type::wait_read, its_operation); + std::numeric_limits::min() + ); + multicast_socket_->async_wait(socket_type::wait_read, udp_endpoint_receive_op::receive_cb(its_storage)); #else multicast_socket_->async_receive_from( boost::asio::buffer(&multicast_recv_buffer_[0], max_message_size_), diff --git a/implementation/endpoints/src/virtual_server_endpoint_impl.cpp b/implementation/endpoints/src/virtual_server_endpoint_impl.cpp index 9db414a33..cdcbd5197 100644 --- a/implementation/endpoints/src/virtual_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/virtual_server_endpoint_impl.cpp @@ -94,6 +94,10 @@ void virtual_server_endpoint_impl::remove_default_target( (void)_service; } +void virtual_server_endpoint_impl::remove_stop_handler( + service_t) { +} + bool virtual_server_endpoint_impl::get_remote_address( boost::asio::ip::address &_address) const { (void)_address; diff --git a/implementation/protocol/src/subscribe_command.cpp b/implementation/protocol/src/subscribe_command.cpp index f517dce24..0bc85b99c 100644 --- a/implementation/protocol/src/subscribe_command.cpp +++ b/implementation/protocol/src/subscribe_command.cpp @@ -44,7 +44,8 @@ subscribe_command::serialize(std::vector &_buffer, its_size += sizeof(filter_->on_change_) + sizeof(filter_->on_change_resets_interval_) + sizeof(filter_->interval_) - + (filter_->ignore_.size() * (sizeof(size_t) + sizeof(byte_t))); + + (filter_->ignore_.size() * (sizeof(size_t) + sizeof(byte_t))) + + sizeof(filter_->send_current_value_after_); } if (its_size > std::numeric_limits::max()) { @@ -78,6 +79,8 @@ subscribe_command::serialize(std::vector &_buffer, _buffer[its_offset] = its_ignore.second; its_offset += sizeof(byte_t); } + _buffer[its_offset] = static_cast(filter_->send_current_value_after_); + its_offset += sizeof(filter_->send_current_value_after_); } } @@ -138,6 +141,9 @@ subscribe_command::deserialize(const std::vector &_buffer, filter_->ignore_.emplace(std::make_pair(its_key, its_value)); } + + std::memcpy(&filter_->send_current_value_after_, &_buffer[its_offset], sizeof(filter_->send_current_value_after_)); + its_offset += sizeof(filter_->send_current_value_after_); } } diff --git a/implementation/routing/include/event.hpp b/implementation/routing/include/event.hpp index 55f22690e..fd43638d2 100644 --- a/implementation/routing/include/event.hpp +++ b/implementation/routing/include/event.hpp @@ -149,6 +149,8 @@ class event const std::shared_ptr &_payload, bool _force); void update_payload_unlocked(); + void get_pending_updates(const std::set &_clients); + private: routing_manager *routing_; mutable std::mutex mutex_; diff --git a/implementation/routing/include/routing_manager.hpp b/implementation/routing/include/routing_manager.hpp index 49ae8066b..3c19a9fea 100644 --- a/implementation/routing/include/routing_manager.hpp +++ b/implementation/routing/include/routing_manager.hpp @@ -134,6 +134,11 @@ class routing_manager { virtual void set_routing_state(routing_state_e _routing_state) = 0; virtual void send_get_offered_services_info(client_t _client, offer_type_e _offer_type) = 0; + + virtual void debounce_timeout_update_cbk(const boost::system::error_code &_error, const std::shared_ptr &_event, client_t _client, const std::shared_ptr &_filter) = 0; + virtual void register_debounce(const std::shared_ptr &_filter, client_t _client, const std::shared_ptr &_event) = 0; + virtual void remove_debounce(client_t _client, event_t _event) = 0; + virtual void update_debounce_clients(const std::set &_clients, event_t _event) = 0; }; } // namespace vsomeip_v3 diff --git a/implementation/routing/include/routing_manager_base.hpp b/implementation/routing/include/routing_manager_base.hpp index a8c2598ed..a7ba02438 100644 --- a/implementation/routing/include/routing_manager_base.hpp +++ b/implementation/routing/include/routing_manager_base.hpp @@ -55,9 +55,15 @@ class routing_manager_base : public routing_manager, virtual session_t get_session(bool _is_request); virtual const vsomeip_sec_client_t *get_sec_client() const; + virtual void set_sec_client_port(port_t _port); virtual std::string get_env(client_t _client) const = 0; + virtual void debounce_timeout_update_cbk(const boost::system::error_code &_error, const std::shared_ptr &_event, client_t _client, const std::shared_ptr &_filter); + virtual void register_debounce(const std::shared_ptr &_filter, client_t _client, const std::shared_ptr &_event); + virtual void remove_debounce(client_t _client, event_t _event); + virtual void update_debounce_clients(const std::set &_clients, event_t _event); + virtual bool is_routing_manager() const; virtual void init() = 0; @@ -182,6 +188,9 @@ class routing_manager_base : public routing_manager, > &_subscribed_eventgroups, bool _remove_sec_client); + std::set > find_eventgroups(service_t _service, + instance_t _instance) const; + std::shared_ptr find_eventgroup(service_t _service, instance_t _instance, eventgroup_t _eventgroup) const; @@ -293,6 +302,10 @@ class routing_manager_base : public routing_manager, std::map > > > events_; + boost::asio::steady_timer debounce_timer; + std::multimap, event_t>> debounce_clients_; + mutable std::mutex debounce_mutex_; + std::mutex event_registration_mutex_; #ifdef USE_DLT diff --git a/implementation/routing/include/routing_manager_host.hpp b/implementation/routing/include/routing_manager_host.hpp index 18a74afca..27925bb4b 100644 --- a/implementation/routing/include/routing_manager_host.hpp +++ b/implementation/routing/include/routing_manager_host.hpp @@ -33,6 +33,7 @@ class routing_manager_host { virtual session_t get_session(bool _is_request) = 0; virtual const vsomeip_sec_client_t *get_sec_client() const = 0; + virtual void set_sec_client_port(port_t _port) = 0; virtual const std::string & get_name() const = 0; virtual std::shared_ptr get_configuration() const = 0; diff --git a/implementation/routing/src/event.cpp b/implementation/routing/src/event.cpp index e0af104bd..8f5b44ce4 100644 --- a/implementation/routing/src/event.cpp +++ b/implementation/routing/src/event.cpp @@ -614,6 +614,9 @@ event::add_subscriber(eventgroup_t _eventgroup, return (is_changed || is_elapsed); }; + + // Create a new callback for this client if filter interval is used + routing_->register_debounce(_filter, _client, shared_from_this()); } else { filters_.erase(_client); } @@ -636,8 +639,10 @@ event::remove_subscriber(eventgroup_t _eventgroup, client_t _client) { std::lock_guard its_lock(eventgroups_mutex_); auto find_eventgroup = eventgroups_.find(_eventgroup); - if (find_eventgroup != eventgroups_.end()) + if (find_eventgroup != eventgroups_.end()) { find_eventgroup->second.erase(_client); + routing_->remove_debounce(_client, get_event()); + } } bool @@ -714,6 +719,14 @@ event::get_filtered_subscribers(bool _force) { return its_filtered_subscribers; } +// Get the clients that have pending updates after debounce timeout +void +event::get_pending_updates(const std::set &_clients) { + if(has_changed(current_->get_payload(), update_->get_payload())) { + routing_->update_debounce_clients(_clients, get_event()); + } +} + std::set event::update_and_get_filtered_subscribers( const std::shared_ptr &_payload, bool _is_from_remote) { @@ -722,6 +735,7 @@ event::update_and_get_filtered_subscribers( (void)prepare_update_payload_unlocked(_payload, true); auto its_subscribers = get_filtered_subscribers(!_is_from_remote); + get_pending_updates(its_subscribers); if (_is_from_remote) update_payload_unlocked(); diff --git a/implementation/routing/src/routing_manager_base.cpp b/implementation/routing/src/routing_manager_base.cpp index bd7b557ab..dde6b260c 100644 --- a/implementation/routing/src/routing_manager_base.cpp +++ b/implementation/routing/src/routing_manager_base.cpp @@ -24,7 +24,8 @@ namespace vsomeip_v3 { routing_manager_base::routing_manager_base(routing_manager_host *_host) : host_(_host), io_(host_->get_io()), - configuration_(host_->get_configuration()) + configuration_(host_->get_configuration()), + debounce_timer(host_->get_io()) #ifdef USE_DLT , tc_(trace::connector_impl::get()) #endif @@ -49,6 +50,88 @@ routing_manager_base::routing_manager_base(routing_manager_host *_host) : } } +void routing_manager_base::debounce_timeout_update_cbk(const boost::system::error_code &_error, const std::shared_ptr &_event, client_t _client, const std::shared_ptr &_filter) { + if (!_error) { + std::lock_guard its_lock(debounce_mutex_); + if (_event && (_event->get_subscribers().find(_client) != _event->get_subscribers().end()) && _filter) { + bool is_elapsed{false}; + auto its_current = std::chrono::steady_clock::now(); + + int64_t elapsed = std::chrono::duration_cast( + its_current - _filter->last_forwarded_).count(); + is_elapsed = (_filter->last_forwarded_ == std::chrono::steady_clock::time_point::max() + || elapsed >= _filter->interval_); + + auto debounce_client = debounce_clients_.begin(); + auto event_id = std::get<3>(debounce_client->second); + bool has_update = std::get<1>(debounce_client->second); + if (is_elapsed) { + if (std::get<0>(debounce_client->second) == _client && has_update) { + _event->notify_one(_client, false); + has_update = false; + } + elapsed = 0; + } + + debounce_clients_.erase(debounce_client); + + auto timeout = std::chrono::steady_clock::now() + std::chrono::milliseconds(_filter->interval_ - elapsed); + debounce_clients_.emplace(timeout, std::make_tuple(_client, has_update, std::bind(&routing_manager_base::debounce_timeout_update_cbk, shared_from_this(), + std::placeholders::_1, _event, _client, _filter), event_id)); + } + + if (debounce_clients_.size() > 0) { + debounce_timer.expires_from_now(std::chrono::duration_cast(debounce_clients_.begin()->first - std::chrono::steady_clock::now())); + debounce_timer.async_wait(std::get<2>(debounce_clients_.begin()->second)); + } + } +} + +void routing_manager_base::register_debounce(const std::shared_ptr &_filter, client_t _client, const std::shared_ptr &_event) { + if (_filter->send_current_value_after_ == true) { + std::lock_guard its_lock(debounce_mutex_); + auto sec = std::chrono::milliseconds(_filter->interval_); + auto timeout = std::chrono::steady_clock::now() + sec; + + auto elem = debounce_clients_.emplace(timeout, std::make_tuple(_client, false, std::bind(&routing_manager_base::debounce_timeout_update_cbk, shared_from_this(), + std::placeholders::_1, _event, _client, _filter), _event->get_event())); + + if (elem == debounce_clients_.begin()) { + debounce_timer.cancel(); + debounce_timer.expires_from_now(sec); + debounce_timer.async_wait(std::get<2>(elem->second)); + } + } +} + +void routing_manager_base::remove_debounce(client_t _client, event_t _event) { + std::vector temp_client_vector; + + std::lock_guard its_lock(debounce_mutex_); + for (auto &debounce_client: debounce_clients_) { + if ((std::get<0>(debounce_client.second) == _client) && (std::get<3>(debounce_client.second) == _event)) { + temp_client_vector.push_back(debounce_client.first); + } + } + for (auto &elem: temp_client_vector) { + debounce_clients_.erase(elem); + } +} + +void routing_manager_base::update_debounce_clients(const std::set &_clients, event_t _event) { + std::lock_guard its_lock(debounce_mutex_); + for (auto& debounce_client : debounce_clients_) { + if (_event == std::get<3>(debounce_client.second)) { + std::get<1>(debounce_client.second) = true; + for (auto s : _clients) { + if (std::get<0>(debounce_client.second) == s) { + std::get<1>(debounce_client.second) = false; + } + } + } + } +} + boost::asio::io_context &routing_manager_base::get_io() { return io_; @@ -73,6 +156,11 @@ const vsomeip_sec_client_t *routing_manager_base::get_sec_client() const { return host_->get_sec_client(); } +void routing_manager_base::set_sec_client_port(port_t _port) { + + host_->set_sec_client_port(_port); +} + std::string routing_manager_base::get_client_host() const { std::lock_guard its_env_lock(env_mutex_); return env_; @@ -326,7 +414,7 @@ void routing_manager_base::register_event(client_t _client, its_event->set_eventgroups(_eventgroups); } - if (_is_shadow && !_epsilon_change_func) { + if ((_is_shadow || is_routing_manager()) && !_epsilon_change_func) { std::shared_ptr its_debounce = configuration_->get_debounce(host_->get_name(), _service, _instance, _notifier); if (its_debounce) { @@ -411,13 +499,34 @@ void routing_manager_base::register_event(client_t _client, } return (is_changed || is_elapsed); }; + + // Create a new callback for this client if filter interval is used + register_debounce(its_debounce, _client, its_event); } else { - _epsilon_change_func = [](const std::shared_ptr &_old, - const std::shared_ptr &_new) { + if (!_is_shadow && is_routing_manager()) { + _epsilon_change_func = [](const std::shared_ptr &_old, + const std::shared_ptr &_new) { + bool is_change = (_old->get_length() != _new->get_length()); + if (!is_change) { + std::size_t its_pos = 0; + const byte_t *its_old_data = _old->get_data(); + const byte_t *its_new_data = _new->get_data(); + while (!is_change && its_pos < _old->get_length()) { + is_change = (*its_old_data++ != *its_new_data++); + its_pos++; + } + } + return is_change; + }; + } + else { + _epsilon_change_func = [](const std::shared_ptr &_old, + const std::shared_ptr &_new) { (void)_old; (void)_new; return true; - }; + }; + } } } @@ -1129,6 +1238,25 @@ std::shared_ptr routing_manager_base::find_event(service_t _service, return its_event; } +std::set > +routing_manager_base::find_eventgroups( + service_t _service, instance_t _instance) const { + + std::set > its_eventgroups; + + std::lock_guard its_lock{eventgroups_mutex_}; + auto found_service = eventgroups_.find(_service); + if (found_service != eventgroups_.end()) { + auto found_instance = found_service->second.find(_instance); + if (found_instance != found_service->second.end()) { + for (const auto &e : found_instance->second) + its_eventgroups.insert(e.second); + } + } + + return its_eventgroups; +} + std::shared_ptr routing_manager_base::find_eventgroup( service_t _service, instance_t _instance, eventgroup_t _eventgroup) const { @@ -1334,7 +1462,7 @@ std::shared_ptr routing_manager_base::get_serializer() { << std::hex << std::setw(4) << std::setfill('0') << get_client() << " has no available serializer. Waiting..."; - serializer_condition_.wait(its_lock); + serializer_condition_.wait(its_lock, [this] { return !serializers_.empty(); } ); VSOMEIP_INFO << __func__ << ": Client " << std::hex << std::setw(4) << std::setfill('0') << get_client() @@ -1361,7 +1489,7 @@ std::shared_ptr routing_manager_base::get_deserializer() { while (deserializers_.empty()) { VSOMEIP_INFO << std::hex << "client " << get_client() << "routing_manager_base::get_deserializer ~> all in use!"; - deserializer_condition_.wait(its_lock); + deserializer_condition_.wait(its_lock, [this] { return !deserializers_.empty(); }); VSOMEIP_INFO << std::hex << "client " << get_client() << "routing_manager_base::get_deserializer ~> wait finished!"; } diff --git a/implementation/routing/src/routing_manager_client.cpp b/implementation/routing/src/routing_manager_client.cpp index e253288a5..dbb2bd2eb 100644 --- a/implementation/routing/src/routing_manager_client.cpp +++ b/implementation/routing/src/routing_manager_client.cpp @@ -255,8 +255,10 @@ routing_manager_client::on_net_state_change( if (!sender_) sender_ = ep_mgr_->create_local(VSOMEIP_ROUTING_CLIENT); - if (sender_) + if (sender_) { + host_->set_sec_client_port(sender_->get_local_port()); sender_->start(); + } } } } else { @@ -267,6 +269,7 @@ routing_manager_client::on_net_state_change( if (sender_) { on_disconnect(sender_); + host_->set_sec_client_port(VSOMEIP_SEC_PORT_UNSET); sender_->stop(); } diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp index 54e75f7b8..79f408045 100644 --- a/implementation/routing/src/routing_manager_impl.cpp +++ b/implementation/routing/src/routing_manager_impl.cpp @@ -409,13 +409,13 @@ bool routing_manager_impl::offer_service(client_t _client, if (!insert_offer_command(_service, _instance, uint8_t(protocol::id_e::OFFER_SERVICE_ID), _client, _major, _minor)) { - VSOMEIP_INFO << __func__ << " (" + VSOMEIP_INFO << "rmi::" << __func__ << " (" << std::hex << std::setw(4) << std::setfill('0') << _client <<"): [" << std::hex << std::setw(4) << std::setfill('0') << _service << "." << std::hex << std::setw(4) << std::setfill('0') << _instance << ":" << std::dec << int(_major) << "." << std::dec << _minor << "]" << " (" << std::boolalpha << _must_queue << ")" - << " not offering as method was called via erase_offer_command()!"; + << " not offering service, because insert_offer_command returned false!"; return false; } } @@ -524,7 +524,7 @@ void routing_manager_impl::stop_offer_service(client_t _client, if (!insert_offer_command(_service, _instance, uint8_t(protocol::id_e::STOP_OFFER_SERVICE_ID), _client, _major, _minor)) { - VSOMEIP_INFO << __func__ + VSOMEIP_INFO << "rmi::" << __func__ << " (" << std::hex << std::setw(4) << std::setfill('0') << _client <<"): [" << std::hex << std::setw(4) << std::setfill('0') << _service << "." << std::hex << std::setw(4) << std::setfill('0') << _instance @@ -659,6 +659,25 @@ void routing_manager_impl::release_service(client_t _client, service_t _service, its_info->set_endpoint(nullptr, true); its_info->set_endpoint(nullptr, false); unset_all_eventpayloads(_service, _instance); + } else { + auto its_eventgroups = find_eventgroups(_service, _instance); + for (const auto &eg : its_eventgroups) { + auto its_id = eg->get_eventgroup(); + auto its_events = eg->get_events(); + bool eg_has_subscribers{false}; + for (const auto &e : its_events) { + e->remove_subscriber(its_id, _client); + if (!e->get_subscribers().empty()) { + eg_has_subscribers = true; + } + } + discovery_->unsubscribe(_service, _instance, its_id, _client); + if (!eg_has_subscribers) { + for (const auto &e : its_events) { + e->unset_payload(true); + } + } + } } } else { if (discovery_) { @@ -1442,6 +1461,11 @@ bool routing_manager_impl::stop_offer_service_remotely(service_t _service, // still offered its_copied_info->set_endpoint(std::shared_ptr(), !_reliable); discovery_->stop_offer_service(its_copied_info, true); + VSOMEIP_INFO << __func__ << " only sending the StopOffer to [" + << std::hex << std::setw(4) << std::setfill('0') << _service << '.' + << std::hex << std::setw(4) << std::setfill('0') << _instance << ']' + << " with reliability (" << std::boolalpha << !_reliable << ')' + << " as the service is still partly offered!"; } } @@ -3769,9 +3793,9 @@ void routing_manager_impl::set_routing_state(routing_state_e _routing_state) { if (its_client == VSOMEIP_ROUTING_CLIENT) { // Inconsistency between services_ and local_services_ table detected // --> cleanup. - VSOMEIP_WARNING << "rmi::set_routing_state (table inconsistency)" << __func__ + VSOMEIP_WARNING << "rmi::" << __func__ << " Found table inconsistency for [" << std::hex << std::setw(4) << std::setfill('0') << its_service.first << "." - << std::hex << std::setw(4) << std::setfill('0') << its_instance.first; + << std::hex << std::setw(4) << std::setfill('0') << its_instance.first << "]"; del_routing_info(its_service.first, its_instance.first, has_reliable, has_unreliable); @@ -3779,6 +3803,13 @@ void routing_manager_impl::set_routing_state(routing_state_e _routing_state) { auto its_pending_offer = pending_offers_.find(its_service.first); if (its_pending_offer != pending_offers_.end()) its_pending_offer->second.erase(its_instance.first); + + // Remove the service from the offer_commands_ and prepare_stop_handlers_ to force the next offer to be processed + offer_commands_.erase(std::make_pair(its_service.first, its_instance.first)); + if (has_reliable) + its_instance.second->get_endpoint(true)->remove_stop_handler(its_service.first); + if (has_unreliable) + its_instance.second->get_endpoint(false)->remove_stop_handler(its_service.first); } VSOMEIP_WARNING << "Service " << std::hex << std::setfill('0') diff --git a/implementation/runtime/include/application_impl.hpp b/implementation/runtime/include/application_impl.hpp index ad803abd4..67187a87f 100644 --- a/implementation/runtime/include/application_impl.hpp +++ b/implementation/runtime/include/application_impl.hpp @@ -16,6 +16,10 @@ #include #include + +#if VSOMEIP_BOOST_VERSION >= 106600 +#include +#endif #include #include #include @@ -141,6 +145,7 @@ class application_impl: public application, VSOMEIP_EXPORT void set_client(const client_t &_client); VSOMEIP_EXPORT session_t get_session(bool _is_request); VSOMEIP_EXPORT const vsomeip_sec_client_t *get_sec_client() const; + VSOMEIP_EXPORT void set_sec_client_port(port_t _port); VSOMEIP_EXPORT diagnosis_t get_diagnosis() const; VSOMEIP_EXPORT std::shared_ptr get_configuration() const; VSOMEIP_EXPORT std::shared_ptr get_public_configuration() const; @@ -357,7 +362,12 @@ class application_impl: public application, boost::asio::io_context io_; std::set > io_threads_; +#if VSOMEIP_BOOST_VERSION >= 106600 + std::shared_ptr > work_; +#else std::shared_ptr work_; +#endif // Proxy to or the Routing Manager itself std::shared_ptr routing_; diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp index 0c3ef9d27..aba906b7e 100644 --- a/implementation/runtime/src/application_impl.cpp +++ b/implementation/runtime/src/application_impl.cpp @@ -55,7 +55,12 @@ application_impl::application_impl(const std::string &_name, const std::string & is_initialized_(false), name_(_name), path_(_path), +#if VSOMEIP_BOOST_VERSION >= 106600 + work_(std::make_shared >(io_.get_executor())), +#else work_(std::make_shared(io_)), +#endif routing_(0), state_(state_type_e::ST_DEREGISTERED), security_mode_(security_mode_e::SM_ON), @@ -171,6 +176,14 @@ bool application_impl::init() { sec_client_.group = ANY_GID; #endif } else { + auto its_guest_address = configuration_->get_routing_guest_address(); + if (its_guest_address.is_v4()) { +#if VSOMEIP_BOOST_VERSION < 106600 + sec_client_.host = htonl(static_cast(its_guest_address.to_v4().to_ulong())); +#else + sec_client_.host = htonl(its_guest_address.to_v4().to_uint()); +#endif + } sec_client_.port = VSOMEIP_SEC_PORT_UNSET; } @@ -1467,6 +1480,11 @@ const vsomeip_sec_client_t *application_impl::get_sec_client() const { return &sec_client_; } +void application_impl::set_sec_client_port(port_t _port) { + + sec_client_.port = htons(_port); +} + std::shared_ptr application_impl::get_configuration() const { return configuration_; } diff --git a/implementation/utility/include/byteorder.hpp b/implementation/utility/include/byteorder.hpp index deda45c9c..f5ad3f024 100644 --- a/implementation/utility/include/byteorder.hpp +++ b/implementation/utility/include/byteorder.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -19,6 +19,7 @@ #define VSOMEIP_BYTES_TO_WORD(x0, x1) (uint16_t((x0) << 8 | (x1))) #define VSOMEIP_BYTES_TO_LONG(x0, x1, x2, x3) (uint32_t((x0) << 24 | (x1) << 16 | (x2) << 8 | (x3))) +#define VSOMEIP_BYTES_TO_LONG_LONG(x0, x1, x2, x3, x4, x5, x6, x7) (uint64_t (x0) << 56 | uint64_t (x1) << 48 | uint64_t (x2) << 40 | uint64_t (x3) << 32 | uint64_t (x4) << 24 | uint64_t (x5) << 16 | uint64_t (x6) << 8 | uint64_t (x7)) #define VSOMEIP_WORDS_TO_LONG(x0, x1) (uint32_t((x0) << 16 | (x1))) @@ -30,6 +31,15 @@ #define VSOMEIP_LONG_BYTE2(x) (uint8_t(((x) >> 16) & 0xFF)) #define VSOMEIP_LONG_BYTE3(x) (uint8_t(((x) >> 24) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE0(x) (uint8_t((x) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE1(x) (uint8_t(((x) >> 8) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE2(x) (uint8_t(((x) >> 16) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE3(x) (uint8_t(((x) >> 24) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE4(x) (uint8_t(((x) >> 32) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE5(x) (uint8_t(((x) >> 40) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE6(x) (uint8_t(((x) >> 48) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE7(x) (uint8_t(((x) >> 56) & 0xFF)) + #define VSOMEIP_LONG_WORD0(x) (uint16_t((x) & 0xFFFF)) #define VSOMEIP_LONG_WORD1(x) (uint16_t(((x) >> 16) & 0xFFFF)) @@ -37,6 +47,7 @@ #define VSOMEIP_BYTES_TO_WORD(x0, x1) (uint16_t((x1) << 8 | (x0))) #define VSOMEIP_BYTES_TO_LONG(x0, x1, x2, x3) (uint32_t((x3) << 24 | (x2) << 16 | (x1) << 8 | (x0))) +#define VSOMEIP_BYTES_TO_LONG_LONG(x0, x1, x2, x3, x4, x5, x6, x7) (uint64_t((x7) << 56 | (x6) << 48 | (x5) << 40 | (x4) << 32 | (x3) << 24 | (x2) << 16 | (x1) << 8 | (x0))) #define VSOMEIP_WORD_BYTE0(x) (uint8_t((x) >> 8)) #define VSOMEIP_WORD_BYTE1(x) (uint8_t((x) & 0xFF)) @@ -46,6 +57,15 @@ #define VSOMEIP_LONG_BYTE2(x) (uint8_t(((x) >> 8) & 0xFF)) #define VSOMEIP_LONG_BYTE3(x) (uint8_t((x) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE0(x) (uint8_t(((x) >> 56) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE1(x) (uint8_t(((x) >> 48) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE2(x) (uint8_t(((x) >> 40) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE3(x) (uint8_t(((x) >> 32) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE4(x) (uint8_t(((x) >> 24) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE5(x) (uint8_t(((x) >> 16) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE6(x) (uint8_t(((x) >> 8) & 0xFF)) +#define VSOMEIP_LONG_LONG_BYTE7(x) (uint8_t((x) & 0xFF)) + #define VSOMEIP_LONG_WORD0(x) (uint16_t((((x) >> 16) & 0xFFFF)) #define VSOMEIP_LONG_WORD1(x) (uint16_t(((x) & 0xFFFF)) diff --git a/interface/vsomeip/structured_types.hpp b/interface/vsomeip/structured_types.hpp index 059d33c7e..565c20ca0 100644 --- a/interface/vsomeip/structured_types.hpp +++ b/interface/vsomeip/structured_types.hpp @@ -22,14 +22,16 @@ struct debounce_filter_t { debounce_filter_t() : on_change_(false), on_change_resets_interval_(false), - interval_(-1) { + interval_(-1), + send_current_value_after_(false) { } debounce_filter_t(const debounce_filter_t &_source) : on_change_(_source.on_change_), on_change_resets_interval_(_source.on_change_resets_interval_), interval_(_source.interval_), - ignore_(_source.ignore_) { + ignore_(_source.ignore_), + send_current_value_after_(_source.send_current_value_after_) { } inline void operator=(const debounce_filter_t &_other) { @@ -37,6 +39,7 @@ struct debounce_filter_t { on_change_resets_interval_ = _other.on_change_resets_interval_; interval_ = _other.interval_; ignore_ = _other.ignore_; + send_current_value_after_ = _other.send_current_value_after_; } inline bool operator==(const debounce_filter_t &_other) const { @@ -44,7 +47,8 @@ struct debounce_filter_t { return (on_change_ == _other.on_change_ && on_change_resets_interval_ == _other.on_change_resets_interval_ && interval_ == _other.interval_ - && ignore_ == _other.ignore_); + && ignore_ == _other.ignore_ + && send_current_value_after_ == _other.send_current_value_after_); } inline bool operator!=(const debounce_filter_t &_other) const { @@ -52,13 +56,15 @@ struct debounce_filter_t { return (on_change_ != _other.on_change_ || on_change_resets_interval_ != _other.on_change_resets_interval_ || interval_ != _other.interval_ - || ignore_ != _other.ignore_); + || ignore_ != _other.ignore_ + || send_current_value_after_ != _other.send_current_value_after_); } bool on_change_; bool on_change_resets_interval_; int64_t interval_; std::map ignore_; + bool send_current_value_after_; }; } // namespace vsomeip_v3 diff --git a/libvsomeip.yaml b/libvsomeip.yaml index 1dc15dc2b..0ad6b7426 100644 --- a/libvsomeip.yaml +++ b/libvsomeip.yaml @@ -1,5 +1,5 @@ - name: libvsomeip - version: 3.4.9 + version: 3.4.10 vendor: Lynx Team license: concluded: CLOSED and MPLv2 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 846698d60..f66ac5d33 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -78,6 +78,7 @@ else() endif() set(TEST_E2E_PROFILE_04 "ON") +set(TEST_E2E_PROFILE_07 "ON") SET(TEST_UID_DEFAULT_VALUE "123456789") SET(TEST_UID "${TEST_UID_DEFAULT_VALUE}" CACHE STRING diff --git a/test/bat_tests/excluded_tests.txt b/test/bat_tests/excluded_tests.txt new file mode 100644 index 000000000..17daa05a1 --- /dev/null +++ b/test/bat_tests/excluded_tests.txt @@ -0,0 +1,120 @@ +application_test_single_process +application_test_availability +big_payload_test_external +big_payload_test_external_random +big_payload_test_external_limited +big_payload_test_external_limited_general +big_payload_test_external_queue_limited_general +big_payload_test_external_queue_limited_specific +big_payload_test_external_udp +big_payload_test_local_limited +big_payload_test_local_queue_limited +big_payload_test_local_random +big_payload_test_local_tcp_queue_limited +big_payload_test_local_tcp_limited +big_payload_test_local_tcp_random +big_payload_test_local_tcp +configuration-test +client_id_test_diff_client_ids_diff_ports +client_id_test_diff_client_ids_same_ports +client_id_test_diff_client_ids_partial_same_ports +client_id_test_utility_discontinuous_masked_511 +client_id_test_utility_masked_127 +client_id_test_utility_masked_4095 +client_id_test_utility_masked_511 +client_id_test_utility +cpu_load_test +debounce_test +e2e_profile_04_test_external +e2e_test_external +event_test_payload_fixed_udp +event_test_payload_fixed_tcp +event_test_payload_dynamic_udp +event_test_payload_dynamic_tcp +initial_event_test_diff_client_ids_diff_ports_udp +initial_event_test_diff_client_ids_diff_ports_tcp +initial_event_test_diff_client_ids_diff_ports_both_tcp_and_udp +initial_event_test_diff_client_ids_same_ports_udp +initial_event_test_diff_client_ids_same_ports_tcp +initial_event_test_diff_client_ids_same_ports_both_tcp_and_udp +initial_event_test_diff_client_ids_partial_same_ports_both_tcp_and_udp +initial_event_test_diff_client_ids_diff_ports_same_service_id_udp +initial_event_test_multiple_events_diff_client_ids_diff_ports_udp +initial_event_test_multiple_events_diff_client_ids_diff_ports_tcp +initial_event_test_multiple_events_diff_client_ids_diff_ports_both_tcp_and_udp +initial_event_test_multiple_events_diff_client_ids_same_ports_udp +initial_event_test_multiple_events_diff_client_ids_same_ports_tcp +initial_event_test_multiple_events_diff_client_ids_same_ports_both_tcp_and_udp +initial_event_test_multiple_events_diff_client_ids_partial_same_ports_both_tcp_and_udp +initial_event_test_multiple_events_diff_client_ids_diff_ports_same_service_id_udp +initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_udp +initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_tcp +initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_both_tcp_and_udp +initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_udp +initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_tcp +initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_both_tcp_and_udp +initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_partial_same_ports_both_tcp_and_udp +initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_same_service_id_udp +initial_event_test_multiple_events_diff_client_ids_diff_ports_partial_subscription_udp +initial_event_test_multiple_events_diff_client_ids_diff_ports_partial_subscription_tcp +initial_event_test_multiple_events_diff_client_ids_diff_ports_partial_subscription_both_tcp_and_udp +initial_event_test_diff_client_ids_same_ports_udp_client_subscribes_twice +magic_cookies_test +external_local_routing_test +malicious_data_test_events +malicious_data_test_protocol_version +malicious_data_test_message_type +malicious_data_test_return_code +malicious_data_test_wrong_header_fields_udp +npdu_test_udp +npdu_test_tcp +offer_test_local +offer_test_big_sd_msg +offer_test_external +offered_services_info_test_local +local_payload_test_huge_payload +external_local_payload_test_client_external +external_local_payload_test_client_local_and_external +external_local_routing_test_starter +pending_subscription_test_subscribe +pending_subscription_test_alternating_subscribe_unsubscribe +pending_subscription_test_unsubscribe +pending_subscription_test_alternating_subscribe_unsubscribe_nack +pending_subscription_test_alternating_subscribe_unsubscribe_same_port +pending_subscription_test_subscribe_resubscribe_mixed +pending_subscription_test_subscribe_stopsubscribe_subscribe +pending_subscription_test_send_request_to_sd_port +restart_routing_test +someip_tp_test_in_sequence +someip_tp_test_mixed +someip_tp_test_incomplete +someip_tp_test_duplicate +someip_tp_test_overlap +someip_tp_test_overlap_front_back +subscribe_notify_one_test_diff_client_ids_diff_ports_udp +subscribe_notify_one_test_diff_client_ids_diff_ports_tcp +subscribe_notify_one_test_diff_client_ids_diff_ports_both_tcp_and_udp +subscribe_notify_test_diff_client_ids_diff_ports_udp_local_tcp +subscribe_notify_test_diff_client_ids_diff_ports_udp +subscribe_notify_test_diff_client_ids_diff_ports_tcp_local_tcp +subscribe_notify_test_diff_client_ids_diff_ports_tcp +subscribe_notify_test_diff_client_ids_diff_ports_both_tcp_and_udp_local_tcp +subscribe_notify_test_diff_client_ids_diff_ports_both_tcp_and_udp +subscribe_notify_test_diff_client_ids_same_ports_udp_local_tcp +subscribe_notify_test_diff_client_ids_same_ports_tcp_local_tcp +subscribe_notify_test_diff_client_ids_same_ports_tcp +subscribe_notify_test_diff_client_ids_same_ports_udp +subscribe_notify_test_diff_client_ids_same_ports_both_tcp_and_udp_local_tcp +subscribe_notify_test_diff_client_ids_same_ports_both_tcp_and_udp +subscribe_notify_test_diff_client_ids_partial_same_ports_both_tcp_and_udp_local_tcp +subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_udp_local_tcp +subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_udp_local_tcp +subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_udp +subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_udp +subscribe_notify_test_diff_client_ids_partial_same_ports_both_tcp_and_udp +subscribe_notify_test_one_event_two_eventgroups_udp_local_tcp +subscribe_notify_test_one_event_two_eventgroups_tcp_local_tcp +subscribe_notify_test_one_event_two_eventgroups_udp +subscribe_notify_test_one_event_two_eventgroups_tcp +suspend_resume_test_initial +internal_routing_disabled_acceptance_test diff --git a/test/bat_tests/sdk_vsomeip_tests.py b/test/bat_tests/sdk_vsomeip_tests.py new file mode 100644 index 000000000..3ea5e8dbc --- /dev/null +++ b/test/bat_tests/sdk_vsomeip_tests.py @@ -0,0 +1,42 @@ +# Copyright (C) 2023. BMW Car IT GmbH. All rights reserved. + +# Test it with: +# run-mgu-tests -v --sdktarget xs-baytrail-hmgua1 --sysroot / /usr/share/vsomeip-sdktests/sdktests/sdk_vsomeip_tests.py + +import os +import shutil +import tempfile + +import subprocess +if not hasattr(subprocess, "TimeoutExpired"): + import subprocess32 as subprocess + +from mtee.testing.tools import assert_true, assert_equal, metadata + +@metadata(testsuite="BAT", component="vsomeip", teststage="regression") +class TestsSdkVSomeIP(object): + + def setup(self): + TestsSdkVSomeIP._srcdir = os.path.dirname(os.path.realpath(__file__)); + TestsSdkVSomeIP._tempdir = tempfile.mkdtemp() + + def teardown(self): + if os.path.isdir(TestsSdkVSomeIP._tempdir): + shutil.rmtree(TestsSdkVSomeIP._tempdir) + + @staticmethod + def run_command(cmd, cwd=None, input=None): + if cwd==None: cwd=os.getcwd() + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=False,cwd=cwd) + if input: proc.stdin.write(input.encode('utf-8')) + (stdo,stde)=proc.communicate() + stdo = stdo.decode('utf-8') if stdo else None + stde = stde.decode('utf-8') if stde else None + assert_equal(0, proc.returncode, "Running command failed") + + def test_001_hello_world(self): + TestsSdkVSomeIP.run_command(["cmake", os.path.join(TestsSdkVSomeIP._srcdir, "hello_world")], cwd=TestsSdkVSomeIP._tempdir) + TestsSdkVSomeIP.run_command(["make"], cwd=TestsSdkVSomeIP._tempdir) + + assert_true(os.path.isfile(os.path.join(TestsSdkVSomeIP._tempdir, "hello_world_service")), "hello_world_service not created") + assert_true(os.path.isfile(os.path.join(TestsSdkVSomeIP._tempdir, "hello_world_client")), "hello_world_client not created") diff --git a/test/bat_tests/test-metadata.json b/test/bat_tests/test-metadata.json new file mode 100644 index 000000000..74b9834e2 --- /dev/null +++ b/test/bat_tests/test-metadata.json @@ -0,0 +1,1088 @@ +[ + { + "name": "configuration-test", + "command": [ + "configuration-test" + ], + "environment": {} + }, + { + "name": "application_test", + "command": [ + "application_test_starter.sh" + ], + "environment": {} + }, + { + "name": "application_test_single_process", + "command": [ + "application_test_single_process_starter.sh" + ], + "environment": {} + }, + { + "name": "application_test_availability", + "command": [ + "application_test_availability_starter.sh" + ], + "environment": {} + }, + { + "name": "magic_cookies_test", + "command": [ + "magic_cookies_test_starter.sh" + ], + "environment": {} + }, + { + "name": "header_factory_test", + "command": [ + "header_factory_test" + ], + "environment": {} + }, + { + "name": "header_factory_test_send_receive", + "command": [ + "header_factory_test_send_receive_starter.sh" + ], + "environment": {} + }, + { + "name": "local_routing_test", + "command": [ + "local_routing_test_starter.sh" + ], + "environment": {} + }, + { + "name": "external_local_routing_test", + "command": [ + "external_local_routing_test_starter.sh" + ], + "environment": {} + }, + { + "name": "local_payload_test", + "command": [ + "local_payload_test_starter.sh" + ], + "environment": {} + }, + { + "name": "local_payload_test_huge_payload", + "command": [ + "local_payload_test_huge_payload_starter.sh" + ], + "environment": {} + }, + { + "name": "external_local_payload_test_client_local", + "command": [ + "external_local_payload_test_client_local_starter.sh" + ], + "environment": {} + }, + { + "name": "external_local_payload_test_client_external", + "command": [ + "external_local_payload_test_client_external_starter.sh" + ], + "environment": {} + }, + { + "name": "external_local_payload_test_client_local_and_external", + "command": [ + "external_local_payload_test_client_local_and_external_starter.sh" + ], + "environment": {} + }, + { + "name": "big_payload_test_local", + "command": [ + "big_payload_test_local_starter.sh" + ], + "environment": {} + }, + { + "name": "big_payload_test_local_random", + "command": [ + "big_payload_test_local_starter.sh", + "RANDOM" + ], + "environment": {} + }, + { + "name": "big_payload_test_local_limited", + "command": [ + "big_payload_test_local_starter.sh", + "LIMITED" + ], + "environment": {} + }, + { + "name": "big_payload_test_local_queue_limited", + "command": [ + "big_payload_test_local_starter.sh", + "QUEUELIMITEDGENERAL" + ], + "environment": {} + }, + { + "name": "big_payload_test_local_tcp", + "command": [ + "big_payload_test_local_tcp_starter.sh" + ], + "environment": {} + }, + { + "name": "big_payload_test_local_tcp_random", + "command": [ + "big_payload_test_local_tcp_starter.sh", + "RANDOM" + ], + "environment": {} + }, + { + "name": "big_payload_test_local_tcp_limited", + "command": [ + "big_payload_test_local_tcp_starter.sh", + "LIMITED" + ], + "environment": {} + }, + { + "name": "big_payload_test_local_tcp_queue_limited", + "command": [ + "big_payload_test_local_tcp_starter.sh", + "QUEUELIMITEDGENERAL" + ], + "environment": {} + }, + { + "name": "big_payload_test_external", + "command": [ + "big_payload_test_external_starter.sh" + ], + "environment": {} + }, + { + "name": "big_payload_test_external_random", + "command": [ + "big_payload_test_external_starter.sh", + "RANDOM" + ], + "environment": {} + }, + { + "name": "big_payload_test_external_limited", + "command": [ + "big_payload_test_external_starter.sh", + "LIMITED" + ], + "environment": {} + }, + { + "name": "big_payload_test_external_limited_general", + "command": [ + "big_payload_test_external_starter.sh", + "LIMITEDGENERAL" + ], + "environment": {} + }, + { + "name": "big_payload_test_external_queue_limited_general", + "command": [ + "big_payload_test_external_starter.sh", + "QUEUELIMITEDGENERAL" + ], + "environment": {} + }, + { + "name": "big_payload_test_external_queue_limited_specific", + "command": [ + "big_payload_test_external_starter.sh", + "QUEUELIMITEDSPECIFIC" + ], + "environment": {} + }, + { + "name": "big_payload_test_external_udp", + "command": [ + "big_payload_test_external_starter.sh", + "UDP" + ], + "environment": {} + }, + { + "name": "client_id_test_diff_client_ids_diff_ports", + "command": [ + "client_id_test_master_starter.sh", + "client_id_test_diff_client_ids_diff_ports_master.json" + ], + "environment": {} + }, + { + "name": "client_id_test_diff_client_ids_same_ports", + "command": [ + "client_id_test_master_starter.sh", + "client_id_test_diff_client_ids_same_ports_master.json" + ], + "environment": {} + }, + { + "name": "client_id_test_diff_client_ids_partial_same_ports", + "command": [ + "client_id_test_master_starter.sh", + "client_id_test_diff_client_ids_partial_same_ports_master.json" + ], + "environment": {} + }, + { + "name": "client_id_test_utility", + "command": [ + "client_id_test_utility" + ], + "environment": { + "VSOMEIP_CONFIGURATION": "client_id_test_utility.json" + } + }, + { + "name": "client_id_test_utility_masked_511", + "command": [ + "client_id_test_utility" + ], + "environment": { + "VSOMEIP_CONFIGURATION": "client_id_test_utility_masked_511.json" + } + }, + { + "name": "client_id_test_utility_masked_4095", + "command": [ + "client_id_test_utility" + ], + "environment": { + "VSOMEIP_CONFIGURATION": "client_id_test_utility_masked_4095.json" + } + }, + { + "name": "client_id_test_utility_masked_127", + "command": [ + "client_id_test_utility" + ], + "environment": { + "VSOMEIP_CONFIGURATION": "client_id_test_utility_masked_127.json" + } + }, + { + "name": "client_id_test_utility_discontinuous_masked_511", + "command": [ + "client_id_test_utility" + ], + "environment": { + "VSOMEIP_CONFIGURATION": "client_id_test_utility_discontinuous_masked_511.json" + } + }, + { + "name": "debounce_test", + "command": [ + "debounce_test_master_starter.sh" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_udp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "UDP", + "subscribe_notify_test_diff_client_ids_diff_ports_master_udp_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_tcp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP", + "subscribe_notify_test_diff_client_ids_diff_ports_master_tcp_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_both_tcp_and_udp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP_AND_UDP", + "subscribe_notify_test_diff_client_ids_diff_ports_master_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_same_ports_udp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "UDP", + "subscribe_notify_test_diff_client_ids_same_ports_master_udp_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_same_ports_tcp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP", + "subscribe_notify_test_diff_client_ids_same_ports_master_tcp_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_same_ports_both_tcp_and_udp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP_AND_UDP", + "subscribe_notify_test_diff_client_ids_same_ports_master_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_partial_same_ports_both_tcp_and_udp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP_AND_UDP", + "subscribe_notify_test_diff_client_ids_partial_same_ports_master_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_udp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "UDP", + "subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp_local_tcp.json", + "SAME_SERVICE_ID" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_udp_local_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "UDP", + "subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_one_event_two_eventgroups_udp_local_tcp", + "command": [ + "subscribe_notify_test_one_event_two_eventgroups_master_starter.sh", + "UDP", + "subscribe_notify_test_one_event_two_eventgroups_master_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_one_event_two_eventgroups_tcp_local_tcp", + "command": [ + "subscribe_notify_test_one_event_two_eventgroups_master_starter.sh", + "TCP", + "subscribe_notify_test_one_event_two_eventgroups_master_local_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_udp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "UDP", + "subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP", + "subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_both_tcp_and_udp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP_AND_UDP", + "subscribe_notify_test_diff_client_ids_diff_ports_master.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_same_ports_udp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "UDP", + "subscribe_notify_test_diff_client_ids_same_ports_master_udp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_same_ports_tcp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP", + "subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_same_ports_both_tcp_and_udp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP_AND_UDP", + "subscribe_notify_test_diff_client_ids_same_ports_master.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_partial_same_ports_both_tcp_and_udp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "TCP_AND_UDP", + "subscribe_notify_test_diff_client_ids_partial_same_ports_master.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_udp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "UDP", + "subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json", + "SAME_SERVICE_ID" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_udp", + "command": [ + "subscribe_notify_test_master_starter.sh", + "UDP", + "subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_one_event_two_eventgroups_udp", + "command": [ + "subscribe_notify_test_one_event_two_eventgroups_master_starter.sh", + "UDP", + "subscribe_notify_test_one_event_two_eventgroups_master.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_test_one_event_two_eventgroups_tcp", + "command": [ + "subscribe_notify_test_one_event_two_eventgroups_master_starter.sh", + "TCP", + "subscribe_notify_test_one_event_two_eventgroups_master.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_one_test_diff_client_ids_diff_ports_udp", + "command": [ + "subscribe_notify_one_test_master_starter.sh", + "UDP", + "subscribe_notify_one_test_diff_client_ids_diff_ports_master_udp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_one_test_diff_client_ids_diff_ports_tcp", + "command": [ + "subscribe_notify_one_test_master_starter.sh", + "TCP", + "subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json" + ], + "environment": {} + }, + { + "name": "subscribe_notify_one_test_diff_client_ids_diff_ports_both_tcp_and_udp", + "command": [ + "subscribe_notify_one_test_master_starter.sh", + "TCP_AND_UDP", + "subscribe_notify_one_test_diff_client_ids_diff_ports_master.json" + ], + "environment": {} + }, + { + "name": "cpu_load_test", + "command": [ + "cpu_load_test_master_starter.sh" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_diff_ports_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master_udp.json", + "UDP" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_diff_ports_tcp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master_tcp.json", + "TCP" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_diff_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master.json", + "TCP_AND_UDP" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_same_ports_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master_udp.json", + "UDP" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_same_ports_tcp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master_tcp.json", + "TCP" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_same_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master.json", + "TCP_AND_UDP" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_partial_same_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_partial_same_ports_master.json", + "TCP_AND_UDP" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_diff_ports_same_service_id_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json", + "TCP_AND_UDP", + "SAME_SERVICE_ID" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_diff_ports_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master_udp.json", + "UDP", + "MULTIPLE_EVENTS" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_diff_ports_tcp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master_tcp.json", + "TCP", + "MULTIPLE_EVENTS" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_diff_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master.json", + "TCP_AND_UDP", + "MULTIPLE_EVENTS" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_same_ports_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master_udp.json", + "UDP", + "MULTIPLE_EVENTS" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_same_ports_tcp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master_tcp.json", + "TCP", + "MULTIPLE_EVENTS" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_same_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master.json", + "TCP_AND_UDP", + "MULTIPLE_EVENTS" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_partial_same_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_partial_same_ports_master.json", + "TCP_AND_UDP", + "MULTIPLE_EVENTS" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_diff_ports_same_service_id_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json", + "TCP_AND_UDP", + "SAME_SERVICE_ID", + "MULTIPLE_EVENTS" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master_udp.json", + "UDP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ON_AVAILABILITY" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_tcp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master_tcp.json", + "TCP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ON_AVAILABILITY" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master.json", + "TCP_AND_UDP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ON_AVAILABILITY" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master_udp.json", + "UDP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ON_AVAILABILITY" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_tcp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master_tcp.json", + "TCP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ON_AVAILABILITY" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master.json", + "TCP_AND_UDP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ON_AVAILABILITY" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_partial_same_ports_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_partial_same_ports_master.json", + "TCP_AND_UDP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ON_AVAILABILITY" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_same_service_id_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json", + "TCP_AND_UDP", + "SAME_SERVICE_ID", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ON_AVAILABILITY" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_diff_ports_partial_subscription_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master_udp.json", + "UDP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ONLY_ONE" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_diff_ports_partial_subscription_tcp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master_tcp.json", + "TCP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ONLY_ONE" + ], + "environment": {} + }, + { + "name": "initial_event_test_multiple_events_diff_client_ids_diff_ports_partial_subscription_both_tcp_and_udp", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_diff_ports_master.json", + "TCP_AND_UDP", + "MULTIPLE_EVENTS", + "SUBSCRIBE_ONLY_ONE" + ], + "environment": {} + }, + { + "name": "initial_event_test_diff_client_ids_same_ports_udp_client_subscribes_twice", + "command": [ + "initial_event_test_master_starter.sh", + "initial_event_test_diff_client_ids_same_ports_master_udp.json", + "UDP", + "CLIENT_SUBSCRIBES_TWICE" + ], + "environment": {} + }, + { + "name": "offer_test_local", + "command": [ + "offer_test_local_starter.sh" + ], + "environment": {} + }, + { + "name": "offer_test_external", + "command": [ + "offer_test_external_master_starter.sh" + ], + "environment": {} + }, + { + "name": "offer_test_big_sd_msg", + "command": [ + "offer_test_big_sd_msg_master_starter.sh" + ], + "environment": {} + }, + { + "name": "offered_services_info_test_local", + "command": [ + "offered_services_info_test_local_starter.sh" + ], + "environment": {} + }, + { + "name": "restart_routing_test", + "command": [ + "restart_routing_test_starter.sh" + ], + "environment": {} + }, + { + "name": "pending_subscription_test_subscribe", + "command": [ + "pending_subscription_test_master_starter.sh", + "SUBSCRIBE" + ], + "environment": {} + }, + { + "name": "pending_subscription_test_alternating_subscribe_unsubscribe", + "command": [ + "pending_subscription_test_master_starter.sh", + "SUBSCRIBE_UNSUBSCRIBE" + ], + "environment": {} + }, + { + "name": "pending_subscription_test_unsubscribe", + "command": [ + "pending_subscription_test_master_starter.sh", + "UNSUBSCRIBE" + ], + "environment": {} + }, + { + "name": "pending_subscription_test_alternating_subscribe_unsubscribe_nack", + "command": [ + "pending_subscription_test_master_starter.sh", + "SUBSCRIBE_UNSUBSCRIBE_NACK" + ], + "environment": {} + }, + { + "name": "pending_subscription_test_alternating_subscribe_unsubscribe_same_port", + "command": [ + "pending_subscription_test_master_starter.sh", + "SUBSCRIBE_UNSUBSCRIBE_SAME_PORT" + ], + "environment": {} + }, + { + "name": "pending_subscription_test_subscribe_resubscribe_mixed", + "command": [ + "pending_subscription_test_master_starter.sh", + "SUBSCRIBE_RESUBSCRIBE_MIXED" + ], + "environment": {} + }, + { + "name": "pending_subscription_test_subscribe_stopsubscribe_subscribe", + "command": [ + "pending_subscription_test_master_starter.sh", + "SUBSCRIBE_STOPSUBSCRIBE_SUBSCRIBE" + ], + "environment": {} + }, + { + "name": "pending_subscription_test_send_request_to_sd_port", + "command": [ + "pending_subscription_test_master_starter.sh", + "REQUEST_TO_SD" + ], + "environment": {} + }, + { + "name": "malicious_data_test_events", + "command": [ + "malicious_data_test_master_starter.sh", + "MALICIOUS_EVENTS" + ], + "environment": {} + }, + { + "name": "malicious_data_test_protocol_version", + "command": [ + "malicious_data_test_master_starter.sh", + "PROTOCOL_VERSION" + ], + "environment": {} + }, + { + "name": "malicious_data_test_message_type", + "command": [ + "malicious_data_test_master_starter.sh", + "MESSAGE_TYPE" + ], + "environment": {} + }, + { + "name": "malicious_data_test_return_code", + "command": [ + "malicious_data_test_master_starter.sh", + "RETURN_CODE" + ], + "environment": {} + }, + { + "name": "malicious_data_test_wrong_header_fields_udp", + "command": [ + "malicious_data_test_master_starter.sh", + "WRONG_HEADER_FIELDS_UDP" + ], + "environment": {} + }, + { + "name": "npdu_test_udp", + "command": [ + "npdu_test_starter.sh", + "UDP", + "sync" + ], + "environment": {} + }, + { + "name": "npdu_test_tcp", + "command": [ + "npdu_test_starter.sh", + "TCP", + "sync" + ], + "environment": {} + }, + { + "name": "e2e_test_external", + "command": [ + "e2e_test_external_master_start.sh", + "e2e_test_client_external.json" + ], + "environment": {} + }, + { + "name": "e2e_profile_04_test_external", + "command": [ + "e2e_profile_04_test_external_master_start.sh", + "e2e_profile_04_test_client_external.json" + ], + "environment": {} + }, + { + "name": "event_test_payload_fixed_udp", + "command": [ + "event_test_master_starter.sh", + "PAYLOAD_FIXED", + "UDP" + ], + "environment": {} + }, + { + "name": "event_test_payload_fixed_tcp", + "command": [ + "event_test_master_starter.sh", + "PAYLOAD_FIXED", + "TCP" + ], + "environment": {} + }, + { + "name": "event_test_payload_dynamic_udp", + "command": [ + "event_test_master_starter.sh", + "PAYLOAD_DYNAMIC", + "UDP" + ], + "environment": {} + }, + { + "name": "event_test_payload_dynamic_tcp", + "command": [ + "event_test_master_starter.sh", + "PAYLOAD_DYNAMIC", + "TCP" + ], + "environment": {} + }, + { + "name": "someip_tp_test_in_sequence", + "command": [ + "someip_tp_test_master_starter.sh", + "IN_SEQUENCE" + ], + "environment": {} + }, + { + "name": "someip_tp_test_mixed", + "command": [ + "someip_tp_test_master_starter.sh", + "MIXED" + ], + "environment": {} + }, + { + "name": "someip_tp_test_incomplete", + "command": [ + "someip_tp_test_master_starter.sh", + "INCOMPLETE" + ], + "environment": {} + }, + { + "name": "someip_tp_test_duplicate", + "command": [ + "someip_tp_test_master_starter.sh", + "DUPLICATE" + ], + "environment": {} + }, + { + "name": "someip_tp_test_overlap", + "command": [ + "someip_tp_test_master_starter.sh", + "OVERLAP" + ], + "environment": {} + }, + { + "name": "someip_tp_test_overlap_front_back", + "command": [ + "someip_tp_test_master_starter.sh", + "OVERLAP_FRONT_BACK" + ], + "environment": {} + }, + { + "name": "suspend_resume_test_initial", + "command": [ + "suspend_resume_test_master_starter.sh", + "SERVICE" + ], + "environment": {} + }, + { + "name": "internal_routing_disabled_acceptance_test", + "command": [ + "internal_routing_disabled_acceptance_test/internal_routing_disabled_acceptance_test" + ], + "environment": { + "LD_LIBRARY_PATH": "build", + "VSOMEIP_CONFIGURATION": "internal_routing_disabled_acceptance_test/vsomeip.json" + } + } +] diff --git a/test/bat_tests/vsomeip_socket_path_tests.py b/test/bat_tests/vsomeip_socket_path_tests.py new file mode 100644 index 000000000..4228840ad --- /dev/null +++ b/test/bat_tests/vsomeip_socket_path_tests.py @@ -0,0 +1,29 @@ +# Copyright (C) 2023. BMW Car IT GmbH. All rights reserved. +import os +import nose + +from mtee.testing.support.target_share import TargetShare +from mtee.testing.tools import metadata, assert_process_returncode +from mtee.testing.test_environment import require_environment, TEST_ENVIRONMENT as te + +from nose.tools import assert_regexp_matches, assert_true, assert_equal, assert_not_equal + +# test needs a target for execution +target = TargetShare().target + +TEST_ENVIRONMENT = (te.target.hardware.mgu22, ) + +@require_environment(*TEST_ENVIRONMENT) +@metadata(testsuite=["BAT", "domain"], + component="vsomeip", + domain="SYSMAN", + duration="short", + priority=1, + testlevel="ENG_07", + teststage="regression") +class TestTargetVSomeIP(object): + + @metadata(test_case_id="SYSMAN_vsomeip_socket_path") + def test_sockets_path(self): + result = target.execute_command("ls /var/run/someip/vsomeip*") + assert_process_returncode(0, result, "No vsomeip sockets found") diff --git a/test/bat_tests/vsomeip_system_tests.py b/test/bat_tests/vsomeip_system_tests.py new file mode 100644 index 000000000..1768a6785 --- /dev/null +++ b/test/bat_tests/vsomeip_system_tests.py @@ -0,0 +1,60 @@ +# Copyright (C) 2023. BMW Car IT GmbH. All rights reserved. +import json +import os + +from mtee.testing.support.target_share import TargetShare +from mtee.testing.tools import assert_process_returncode, metadata +from mtee.testing.test_environment import require_environment, require_environment_setup +from mtee.testing.test_environment import TEST_ENVIRONMENT as te +from mtee.testing.support.set_test_description import set_description + + +required_target_packages = ["vsomeip-systemtests-targetfiles"] + +# test needs a target for execution +target = TargetShare().target + +# include text file with tests to be excluded +with open('/tests/vsomeip/systemtests/excluded_tests.txt', 'r') as file: + excluded_tests = [] + for test in file: + test = test.strip() + excluded_tests.append(test) + + +@metadata(testsuite=["BAT", "domain", "regression"], + component="vsomeip", + domain="SYSINFRA", + duration="short", + priority=1, + image=["APPL"], + teststage="system", + testlevel="ENG_07", + traceability={ + "MGU": { + "FEATURE": ["HLF - SUC | Some/IP Communication", ], + "MGUJIRA": ["MGUSIN-11117", "MGUSIN-1442", ], + }, + }, + ) + +class TestTargetVSomeIP(object): + + @classmethod + def setup_class(cls): + cls.deploy_dir = target.targetfiles_path(__file__) + + @require_environment(te.target.simulator) + def run_tests(self): + with open('/tests/vsomeip/systemtests/test-metadata.json', 'r') as file: + for test_case in json.load(file): + + if test_case['name'] not in excluded_tests: + def execute_tests_wrapper(test): + result = target.execute_command( + args='./' + ' '.join(test['command']), cwd=self.deploy_dir, environment={**test['environment'], 'USE_DOCKER' : '1'}, timeout=120) + assert_process_returncode( + 0, result, "Executing {} failed. {}".format(test['name'], result)) + + set_description(execute_tests_wrapper, test_case['name']) + yield execute_tests_wrapper, test_case diff --git a/test/network_tests/CMakeLists.txt b/test/network_tests/CMakeLists.txt index 7ddd58923..883cc5cf8 100644 --- a/test/network_tests/CMakeLists.txt +++ b/test/network_tests/CMakeLists.txt @@ -104,19 +104,18 @@ endif() ############################################################################## # application test ############################################################################## +set(TEST_APPLICATION application_test) + +add_executable(${TEST_APPLICATION} application_tests/${TEST_APPLICATION}.cpp) +target_link_libraries(${TEST_APPLICATION} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities +) if(NOT ${TESTS_BAT}) - set(TEST_APPLICATION application_test) - - add_executable(${TEST_APPLICATION} application_tests/${TEST_APPLICATION}.cpp) - target_link_libraries(${TEST_APPLICATION} - ${VSOMEIP_NAME} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ${DLT_LIBRARIES} - vsomeip_utilities - ) - set(TEST_APPLICATION_SINGLE_PROCESS_NAME ${TEST_APPLICATION}_single_process) add_executable(${TEST_APPLICATION_SINGLE_PROCESS_NAME} application_tests/${TEST_APPLICATION_SINGLE_PROCESS_NAME}.cpp) target_link_libraries(${TEST_APPLICATION_SINGLE_PROCESS_NAME} @@ -148,52 +147,6 @@ if(NOT ${TESTS_BAT}) ${TEST_APPLICATION}_single_process ) - set(TEST_APPLICATION_CONFIGURATION_FILE ${TEST_APPLICATION}.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE}.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_CONFIGURATION_FILE} - ${TEST_APPLICATION} - ) - - set(TEST_APPLICATION_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_daemon.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} - ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} - ${TEST_APPLICATION} - ) - - set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE ${TEST_APPLICATION}_no_dispatch_threads.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} - ${TEST_APPLICATION} - ) - - set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_no_dispatch_threads_daemon.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} - ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} - ${TEST_APPLICATION} - ) - - set(TEST_APPLICATION_STARTER ${TEST_APPLICATION}_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_STARTER} - ${TEST_APPLICATION} - ) - set(TEST_APPLICATION_SINGLE_PROCESS_STARTER ${TEST_APPLICATION}_single_process_starter.sh) copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_SINGLE_PROCESS_STARTER} ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_SINGLE_PROCESS_STARTER} @@ -206,6 +159,60 @@ if(NOT ${TESTS_BAT}) ${TEST_APPLICATION_SINGLE_PROCESS_NAME} ) endif() + +set(TEST_APPLICATION_CONFIGURATION_FILE ${TEST_APPLICATION}.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE}.in + ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE} + @ONLY) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_CONFIGURATION_FILE} + ${TEST_APPLICATION} +) + +set(TEST_APPLICATION_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_daemon.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}.in + ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} + @ONLY) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} + ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} + ${TEST_APPLICATION} +) + +set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE ${TEST_APPLICATION}_no_dispatch_threads.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}.in + ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} + @ONLY) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} + ${TEST_APPLICATION} +) + +set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_no_dispatch_threads_daemon.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}.in + ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} + @ONLY) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} + ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} + ${TEST_APPLICATION} +) + +set(TEST_APPLICATION_STARTER ${TEST_APPLICATION}_starter.sh) + if(${TESTS_BAT}) + configure_file( + ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_STARTER}.bat.in + ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_STARTER} + @ONLY) + endif() + +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_STARTER} +${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_STARTER} +${TEST_APPLICATION} +) + ############################################################################## # magic-cookies-test-client ############################################################################## @@ -283,83 +290,90 @@ endif() ############################################################################## # someip-header-factory-test ############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_HEADER_FACTORY_NAME header_factory_test) +set(TEST_HEADER_FACTORY_NAME header_factory_test) + +set(TEST_HEADER_FACTORY header_factory_test) +add_executable(${TEST_HEADER_FACTORY} header_factory_tests/header_factory_test.cpp) +target_link_libraries(${TEST_HEADER_FACTORY} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities +) - set(TEST_HEADER_FACTORY header_factory_test) - add_executable(${TEST_HEADER_FACTORY} header_factory_tests/header_factory_test.cpp) - target_link_libraries(${TEST_HEADER_FACTORY} - ${VSOMEIP_NAME} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT} - ${TEST_LINK_LIBRARIES} - ${DLT_LIBRARIES} - vsomeip_utilities - ) +############################################################################## +# Now comes the second part of the header factory test which consists of a client +# and a service both with settings file and bash scripts to start them +set(TEST_HEADER_FACTORY_CLIENT header_factory_test_client) +add_executable(${TEST_HEADER_FACTORY_CLIENT} header_factory_tests/${TEST_HEADER_FACTORY_CLIENT}.cpp) +target_link_libraries(${TEST_HEADER_FACTORY_CLIENT} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities +) - ############################################################################## - # Now comes the second part of the header factory test which consists of ouf - # a client and a service both with settings file and bash scripts to start them - set(TEST_HEADER_FACTORY_CLIENT header_factory_test_client) - add_executable(${TEST_HEADER_FACTORY_CLIENT} header_factory_tests/${TEST_HEADER_FACTORY_CLIENT}.cpp) - target_link_libraries(${TEST_HEADER_FACTORY_CLIENT} - ${VSOMEIP_NAME} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT} - ${TEST_LINK_LIBRARIES} - ${DLT_LIBRARIES} - vsomeip_utilities - ) +# Copy config file for client into $BUILDDIR/test +set(TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE ${TEST_HEADER_FACTORY_CLIENT}.json) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE} + ${TEST_HEADER_FACTORY_CLIENT} +) - # Copy config file for client into $BUILDDIR/test - set(TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE ${TEST_HEADER_FACTORY_CLIENT}.json) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE} - ${TEST_HEADER_FACTORY_CLIENT} - ) +# Copy bashscript to start client into $BUILDDIR/test +set(TEST_HEADER_FACTORY_CLIENT_START_SCRIPT ${TEST_HEADER_FACTORY_CLIENT}_start.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT} + ${TEST_HEADER_FACTORY_CLIENT} +) - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_HEADER_FACTORY_CLIENT_START_SCRIPT ${TEST_HEADER_FACTORY_CLIENT}_start.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT} - ${TEST_HEADER_FACTORY_CLIENT} - ) +set(TEST_HEADER_FACTORY_SERVICE header_factory_test_service) +add_executable(${TEST_HEADER_FACTORY_SERVICE} header_factory_tests/${TEST_HEADER_FACTORY_SERVICE}.cpp) +target_link_libraries(${TEST_HEADER_FACTORY_SERVICE} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities +) - set(TEST_HEADER_FACTORY_SERVICE header_factory_test_service) - add_executable(${TEST_HEADER_FACTORY_SERVICE} header_factory_tests/${TEST_HEADER_FACTORY_SERVICE}.cpp) - target_link_libraries(${TEST_HEADER_FACTORY_SERVICE} - ${VSOMEIP_NAME} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT} - ${TEST_LINK_LIBRARIES} - ${DLT_LIBRARIES} - vsomeip_utilities - ) +# Copy config file for service into $BUILDDIR/test +set(TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE ${TEST_HEADER_FACTORY_SERVICE}.json) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE} + ${TEST_HEADER_FACTORY_SERVICE} +) - # Copy config file for service into $BUILDDIR/test - set(TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE ${TEST_HEADER_FACTORY_SERVICE}.json) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE} - ${TEST_HEADER_FACTORY_SERVICE} - ) +# Copy bashscript to start service into $BUILDDIR/test +set(TEST_HEADER_FACTORY_SERVICE_START_SCRIPT ${TEST_HEADER_FACTORY_SERVICE}_start.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT} + ${TEST_HEADER_FACTORY_SERVICE} +) - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_HEADER_FACTORY_SERVICE_START_SCRIPT ${TEST_HEADER_FACTORY_SERVICE}_start.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT} - ${TEST_HEADER_FACTORY_SERVICE} - ) +# Copy bashscript to start client and server $BUILDDIR/test +set(TEST_HEADER_FACTORY_STARTER header_factory_test_send_receive_starter.sh) - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_HEADER_FACTORY_STARTER header_factory_test_send_receive_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_STARTER} - ${TEST_HEADER_FACTORY_CLIENT} - ) +if(${TESTS_BAT}) + configure_file( + ${NETWORK_TEST_SRC_DIR}/header_factory_tests/conf/${TEST_HEADER_FACTORY_STARTER}.bat.in + ${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_STARTER} + @ONLY) endif() + +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_STARTER} + ${TEST_HEADER_FACTORY_CLIENT} +) + ############################################################################## # routing-test ############################################################################## @@ -756,548 +770,577 @@ endif() # payload-test ############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_LOCAL_PAYLOAD_NAME local_payload_test) - - set(TEST_PAYLOAD_SERVICE payload_test_service) - add_executable(${TEST_PAYLOAD_SERVICE} payload_tests/${TEST_PAYLOAD_SERVICE}.cpp) - target_link_libraries(${TEST_PAYLOAD_SERVICE} - ${VSOMEIP_NAME} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ${DLT_LIBRARIES} - vsomeip_utilities - ) - - # Copy config file for service into $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE local_${TEST_PAYLOAD_SERVICE}.json) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_PAYLOAD_SERVICE} - ) +set(TEST_LOCAL_PAYLOAD_NAME local_payload_test) + +set(TEST_PAYLOAD_SERVICE payload_test_service) +add_executable(${TEST_PAYLOAD_SERVICE} payload_tests/${TEST_PAYLOAD_SERVICE}.cpp) +target_link_libraries(${TEST_PAYLOAD_SERVICE} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities +) - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT local_${TEST_PAYLOAD_SERVICE}_start.sh) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_PAYLOAD_SERVICE} - ) +# Copy config file for service into $BUILDDIR/test +set(TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE local_${TEST_PAYLOAD_SERVICE}.json) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} + ${TEST_PAYLOAD_SERVICE} +) - set(TEST_PAYLOAD_CLIENT payload_test_client) - add_executable(${TEST_PAYLOAD_CLIENT} - payload_tests/${TEST_PAYLOAD_CLIENT}.cpp - payload_tests/stopwatch.cpp - ) - target_link_libraries(${TEST_PAYLOAD_CLIENT} - ${VSOMEIP_NAME} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ${DLT_LIBRARIES} - vsomeip_utilities - ) +# Copy bashscript to start service into $BUILDDIR/test +set(TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT local_${TEST_PAYLOAD_SERVICE}_start.sh) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} + ${TEST_PAYLOAD_SERVICE} +) - # Copy config file for client into $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE local_${TEST_PAYLOAD_CLIENT}.json) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_PAYLOAD_CLIENT} - ) +set(TEST_PAYLOAD_CLIENT payload_test_client) +add_executable(${TEST_PAYLOAD_CLIENT} + payload_tests/${TEST_PAYLOAD_CLIENT}.cpp + payload_tests/stopwatch.cpp +) +target_link_libraries(${TEST_PAYLOAD_CLIENT} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities +) - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT local_${TEST_PAYLOAD_CLIENT}_start.sh) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT} - ${TEST_PAYLOAD_CLIENT} - ) +# Copy config file for client into $BUILDDIR/test +set(TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE local_${TEST_PAYLOAD_CLIENT}.json) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} + ${TEST_PAYLOAD_CLIENT} +) - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_STARTER local_payload_test_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) +# Copy bashscript to start client into $BUILDDIR/test +set(TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT local_${TEST_PAYLOAD_CLIENT}_start.sh) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT} + ${TEST_PAYLOAD_CLIENT} +) - ############################################################################## - set(TEST_EXTERNAL_LOCAL_PAYLOAD_NAME external_local_payload_test) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE external_local_payload_test_service) +# Copy bashscript to start client and server $BUILDDIR/test +set(TEST_LOCAL_PAYLOAD_STARTER local_payload_test_starter.sh) - # Copy config file for service into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}.json) +if(${TESTS_BAT}) configure_file( - ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_LOCAL_PAYLOAD_STARTER}.bat.in + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER} @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_PAYLOAD_SERVICE} - ) +endif() - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}_start.sh) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_PAYLOAD_SERVICE} - ) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_STARTER} + ${TEST_PAYLOAD_CLIENT} +) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL external_local_payload_test_client_local) +############################################################################## +set(TEST_EXTERNAL_LOCAL_PAYLOAD_NAME external_local_payload_test) +set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE external_local_payload_test_service) + +# Copy config file for service into $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} + ${TEST_PAYLOAD_SERVICE} +) - # Copy config file for client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_PAYLOAD_CLIENT} - ) +# Copy bashscript to start service into $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}_start.sh) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} + ${TEST_PAYLOAD_SERVICE} +) - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}_start.sh) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT} - ${TEST_PAYLOAD_CLIENT} - ) +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL external_local_payload_test_client_local) + +# Copy config file for client into $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} + ${TEST_PAYLOAD_CLIENT} +) - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME external_local_payload_test_client_local) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) - ############################################################################## - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME external_local_payload_test_client_external) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL external_local_payload_test_client_external) +# Copy bashscript to start client into $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}_start.sh) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT} + ${TEST_PAYLOAD_CLIENT} +) - # Copy config file for client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}.json) +# Copy bashscript to start client and server $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME external_local_payload_test_client_local) +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}_starter.sh) + +if(${TESTS_BAT}) configure_file( - ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}.bat.in + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} - ${TEST_PAYLOAD_CLIENT} - ) +endif() - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}_start.sh) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT} - ${TEST_PAYLOAD_CLIENT} - ) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} + ${TEST_PAYLOAD_CLIENT} +) +############################################################################## +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME external_local_payload_test_client_external) +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL external_local_payload_test_client_external) + +# Copy config file for client into $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} + ${TEST_PAYLOAD_CLIENT} +) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL external_local_payload_test_service_client_external) +# Copy bashscript to start client into $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}_start.sh) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT} + ${TEST_PAYLOAD_CLIENT} +) - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL}_start.sh) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT} - ${TEST_PAYLOAD_SERVICE} - ) +set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL external_local_payload_test_service_client_external) - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) +# Copy bashscript to start service into $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL}_start.sh) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT} + ${TEST_PAYLOAD_SERVICE} +) - ############################################################################## - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME external_local_payload_test_client_local_and_external) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) +# Copy bashscript to start client and server $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}_starter.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER} + ${TEST_PAYLOAD_CLIENT} +) - ############################################################################## - set(TEST_LOCAL_PAYLOAD_HUGE_NAME local_payload_test_huge_payload) - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_HUGE_STARTER ${TEST_LOCAL_PAYLOAD_HUGE_NAME}_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) +############################################################################## +# Copy bashscript to start client and server $BUILDDIR/test +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME external_local_payload_test_client_local_and_external) +set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}_starter.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER} + ${TEST_PAYLOAD_CLIENT} +) + +############################################################################## +set(TEST_LOCAL_PAYLOAD_HUGE_NAME local_payload_test_huge_payload) +# Copy bashscript to start client and server $BUILDDIR/test +set(TEST_LOCAL_PAYLOAD_HUGE_STARTER ${TEST_LOCAL_PAYLOAD_HUGE_NAME}_starter.sh) + +if(${TESTS_BAT}) + configure_file( + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_LOCAL_PAYLOAD_HUGE_STARTER}.bat.in + ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} + @ONLY) endif() +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} + ${TEST_PAYLOAD_CLIENT} +) + ############################################################################## # big_payload_test ############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_BIG_PAYLOAD_NAME big_payload_test) - set(TEST_BIG_PAYLOAD_SERVICE big_payload_test_service) - add_executable(${TEST_BIG_PAYLOAD_SERVICE} big_payload_tests/${TEST_BIG_PAYLOAD_SERVICE}.cpp) - target_link_libraries(${TEST_BIG_PAYLOAD_SERVICE} - ${VSOMEIP_NAME} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ${DLT_LIBRARIES} - vsomeip_utilities - ) +set(TEST_BIG_PAYLOAD_NAME big_payload_test) + +set(TEST_BIG_PAYLOAD_SERVICE big_payload_test_service) +add_executable(${TEST_BIG_PAYLOAD_SERVICE} big_payload_tests/${TEST_BIG_PAYLOAD_SERVICE}.cpp) +target_link_libraries(${TEST_BIG_PAYLOAD_SERVICE} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities +) - set(TEST_BIG_PAYLOAD_CLIENT big_payload_test_client) - add_executable(${TEST_BIG_PAYLOAD_CLIENT} big_payload_tests/${TEST_BIG_PAYLOAD_CLIENT}.cpp) - target_link_libraries(${TEST_BIG_PAYLOAD_CLIENT} - ${VSOMEIP_NAME} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ${DLT_LIBRARIES} - vsomeip_utilities - ) +set(TEST_BIG_PAYLOAD_CLIENT big_payload_test_client) +add_executable(${TEST_BIG_PAYLOAD_CLIENT} big_payload_tests/${TEST_BIG_PAYLOAD_CLIENT}.cpp) +target_link_libraries(${TEST_BIG_PAYLOAD_CLIENT} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local.json) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local.json) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_queue_limited.json) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_queue_limited.json) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_random.json) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_random.json) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_limited.json) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_limited.json) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} + ${TEST_BIG_PAYLOAD_CLIENT} +) - set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_limited.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_limited.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} + ${TEST_BIG_PAYLOAD_CLIENT} +) - set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_limited.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_limited.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_queue_limited.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_queue_limited.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} + ${TEST_BIG_PAYLOAD_CLIENT} +) - set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_queue_limited.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_queue_limited.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_random.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_random.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} + ${TEST_BIG_PAYLOAD_CLIENT} +) - set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_random.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_random.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_client.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_client.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} + ${TEST_BIG_PAYLOAD_CLIENT} +) + +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_service.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} + ${TEST_BIG_PAYLOAD_SERVICE} +) + +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_tcp_client_limited_general.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} + ${TEST_BIG_PAYLOAD_CLIENT} +) + +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_tcp_service_limited_general.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} + ${TEST_BIG_PAYLOAD_SERVICE} +) + +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_tcp_client_random.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} + ${TEST_BIG_PAYLOAD_CLIENT} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_service.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_tcp_service_random.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_tcp_client_limited_general.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL ${TEST_BIG_PAYLOAD_NAME}_tcp_client_queue_limited_general.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} + ${TEST_BIG_PAYLOAD_CLIENT} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_tcp_service_limited_general.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL ${TEST_BIG_PAYLOAD_NAME}_tcp_service_queue_limited_general.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_tcp_client_random.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC ${TEST_BIG_PAYLOAD_NAME}_tcp_client_queue_limited_specific.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} + ${TEST_BIG_PAYLOAD_CLIENT} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_tcp_service_random.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy config file for client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC ${TEST_BIG_PAYLOAD_NAME}_tcp_service_queue_limited_specific.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} + ${TEST_BIG_PAYLOAD_SERVICE} +) +# Copy config file for UDP client and service into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_udp_service.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} + ${TEST_BIG_PAYLOAD_SERVICE} +) +set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_udp_client.json) +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} + @ONLY) +copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} + ${TEST_BIG_PAYLOAD_CLIENT} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL ${TEST_BIG_PAYLOAD_NAME}_tcp_client_queue_limited_general.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy bashscript to start client local to $BUILDDIR/test +set(TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_client_local_start.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} + ${TEST_BIG_PAYLOAD_CLIENT} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL ${TEST_BIG_PAYLOAD_NAME}_tcp_service_queue_limited_general.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy bashscript to start service local to $BUILDDIR/test +set(TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_service_local_start.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC ${TEST_BIG_PAYLOAD_NAME}_tcp_client_queue_limited_specific.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +# Copy bashscript to start client and server $BUILDDIR/test +set(TEST_LOCAL_BIG_PAYLOAD_NAME big_payload_test_local) +set(TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM big_payload_test_local_random) +set(TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED big_payload_test_local_limited) +set(TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED big_payload_test_local_queue_limited) +set(TEST_LOCAL_BIG_PAYLOAD_STARTER ${TEST_LOCAL_BIG_PAYLOAD_NAME}_starter.sh) - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC ${TEST_BIG_PAYLOAD_NAME}_tcp_service_queue_limited_specific.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - # Copy config file for UDP client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_udp_service.json) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_udp_client.json) +if(${TESTS_BAT}) configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_BIG_PAYLOAD_STARTER}.bat.in + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_STARTER} @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +endif() - # Copy bashscript to start client local to $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_client_local_start.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} - ${TEST_BIG_PAYLOAD_CLIENT} - ) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_STARTER} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy bashscript to start service local to $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_service_local_start.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy bashscript to start client and server $BUILDDIR/test +set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME big_payload_test_local_tcp) +set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_RANDOM big_payload_test_local_tcp_random) +set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_LIMITED big_payload_test_local_tcp_limited) +set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_QUEUE_LIMITED big_payload_test_local_tcp_queue_limited) +# Copy starter as well as client/service start scripts for external tests +set(TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER ${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME}_starter.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER} + ${TEST_BIG_PAYLOAD_SERVICE} +) +set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME}_service_start.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_START_SCRIPT} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_NAME big_payload_test_local) - set(TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM big_payload_test_local_random) - set(TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED big_payload_test_local_limited) - set(TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED big_payload_test_local_queue_limited) - set(TEST_LOCAL_BIG_PAYLOAD_STARTER ${TEST_LOCAL_BIG_PAYLOAD_NAME}_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_STARTER} - ${TEST_BIG_PAYLOAD_SERVICE} - ) +# Copy bashscript to start client for external test into $BUILDDIR/test +set(TEST_EXTERNAL_BIG_PAYLOAD_NAME big_payload_test_external) +set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM big_payload_test_external_random) +set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED big_payload_test_external_limited) +set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL big_payload_test_external_limited_general) +set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL big_payload_test_external_queue_limited_general) +set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC big_payload_test_external_queue_limited_specific) +set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_UDP big_payload_test_external_udp) + +# Copy starter as well as client/service start scripts for external tests +set(TEST_EXTERNAL_BIG_PAYLOAD_STARTER ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_starter.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} + ${TEST_BIG_PAYLOAD_SERVICE} +) +set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_service_start.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} + ${TEST_BIG_PAYLOAD_SERVICE} +) - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME big_payload_test_local_tcp) - set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_RANDOM big_payload_test_local_tcp_random) - set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_LIMITED big_payload_test_local_tcp_limited) - set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_QUEUE_LIMITED big_payload_test_local_tcp_queue_limited) - # Copy starter as well as client/service start scripts for external tests - set(TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER ${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME}_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME}_service_start.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start client for external test into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME big_payload_test_external) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM big_payload_test_external_random) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED big_payload_test_external_limited) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL big_payload_test_external_limited_general) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL big_payload_test_external_queue_limited_general) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC big_payload_test_external_queue_limited_specific) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_UDP big_payload_test_external_udp) - - # Copy starter as well as client/service start scripts for external tests - set(TEST_EXTERNAL_BIG_PAYLOAD_STARTER ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_starter.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_service_start.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_client_start.sh) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} - ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} - ${TEST_BIG_PAYLOAD_CLIENT} - ) -endif() +set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_client_start.sh) +copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} + ${TEST_BIG_PAYLOAD_CLIENT} +) ############################################################################## # client id tests @@ -1678,6 +1721,63 @@ if(NOT ${TESTS_BAT}) ) endif() +############################################################################## +# debounce callback tests +############################################################################## +if(NOT ${TESTS_BAT}) + set(TEST_DEBOUNCE_CALLBACK_NAME debounce_callback_test) + set(TEST_DEBOUNCE_CALLBACK_CLIENT ${TEST_DEBOUNCE_CALLBACK_NAME}_client) + add_executable(${TEST_DEBOUNCE_CALLBACK_CLIENT} debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_CLIENT}.cpp) + target_link_libraries(${TEST_DEBOUNCE_CALLBACK_CLIENT} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ) + set(TEST_DEBOUNCE_CALLBACK_SERVICE ${TEST_DEBOUNCE_CALLBACK_NAME}_service) + add_executable(${TEST_DEBOUNCE_CALLBACK_SERVICE} debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_SERVICE}.cpp) + target_link_libraries(${TEST_DEBOUNCE_CALLBACK_SERVICE} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ) + + # copy starter scripts into builddir + set(TEST_DEBOUNCE_CALLBACK_MASTER_STARTER ${TEST_DEBOUNCE_CALLBACK_NAME}_master_starter.sh) + copy_to_builddir(${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_MASTER_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_CALLBACK_MASTER_STARTER} + ${TEST_DEBOUNCE_CALLBACK_SERVICE} + ) + set(TEST_DEBOUNCE_CALLBACK_SLAVE_STARTER ${TEST_DEBOUNCE_CALLBACK_NAME}_slave_starter.sh) + copy_to_builddir(${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_SLAVE_STARTER} + ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_CALLBACK_SLAVE_STARTER} + ${TEST_DEBOUNCE_CALLBACK_CLIENT} + ) + + # configure configurations and copy them into builddir + set(TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE ${TEST_DEBOUNCE_CALLBACK_SERVICE}.json) + configure_file( + ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/conf/${TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE} + @ONLY) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE} + ${TEST_DEBOUNCE_CALLBACK_SERVICE} + ) + set(TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE ${TEST_DEBOUNCE_CALLBACK_CLIENT}.json) + configure_file( + ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/conf/${TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE} + @ONLY) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE} + ${TEST_DEBOUNCE_CALLBACK_CLIENT} + ) +endif() + ############################################################################## # subscribe notify tests ############################################################################## @@ -2985,7 +3085,7 @@ if(NOT ${TESTS_BAT}) # copy starter scripts into builddir if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") - set(TEST_OFFER_LOCAL_STARTER ${TEST_OFFER_NAME}_local_starter_qnx.sh) + set(TEST_OFFER_LOCAL_STARTER ${TEST_OFFER_NAME}_local_starter_qnx.sh) else() set(TEST_OFFER_LOCAL_STARTER ${TEST_OFFER_NAME}_local_starter.sh) endif() @@ -3401,6 +3501,78 @@ if(NOT ${TESTS_BAT} AND ${TEST_E2E_PROFILE_04}) ) endif() +############################################################################## +# e2e profile 07 test +############################################################################## + +if(NOT ${TESTS_BAT} AND ${TEST_E2E_PROFILE_07}) + set(TEST_E2E_PROFILE_07_NAME e2e_profile_07_test) + set(TEST_E2E_PROFILE_07_SERVICE e2e_profile_07_test_service) + set(TEST_E2E_PROFILE_07_CLIENT e2e_profile_07_test_client) + + add_executable(${TEST_E2E_PROFILE_07_SERVICE} e2e_tests/${TEST_E2E_PROFILE_07_SERVICE}.cpp) + target_link_libraries(${TEST_E2E_PROFILE_07_SERVICE} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities + ) + + add_executable(${TEST_E2E_PROFILE_07_CLIENT} + e2e_tests/${TEST_E2E_PROFILE_07_CLIENT}.cpp + ) + target_link_libraries(${TEST_E2E_PROFILE_07_CLIENT} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + vsomeip_utilities + ) + + # Copy service config file for external allow tests into $BUILDDIR/test + set(TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL ${TEST_E2E_PROFILE_07_NAME}_service_external.json) + configure_file( + ${NETWORK_TEST_SRC_DIR}/e2e_tests/conf/${TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL}.in + ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL} + @ONLY) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL} + ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL} + ${TEST_E2E_PROFILE_07_SERVICE} + ) + + # Copy client config file for external allow tests into $BUILDDIR/test + set(TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL ${TEST_E2E_PROFILE_07_NAME}_client_external.json) + configure_file( + ${NETWORK_TEST_SRC_DIR}/e2e_tests/conf/${TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL}.in + ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL} + @ONLY) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL} + ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL} + ${TEST_E2E_PROFILE_07_SERVICE} + ) + + # Copy bashscript to start external tests (master) into $BUILDDIR/test + set(TEST_E2E_PROFILE_07_EXTERNAL_MASTER_START_SCRIPT ${TEST_E2E_PROFILE_07_NAME}_external_master_start.sh) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_EXTERNAL_MASTER_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_07_EXTERNAL_MASTER_START_SCRIPT} + ${TEST_E2E_PROFILE_07_SERVICE} + ) + + # Copy bashscript to start external tests (slave) into $BUILDDIR/test + set(TEST_E2E_PROFILE_07_EXTERNAL_SLAVE_START_SCRIPT ${TEST_E2E_PROFILE_07_NAME}_external_slave_start.sh) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_EXTERNAL_SLAVE_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_07_EXTERNAL_SLAVE_START_SCRIPT} + ${TEST_E2E_PROFILE_07_SERVICE} + ) +endif() + ############################################################################## # event tests ############################################################################## @@ -3971,6 +4143,8 @@ if(NOT ${TESTS_BAT}) add_dependencies(${TEST_DEBOUNCE_SERVICE} gtest) add_dependencies(${TEST_DEBOUNCE_FILTER_CLIENT} gtest) add_dependencies(${TEST_DEBOUNCE_FILTER_SERVICE} gtest) + add_dependencies(${TEST_DEBOUNCE_CALLBACK_CLIENT} gtest) + add_dependencies(${TEST_DEBOUNCE_CALLBACK_SERVICE} gtest) add_dependencies(${TEST_DEBOUNCE_FREQUENCY_CLIENT} gtest) add_dependencies(${TEST_DEBOUNCE_FREQUENCY_SERVICE} gtest) add_dependencies(${TEST_SUBSCRIBE_NOTIFY_SERVICE} gtest) @@ -4003,6 +4177,10 @@ if(NOT ${TESTS_BAT}) add_dependencies(${TEST_E2E_PROFILE_04_SERVICE} gtest) add_dependencies(${TEST_E2E_PROFILE_04_CLIENT} gtest) endif() + if (${TEST_E2E_PROFILE_07}) + add_dependencies(${TEST_E2E_PROFILE_07_SERVICE} gtest) + add_dependencies(${TEST_E2E_PROFILE_07_CLIENT} gtest) + endif() add_dependencies(${TEST_EVENT_SERVICE} gtest) add_dependencies(${TEST_EVENT_CLIENT} gtest) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "QNX") @@ -4026,6 +4204,14 @@ if(NOT ${TESTS_BAT}) add_dependencies(${TEST_SUSPEND_RESUME_CLIENT} gtest) add_dependencies(${TEST_SUSPEND_RESUME_SERVICE} gtest) else() + add_dependencies(${TEST_APPLICATION} gtest) + add_dependencies(${TEST_HEADER_FACTORY} gtest) + add_dependencies(${TEST_HEADER_FACTORY_CLIENT} gtest) + add_dependencies(${TEST_HEADER_FACTORY_SERVICE} gtest) + add_dependencies(${TEST_PAYLOAD_SERVICE} gtest) + add_dependencies(${TEST_PAYLOAD_CLIENT} gtest) + add_dependencies(${TEST_BIG_PAYLOAD_SERVICE} gtest) + add_dependencies(${TEST_BIG_PAYLOAD_CLIENT} gtest) add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest) add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest) endif() @@ -4057,6 +4243,8 @@ if(NOT ${TESTS_BAT}) add_dependencies(build_network_tests ${TEST_DEBOUNCE_SERVICE}) add_dependencies(build_network_tests ${TEST_DEBOUNCE_FILTER_CLIENT}) add_dependencies(build_network_tests ${TEST_DEBOUNCE_FILTER_SERVICE}) + add_dependencies(build_network_tests ${TEST_DEBOUNCE_CALLBACK_CLIENT}) + add_dependencies(build_network_tests ${TEST_DEBOUNCE_CALLBACK_SERVICE}) add_dependencies(build_network_tests ${TEST_DEBOUNCE_FREQUENCY_CLIENT}) add_dependencies(build_network_tests ${TEST_DEBOUNCE_FREQUENCY_SERVICE}) add_dependencies(build_network_tests ${TEST_SUBSCRIBE_NOTIFY_SERVICE}) @@ -4094,6 +4282,10 @@ if(NOT ${TESTS_BAT}) add_dependencies(build_network_tests ${TEST_E2E_PROFILE_04_SERVICE}) add_dependencies(build_network_tests ${TEST_E2E_PROFILE_04_CLIENT}) endif() + if (${TEST_E2E_PROFILE_07}) + add_dependencies(build_network_tests ${TEST_E2E_PROFILE_07_SERVICE}) + add_dependencies(build_network_tests ${TEST_E2E_PROFILE_07_CLIENT}) + endif() add_dependencies(build_network_tests ${TEST_EVENT_SERVICE}) add_dependencies(build_network_tests ${TEST_EVENT_CLIENT}) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "QNX") @@ -4117,6 +4309,14 @@ if(NOT ${TESTS_BAT}) add_dependencies(build_network_tests ${TEST_SUSPEND_RESUME_CLIENT}) add_dependencies(build_network_tests ${TEST_SUSPEND_RESUME_SERVICE}) else() + add_dependencies(build_network_tests ${TEST_APPLICATION}) + add_dependencies(build_network_tests ${TEST_BIG_PAYLOAD_SERVICE}) + add_dependencies(build_network_tests ${TEST_BIG_PAYLOAD_CLIENT}) + add_dependencies(build_network_tests ${TEST_PAYLOAD_SERVICE}) + add_dependencies(build_network_tests ${TEST_PAYLOAD_CLIENT}) + add_dependencies(build_network_tests ${TEST_HEADER_FACTORY}) + add_dependencies(build_network_tests ${TEST_HEADER_FACTORY_CLIENT}) + add_dependencies(build_network_tests ${TEST_HEADER_FACTORY_SERVICE}) add_dependencies(build_network_tests ${TEST_LOCAL_ROUTING_SERVICE}) add_dependencies(build_network_tests ${TEST_LOCAL_ROUTING_CLIENT}) endif() @@ -4323,6 +4523,10 @@ if(NOT ${TESTS_BAT}) add_test(NAME ${TEST_DEBOUNCE_FILTER_NAME} COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_FILTER_MASTER_STARTER}) set_tests_properties(${TEST_DEBOUNCE_FILTER_UTILITY} PROPERTIES TIMEOUT 30) + # debounce callback tests + add_test(NAME ${TEST_DEBOUNCE_CALLBACK_NAME} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_CALLBACK_MASTER_STARTER}) + set_tests_properties(${TEST_DEBOUNCE_CALLBACK_NAME} PROPERTIES TIMEOUT 60) # debounce frequency tests add_test(NAME ${TEST_DEBOUNCE_FREQUENCY_NAME} @@ -4664,6 +4868,12 @@ if(NOT ${TESTS_BAT}) set_tests_properties(${TEST_E2E_PROFILE_04_NAME}_external PROPERTIES TIMEOUT 180) endif () + if (${TEST_E2E_PROFILE_07}) + add_test(NAME ${TEST_E2E_PROFILE_07_NAME}_external + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_07_EXTERNAL_MASTER_START_SCRIPT} e2e_profile_07_test_client_external.json) + set_tests_properties(${TEST_E2E_PROFILE_07_NAME}_external PROPERTIES TIMEOUT 180) + endif () + # event tests add_test(NAME ${TEST_EVENT_NAME}_payload_fixed_udp COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EVENT_MASTER_START_SCRIPT} PAYLOAD_FIXED UDP) @@ -4728,4 +4938,105 @@ else() add_test(NAME ${TEST_LOCAL_ROUTING_NAME} COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_ROUTING_STARTER} ) + + # application test + add_test(NAME ${TEST_APPLICATION} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_STARTER} + ) + set_tests_properties(${TEST_APPLICATION} PROPERTIES TIMEOUT 80) + + # big payload tests + add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_STARTER} + ) + set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_STARTER} RANDOM + ) + set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_STARTER} LIMITED + ) + set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDGENERAL + ) + set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER} + ) + set_tests_properties(${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_RANDOM} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER} RANDOM + ) + set_tests_properties(${TEST_LOCAL_TCP_TCP_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_LIMITED} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER} LIMITED + ) + set_tests_properties(${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_QUEUE_LIMITED} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_STARTER} QUEUELIMITEDGENERAL + ) + set_tests_properties(${TEST_LOCAL_TCP_BIG_PAYLOAD_NAME_QUEUE_LIMITED} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} + ) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} RANDOM + ) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} LIMITED + ) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} LIMITEDGENERAL + ) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDGENERAL + ) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDSPECIFIC + ) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC} PROPERTIES TIMEOUT 120) + + add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_UDP} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} UDP + ) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_UDP} PROPERTIES TIMEOUT 120) + + # Header/Factory tests + add_test(NAME ${TEST_HEADER_FACTORY_NAME} COMMAND ${TEST_HEADER_FACTORY}) + add_test(NAME ${TEST_HEADER_FACTORY_NAME}_send_receive + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_STARTER} + ) + + # Payload tests + add_test(NAME ${TEST_LOCAL_PAYLOAD_NAME} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_STARTER} + ) + add_test(NAME ${TEST_LOCAL_PAYLOAD_HUGE_NAME} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} + ) + set_tests_properties(${TEST_LOCAL_PAYLOAD_HUGE_NAME} PROPERTIES TIMEOUT 1800) + + add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME} + COMMAND ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} + ) endif() diff --git a/test/network_tests/application_tests/conf/application_test_starter.sh.bat.in b/test/network_tests/application_tests/conf/application_test_starter.sh.bat.in new file mode 100755 index 000000000..de59fa094 --- /dev/null +++ b/test/network_tests/application_tests/conf/application_test_starter.sh.bat.in @@ -0,0 +1,25 @@ +#!/bin/sh +# Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +FAIL=0 + +export VSOMEIP_CONFIGURATION=application_test_no_dispatch_threads.json + +if ! ./application_test +then + FAIL=$((FAIL+1)) +fi + +export VSOMEIP_CONFIGURATION=application_test.json + +if ! ./application_test +then + FAIL=$((FAIL+1)) +fi + + +# Check if both exited successfully +exit $FAIL diff --git a/test/network_tests/big_payload_tests/big_payload_test_local_starter.sh b/test/network_tests/big_payload_tests/big_payload_test_local_starter.sh index 6439cacba..39a307ccf 100755 --- a/test/network_tests/big_payload_tests/big_payload_test_local_starter.sh +++ b/test/network_tests/big_payload_tests/big_payload_test_local_starter.sh @@ -43,7 +43,7 @@ do wait $job || ((FAIL+=1)) done -# Check if client and server both exited successfully +# Check if client and server both exited successfully if [ $FAIL -eq 0 ] then exit 0 diff --git a/test/network_tests/big_payload_tests/conf/big_payload_test_local_starter.sh.bat.in b/test/network_tests/big_payload_tests/conf/big_payload_test_local_starter.sh.bat.in new file mode 100755 index 000000000..b20103737 --- /dev/null +++ b/test/network_tests/big_payload_tests/conf/big_payload_test_local_starter.sh.bat.in @@ -0,0 +1,47 @@ +#!/bin/sh +# Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Purpose: This script is needed to start the client and service with +# one command. This is necessary as ctest - which is used to run the +# tests - isn't able to start two binaries for one testcase. Therefore +# the testcase simply executes this script. This script then runs client +# and service and checks that both exit successfully. + +if [ $# -gt 0 ] && [ "$1" != "RANDOM" ] && [ "$1" != "LIMITED" ] && [ "$1" != "QUEUELIMITEDGENERAL" ]; +then + echo "The only allowed parameter to this script is "RANDOM","LIMITED" or "QUEUELIMITEDGENERAL"." + echo "Like $0 RANDOM" + exit 1 +fi + + +FAIL=0 + +# Start the service +if [ $# -gt 0 ] && [ "$1" = "RANDOM" ]; then + export VSOMEIP_CONFIGURATION=big_payload_test_local_random.json +elif [ $# -gt 0 ] && [ $1 = "LIMITED" ]; then + export VSOMEIP_CONFIGURATION=big_payload_test_local_limited.json +elif [ $# -gt 0 ] && [ $1 = "QUEUELIMITEDGENERAL" ]; then + export VSOMEIP_CONFIGURATION=big_payload_test_local_queue_limited.json +else + export VSOMEIP_CONFIGURATION=big_payload_test_local.json +fi +./big_payload_test_service $1 & + +# Start the client +if ! ./big_payload_test_client $1 +then + FAIL=$((FAIL+1)) +fi + +# Wait until service is finished +# Fail gets incremented if service exit +# with a non-zero exit code +wait $! || FAIL=$((FAIL+1)) + +# Check if client and server both exited sucessfully +exit $FAIL diff --git a/test/network_tests/client_id_tests/client_id_test_slave_starter.sh b/test/network_tests/client_id_tests/client_id_test_slave_starter.sh index 45535213e..fbdfe5c06 100755 --- a/test/network_tests/client_id_tests/client_id_test_slave_starter.sh +++ b/test/network_tests/client_id_tests/client_id_test_slave_starter.sh @@ -20,11 +20,11 @@ fi FAIL=0 # Start the services -export VSOMEIP_APPLICATION_NAME=client_id_test_service_four +export VSOMEIP_APPLICATION_NAME=client_id_test_service_four export VSOMEIP_CONFIGURATION=$1 ./client_id_test_service 4 & -export VSOMEIP_APPLICATION_NAME=client_id_test_service_five +export VSOMEIP_APPLICATION_NAME=client_id_test_service_five export VSOMEIP_CONFIGURATION=$1 ./client_id_test_service 5 & @@ -41,7 +41,7 @@ do wait $job || ((FAIL+=1)) done -# Check if both exited successfully +# Check if both exited successfully if [ $FAIL -eq 0 ] then exit 0 diff --git a/test/network_tests/debounce_callback_tests/conf/debounce_callback_test_client.json.in b/test/network_tests/debounce_callback_tests/conf/debounce_callback_test_client.json.in new file mode 100644 index 000000000..c0e2b2613 --- /dev/null +++ b/test/network_tests/debounce_callback_tests/conf/debounce_callback_test_client.json.in @@ -0,0 +1,33 @@ +{ + "unicast" : "@TEST_IP_MASTER@", + "debounce" : + [ + { + "service" : "0xb657", + "instance" : "0x0003", + "events" : + [ + { + "event" : "0x8001", + "on_change" : "false", + "interval": 2000, + "send_current_value_after" : "true" + }, + { + "event" : "0x8002", + "on_change" : "false", + "interval": 3000, + "send_current_value_after" : "true" + } + ] + } + ], + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.251.192.252", + "port" : "30490", + "protocol" : "udp", + "cyclic_offer_delay" : "1000" + } +} diff --git a/test/network_tests/debounce_callback_tests/conf/debounce_callback_test_service.json.in b/test/network_tests/debounce_callback_tests/conf/debounce_callback_test_service.json.in new file mode 100644 index 000000000..29efa708c --- /dev/null +++ b/test/network_tests/debounce_callback_tests/conf/debounce_callback_test_service.json.in @@ -0,0 +1,19 @@ +{ + "unicast" : "@TEST_IP_SLAVE@", + "services" : + [ + { + "service" : "0xb657", + "instance" : "0x0003", + "unreliable" : "30503" + } + ], + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.251.192.252", + "port" : "30490", + "protocol" : "udp", + "cyclic_offer_delay" : "1000" + } +} diff --git a/test/network_tests/debounce_callback_tests/debounce_callback_test_client.cpp b/test/network_tests/debounce_callback_tests/debounce_callback_test_client.cpp new file mode 100644 index 000000000..f7a6c2a37 --- /dev/null +++ b/test/network_tests/debounce_callback_tests/debounce_callback_test_client.cpp @@ -0,0 +1,278 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include +#include + +#include + +#include "debounce_callback_test_client.hpp" + +static std::vector > payloads__; + +debounce_test_client::debounce_test_client(int64_t _interval) + : interval(_interval), + index_(0), + is_available_(false), + runner_(std::bind(&debounce_test_client::run, this)), + app_(vsomeip::runtime::get()->create_application("debounce_timeout_test_client")) { +} + +bool +debounce_test_client::init() { + + bool its_result = app_->init(); + if (its_result) { + app_->register_availability_handler( + DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + std::bind(&debounce_test_client::on_availability, this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3), + DEBOUNCE_MAJOR, DEBOUNCE_MINOR); + app_->register_message_handler( + DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, vsomeip::ANY_EVENT, + std::bind(&debounce_test_client::on_message, this, + std::placeholders::_1)); + app_->request_event(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_EVENT, { DEBOUNCE_EVENTGROUP }, + vsomeip::event_type_e::ET_FIELD, + vsomeip::reliability_type_e::RT_UNRELIABLE); + app_->request_event(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_EVENT_2, { DEBOUNCE_EVENTGROUP }, + vsomeip::event_type_e::ET_FIELD, + vsomeip::reliability_type_e::RT_UNRELIABLE); + app_->request_service(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_MAJOR, DEBOUNCE_MINOR); + app_->subscribe(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_EVENTGROUP, DEBOUNCE_MAJOR, DEBOUNCE_EVENT); + app_->subscribe(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_EVENTGROUP, DEBOUNCE_MAJOR, DEBOUNCE_EVENT_2); + } + return its_result; +} + +void +debounce_test_client::start() { + + app_->start(); +} + +void +debounce_test_client::stop() { + + app_->stop(); +} + +void +debounce_test_client::run() { + + { + std::unique_lock its_lock(run_mutex_); + while (!is_available_) { + auto its_status + = run_condition_.wait_for(its_lock, std::chrono::milliseconds(15000)); + EXPECT_EQ(its_status, std::cv_status::no_timeout); + if (its_status == std::cv_status::timeout) { + VSOMEIP_ERROR << __func__ << ": Debounce service did not become available after 15s."; + stop(); + return; + } + } + } + + VSOMEIP_INFO << __func__ << ": Running test."; + run_test(); + + unsubscribe_all(); + + VSOMEIP_INFO << __func__ << ": Stopping the service."; + stop_service(); + + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + stop(); +} + +void +debounce_test_client::wait() { + + if (runner_.joinable()) + runner_.join(); +} + +void +debounce_test_client::on_availability( + vsomeip::service_t _service, vsomeip::instance_t _instance, + bool _is_available) { + + if (_service == DEBOUNCE_SERVICE + && _instance == DEBOUNCE_INSTANCE) { + + if (_is_available) { + VSOMEIP_ERROR << __func__ << ": Debounce service becomes available."; + { + std::lock_guard its_lock(run_mutex_); + is_available_ = true; + } + run_condition_.notify_one(); + } else { + VSOMEIP_ERROR << __func__ << ": Debounce service becomes unavailable."; + + std::lock_guard its_lock(run_mutex_); + is_available_ = false; + } + } +} + +void +debounce_test_client::on_message( + const std::shared_ptr &_message) { + + std::stringstream s; + s << "RECV: "; + for (uint32_t i = 0; i < _message->get_payload()->get_length(); i++) + s << std::hex << std::setw(2) << std::setfill('0') + << (int)_message->get_payload()->get_data()[i] << ' '; + VSOMEIP_INFO << s.str(); + + // Check if message received is equal to the one it was expecting + if (DEBOUNCE_SERVICE == _message->get_service() + && (DEBOUNCE_EVENT == _message->get_method() || DEBOUNCE_EVENT_2 == _message->get_method())) { + bool is_equal = compare_payload(_message->get_payload(), index_++); + EXPECT_EQ(is_equal, true); + } +} + +bool +debounce_test_client::compare_payload( + const std::shared_ptr &_payload, + std::size_t _index) const { + + auto its_expected_payload = payloads__[_index]; + return (*_payload == *its_expected_payload); +} + +void +debounce_test_client::run_test() { + + // Trigger the test + auto its_runtime = vsomeip::runtime::get(); + auto its_payload = its_runtime->create_payload(); + auto its_message = its_runtime->create_request(false); + its_message->set_service(DEBOUNCE_SERVICE); + its_message->set_instance(DEBOUNCE_INSTANCE); + its_message->set_method(DEBOUNCE_START_METHOD); + its_message->set_interface_version(DEBOUNCE_MAJOR); + its_message->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN); + its_message->set_payload(its_payload); + app_->send(its_message); + + std::this_thread::sleep_for(std::chrono::seconds(23)); +} + +void +debounce_test_client::unsubscribe_all() { + + app_->unsubscribe(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_EVENTGROUP); +} + +void +debounce_test_client::stop_service() { + + auto its_runtime = vsomeip::runtime::get(); + auto its_payload = its_runtime->create_payload(); + auto its_message = its_runtime->create_request(false); + its_message->set_service(DEBOUNCE_SERVICE); + its_message->set_instance(DEBOUNCE_INSTANCE); + its_message->set_method(DEBOUNCE_STOP_METHOD); + its_message->set_interface_version(DEBOUNCE_MAJOR); + its_message->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN); + its_message->set_payload(its_payload); + app_->send(its_message); +} + +size_t +debounce_test_client::getIndex() { + return index_; +} + +TEST(debounce_timeout_test, callback) { + // Interval time of 2 seconds + debounce_test_client its_client(2000); + if (its_client.init()) { + VSOMEIP_ERROR << "debounce_client successfully initialized!"; + its_client.start(); + its_client.wait(); + // Check it got all messages + EXPECT_EQ(its_client.getIndex(), payloads__.size()); + } else { + VSOMEIP_ERROR << "debounce_client could not be initialized!"; + } +} +int main(int argc, char** argv) { + + std::shared_ptr its_payload; + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00 }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x0D }); + payloads__.push_back(its_payload); + + its_payload = vsomeip::runtime::get()->create_payload(); + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x0D }); + payloads__.push_back(its_payload); + + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/network_tests/debounce_callback_tests/debounce_callback_test_client.hpp b/test/network_tests/debounce_callback_tests/debounce_callback_test_client.hpp new file mode 100644 index 000000000..2b6da025c --- /dev/null +++ b/test/network_tests/debounce_callback_tests/debounce_callback_test_client.hpp @@ -0,0 +1,59 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef DEBOUNCE_TEST_CLIENT_HPP_ +#define DEBOUNCE_TEST_CLIENT_HPP_ + +#include +#include +#include + +#include + +#include + +#include "debounce_callback_test_common.hpp" + +class debounce_test_client { +public: + debounce_test_client(int64_t _interval); + + bool init(); + void start(); + void stop(); + + void run(); + void wait(); + + size_t getIndex(); + +private: + void on_availability( + vsomeip::service_t _service, vsomeip::instance_t _instance, + bool _is_available); + void on_message(const std::shared_ptr &_message); + + void run_test(); + void unsubscribe_all(); + void stop_service(); + + bool compare_payload(const std::shared_ptr &_payload, + std::size_t _index) const; + +private: + int64_t interval; + + size_t index_; + + bool is_available_; + + std::mutex run_mutex_; + std::condition_variable run_condition_; + + std::thread runner_; + std::shared_ptr app_; +}; + +#endif // DEBOUNCE_CALLBACK_TEST_CLIENT_HPP_ diff --git a/test/network_tests/debounce_callback_tests/debounce_callback_test_common.hpp b/test/network_tests/debounce_callback_tests/debounce_callback_test_common.hpp new file mode 100644 index 000000000..12aa9ccbb --- /dev/null +++ b/test/network_tests/debounce_callback_tests/debounce_callback_test_common.hpp @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef DEBOUNCE_TEST_COMMON_HPP_ +#define DEBOUNCE_TEST_COMMON_HPP_ + +#include + +const vsomeip::service_t DEBOUNCE_SERVICE = 0xb657; +const vsomeip::instance_t DEBOUNCE_INSTANCE = 0x0003; +const vsomeip::method_t DEBOUNCE_START_METHOD = 0x0998; +const vsomeip::method_t DEBOUNCE_STOP_METHOD = 0x0999; +const vsomeip::event_t DEBOUNCE_EVENT = 0x8001; +const vsomeip::event_t DEBOUNCE_EVENT_2 = 0x8002; +const vsomeip::eventgroup_t DEBOUNCE_EVENTGROUP = 0x0005; +const vsomeip::major_version_t DEBOUNCE_MAJOR = 0x01; +const vsomeip::minor_version_t DEBOUNCE_MINOR = 0x01; + +#endif // DEBOUNCE_CALLBACK_TEST_COMMON_HPP_ diff --git a/test/network_tests/debounce_callback_tests/debounce_callback_test_master_starter.sh b/test/network_tests/debounce_callback_tests/debounce_callback_test_master_starter.sh new file mode 100755 index 000000000..87ebb2dd2 --- /dev/null +++ b/test/network_tests/debounce_callback_tests/debounce_callback_test_master_starter.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +FAIL=0 + +export VSOMEIP_CONFIGURATION=debounce_callback_test_client.json +../../examples/routingmanagerd/routingmanagerd & +PID_VSOMEIPD=$! + +sleep 1 + +./debounce_callback_test_client & +PID_MASTER=$! + +sleep 1 + +if [ ! -z "$USE_LXC_TEST" ]; then + echo "starting debounce test on slave LXC debounce_callback_test_slave_starter.sh" + ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip_lib/test/network_tests; ./debounce_callback_test_slave_starter.sh\"" & +elif [ ! -z "$USE_DOCKER" ]; then + docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS; sleep 10; ./debounce_callback_test_slave_starter.sh" & +else +cat < + +#include "debounce_callback_test_service.hpp" + +debounce_test_service::debounce_test_service() + : runner_(std::bind(&debounce_test_service::run, this)), + app_(vsomeip::runtime::get()->create_application("debounce_timeout_test_service")) { + +} + +bool +debounce_test_service::init() { + + bool is_initialized = app_->init(); + if (is_initialized) { + app_->register_message_handler( + DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_START_METHOD, + std::bind(&debounce_test_service::on_start, this, + std::placeholders::_1)); + app_->register_message_handler( + DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_STOP_METHOD, + std::bind(&debounce_test_service::on_stop, this, + std::placeholders::_1)); + app_->offer_event(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_EVENT, { DEBOUNCE_EVENTGROUP }, + vsomeip::event_type_e::ET_FIELD, + std::chrono::milliseconds::zero(), + false, true, nullptr, + vsomeip::reliability_type_e::RT_UNRELIABLE); + app_->offer_event(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_EVENT_2, { DEBOUNCE_EVENTGROUP }, + vsomeip::event_type_e::ET_FIELD, + std::chrono::milliseconds::zero(), + false, true, nullptr, + vsomeip::reliability_type_e::RT_UNRELIABLE); + app_->offer_service(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, + DEBOUNCE_MAJOR, DEBOUNCE_MINOR); + } + return is_initialized; +} + +void +debounce_test_service::start() { + + app_->start(); +} + +void +debounce_test_service::stop() { + + app_->stop(); +} + +void +debounce_test_service::run() { + + { + std::unique_lock its_lock(run_mutex_); + auto its_result = run_condition_.wait_for( + its_lock, std::chrono::milliseconds(5000)); + if (its_result == std::cv_status::timeout) + return; + } + + start_test(); +} + +void +debounce_test_service::wait() { + + if (runner_.joinable()) + runner_.join(); +} + +void +debounce_test_service::on_start( + const std::shared_ptr &_message) { + + (void)_message; + + VSOMEIP_INFO << __func__ << ": Starting test"; + run_condition_.notify_one(); +} + + +void +debounce_test_service::on_stop( + const std::shared_ptr &_message) { + + (void)_message; + + VSOMEIP_INFO << __func__ << ": Received a STOP command."; + stop(); +} + +void +debounce_test_service::start_test() { + + auto its_payload = vsomeip::runtime::get()->create_payload(); + + // To check if debouncer send the last message after timeout + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent first message!"; + std::this_thread::sleep_for(std::chrono::seconds(1)); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent second message!"; + + std::this_thread::sleep_for(std::chrono::seconds(3)); + + // To check normal function of the debouncer + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent third message!"; + std::this_thread::sleep_for(std::chrono::seconds(3)); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent fourth message!"; + + std::this_thread::sleep_for(std::chrono::seconds(3)); + + // To check only one message is forwarded after timeout + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent fifth message!"; + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent sixth message!"; + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent seventh message!"; + + std::this_thread::sleep_for(std::chrono::seconds(3)); + + // To check the interaction when two events use the debounce + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent eight message!"; + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT_2, its_payload); + VSOMEIP_INFO << "Sent first event 2 message!"; + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent ninth message!"; + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT_2, its_payload); + VSOMEIP_INFO << "Sent second event 2 message!"; + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + its_payload->set_data({ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + VSOMEIP_INFO << "Sent tenth message!"; + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT_2, its_payload); + VSOMEIP_INFO << "Sent third event 2 message!"; + + std::this_thread::sleep_for(std::chrono::seconds(3)); + + // Testing with lots of messages + + VSOMEIP_INFO << "Sending lot of messages!"; + for (int i = 0; i < 30; i++) + { + its_payload->set_data({ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, (unsigned char)(i%16) }); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT, its_payload); + app_->notify(DEBOUNCE_SERVICE, DEBOUNCE_INSTANCE, DEBOUNCE_EVENT_2, its_payload); + + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + } + + +} + +TEST(debounce_timeout_test, callback) { + debounce_test_service its_service; + if (its_service.init()) { + its_service.start(); + its_service.wait(); + } +} + +int main(int argc, char** argv) { + + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/network_tests/debounce_callback_tests/debounce_callback_test_service.hpp b/test/network_tests/debounce_callback_tests/debounce_callback_test_service.hpp new file mode 100644 index 000000000..0a9ed3fbc --- /dev/null +++ b/test/network_tests/debounce_callback_tests/debounce_callback_test_service.hpp @@ -0,0 +1,45 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef DEBOUNCE_TEST_SERVICE_HPP_ +#define DEBOUNCE_TEST_SERVICE_HPP_ + +#include +#include +#include +#include + +#include + +#include + +#include "debounce_callback_test_common.hpp" + +class debounce_test_service { +public: + debounce_test_service(); + + bool init(); + void start(); + void stop(); + + void run(); + void wait(); + +private: + void on_start(const std::shared_ptr &_message); + void on_stop(const std::shared_ptr &_message); + + void start_test(); + + std::mutex run_mutex_; + std::condition_variable run_condition_; + + std::thread runner_; + std::shared_ptr app_; +}; + + +#endif // DEBOUNCE_CALLBACK_TEST_SERVICE_HPP_ diff --git a/test/network_tests/debounce_callback_tests/debounce_callback_test_slave_starter.sh b/test/network_tests/debounce_callback_tests/debounce_callback_test_slave_starter.sh new file mode 100755 index 000000000..6b4fe8738 --- /dev/null +++ b/test/network_tests/debounce_callback_tests/debounce_callback_test_slave_starter.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +FAIL=0 + +export VSOMEIP_CONFIGURATION=debounce_callback_test_service.json +../../examples/routingmanagerd/routingmanagerd & +PID_VSOMEIPD=$! + +sleep 1 + +# Fail gets incremented if a client exits with a non-zero exit code +./debounce_callback_test_service || ((++FAIL)) + +# kill the services +kill $PID_VSOMEIPD +sleep 3 + +# Check if everything went well +exit $FAIL diff --git a/test/network_tests/debounce_filter_tests/debounce_filter_test_client.cpp b/test/network_tests/debounce_filter_tests/debounce_filter_test_client.cpp index 98153163c..0bd89131f 100644 --- a/test/network_tests/debounce_filter_tests/debounce_filter_test_client.cpp +++ b/test/network_tests/debounce_filter_tests/debounce_filter_test_client.cpp @@ -184,7 +184,7 @@ TEST(debounce_test, normal_interval) its_client.wait(); // With a debounce interval of 100 miliseconds, the client is expected to receive a total of about 100-101 messages // Using limits instead of comparing to one number because CI doesn't always behave as expected - EXPECT_GE(its_client.getNbMsgsRcvd(), 100); + EXPECT_GE(its_client.getNbMsgsRcvd(), 90); EXPECT_LE(its_client.getNbMsgsRcvd(), 110); } @@ -204,8 +204,8 @@ TEST(debounce_test, large_interval) its_client.wait(); // With a debounce interval of 100 miliseconds, the client is expected to receive a total of about 10-11 messages // Using limits instead of comparing to one number because CI doesn't always behave as expected - EXPECT_GE(its_client.getNbMsgsRcvd(), 9); - EXPECT_LE(its_client.getNbMsgsRcvd(), 13); + EXPECT_GE(its_client.getNbMsgsRcvd(), 8); + EXPECT_LE(its_client.getNbMsgsRcvd(), 16); } else { diff --git a/test/network_tests/debounce_filter_tests/debounce_filter_test_master_starter.sh b/test/network_tests/debounce_filter_tests/debounce_filter_test_master_starter.sh index 62c9b990e..a80a54ff9 100755 --- a/test/network_tests/debounce_filter_tests/debounce_filter_test_master_starter.sh +++ b/test/network_tests/debounce_filter_tests/debounce_filter_test_master_starter.sh @@ -6,12 +6,6 @@ FAIL=0 -# Cleanup -rm -f /tmp/vsomeip* - -# Exclude external libraries from Thread Sanitizer -export TSAN_OPTIONS="suppressions=tsan-suppressions.txt" - export VSOMEIP_CONFIGURATION=debounce_filter_test_client.json ../../examples/routingmanagerd/routingmanagerd & PID_VSOMEIPD=$! diff --git a/test/network_tests/debounce_filter_tests/debounce_filter_test_slave_starter.sh b/test/network_tests/debounce_filter_tests/debounce_filter_test_slave_starter.sh index 13ff13044..ef0fea1fd 100755 --- a/test/network_tests/debounce_filter_tests/debounce_filter_test_slave_starter.sh +++ b/test/network_tests/debounce_filter_tests/debounce_filter_test_slave_starter.sh @@ -6,12 +6,6 @@ FAIL=0 -# Cleanup -rm -f /tmp/vsomeip* - -# Exclude external libraries from Thread Sanitizer -export TSAN_OPTIONS="suppressions=tsan-suppressions.txt" - export VSOMEIP_CONFIGURATION=debounce_filter_test_service.json ../../examples/routingmanagerd/routingmanagerd & PID_VSOMEIPD=$! diff --git a/test/network_tests/e2e_tests/conf/e2e_profile_07_test_client_external.json.in b/test/network_tests/e2e_tests/conf/e2e_profile_07_test_client_external.json.in new file mode 100644 index 000000000..d3a4b3cc7 --- /dev/null +++ b/test/network_tests/e2e_tests/conf/e2e_profile_07_test_client_external.json.in @@ -0,0 +1,56 @@ +{ + "unicast" : "@TEST_IP_MASTER@", + "netmask" : "255.255.255.0", + "logging" : + { + "level" : "info", + "console" : "true", + "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" }, + "dlt" : "true" + }, + "applications" : + [ + { + "name" : "client-sample", + "id" : "0x1255" + } + ], + "e2e" : + { + "e2e_enabled" : "true", + "protected" : + [ + { + "service_id" : "0xd025", + "event_id" : "0x0001", + "profile" : "P07", + "variant" : "checker", + "crc_offset" : "64", + "data_id" : "0x2d" + }, + { + "service_id" : "0xd025", + "event_id" : "0x8001", + "profile" : "P07", + "variant" : "checker", + "crc_offset" : "64", + "data_id" : "0x2d" + } + ] + }, + "routing" : "client-sample", + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.0.0.1", + "port" : "30490", + "protocol" : "udp", + "initial_delay_min" : "10", + "initial_delay_max" : "100", + "repetitions_base_delay" : "200", + "repetitions_max" : "3", + "ttl" : "3", + "cyclic_offer_delay" : "1000", + "request_response_delay" : "1500" + } +} diff --git a/test/network_tests/e2e_tests/conf/e2e_profile_07_test_service_external.json.in b/test/network_tests/e2e_tests/conf/e2e_profile_07_test_service_external.json.in new file mode 100644 index 000000000..4dc59f0c1 --- /dev/null +++ b/test/network_tests/e2e_tests/conf/e2e_profile_07_test_service_external.json.in @@ -0,0 +1,57 @@ +{ + "unicast" : "@TEST_IP_SLAVE@", + "netmask" : "255.255.255.0", + "logging" : + { + "level" : "info", + "console" : "true", + "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" }, + "dlt" : "true" + }, + "applications" : + [ + { + "name" : "service-sample", + "id" : "0x1277", + "has_session_handling" : "false" + } + ], + "services" : + [ + { + "service" : "0xd025", + "instance" : "0x0001", + "unreliable" : "30501" + } + ], + "e2e" : + { + "e2e_enabled" : "true", + "protected" : + [ + { + "service_id" : "0xd025", + "event_id" : "0x0001", + "profile" : "P07", + "variant" : "protector", + "crc_offset" : "64", + "data_id" : "0x2d" + } + ] + }, + "routing" : "service-sample", + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.0.0.1", + "port" : "30490", + "protocol" : "udp", + "initial_delay_min" : "10", + "initial_delay_max" : "100", + "repetitions_base_delay" : "200", + "repetitions_max" : "3", + "ttl" : "3", + "cyclic_offer_delay" : "2000", + "request_response_delay" : "1500" + } +} diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp b/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp new file mode 100644 index 000000000..606ef9968 --- /dev/null +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp @@ -0,0 +1,325 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "e2e_profile_07_test_common.hpp" +#include "e2e_profile_07_test_client.hpp" + +#include + +std::vector> responses_; +std::vector> events_; + +std::map counters_; + + +e2e_profile_07_test_client::e2e_profile_07_test_client() + : app_(vsomeip::runtime::get()->create_application()), + is_available_(false), + sender_(std::bind(&e2e_profile_07_test_client::run, this)), + received_(0) { + +} + +bool +e2e_profile_07_test_client::init() { + + if (!app_->init()) { + ADD_FAILURE() << __func__ << ": Cannot initialize application"; + return false; + } + + app_->register_state_handler( + std::bind(&e2e_profile_07_test_client::on_state, this, + std::placeholders::_1)); + + app_->register_message_handler( + PROFILE_07_SERVICE, PROFILE_07_INSTANCE, vsomeip::ANY_METHOD, + std::bind(&e2e_profile_07_test_client::on_message, this, + std::placeholders::_1)); + + app_->register_availability_handler( + PROFILE_07_SERVICE, PROFILE_07_INSTANCE, + std::bind(&e2e_profile_07_test_client::on_availability, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); + + return true; +} + +void +e2e_profile_07_test_client::start() { + + VSOMEIP_INFO << __func__ << ": Starting..."; + app_->start(); +} + +void +e2e_profile_07_test_client::stop() { + + VSOMEIP_INFO << __func__ << ": Stopping..."; + shutdown_service(); + app_->clear_all_handler(); + app_->stop(); +} + +void +e2e_profile_07_test_client::on_state(vsomeip::state_type_e _state) { + + if (_state == vsomeip::state_type_e::ST_REGISTERED) { + app_->request_service(PROFILE_07_SERVICE, PROFILE_07_INSTANCE); + + // request event 0x8001, that is protected by E2E Profile 07 + app_->request_event(PROFILE_07_SERVICE, PROFILE_07_INSTANCE, + PROFILE_07_EVENT, { PROFILE_07_EVENTGROUP }, + vsomeip::event_type_e::ET_FIELD, + vsomeip::reliability_type_e::RT_UNRELIABLE); + } +} + +void +e2e_profile_07_test_client::on_availability( + vsomeip::service_t _service, vsomeip::instance_t _instance, + bool _is_available) { + + VSOMEIP_INFO << __func__ << ": Client " + << std::hex << std::setw(4) << std::setfill('0') + << app_->get_client() + << " : Service [" << _service << "." << _instance + << "] is " << (_is_available ? "available." : "NOT available."); + + // check that correct service / instance ID gets available + if (_is_available) { + EXPECT_EQ(PROFILE_07_SERVICE, _service); + EXPECT_EQ(PROFILE_07_INSTANCE, _instance); + } + + if (PROFILE_07_SERVICE == _service && PROFILE_07_INSTANCE == _instance) { + std::unique_lock its_lock(mutex_); + if (is_available_ != !_is_available) { + is_available_ = false; + } else if(_is_available && !is_available_) { + is_available_ = true; + + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + app_->subscribe(PROFILE_07_SERVICE, PROFILE_07_INSTANCE, + PROFILE_07_EVENTGROUP, PROFILE_07_MAJOR); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + condition_.notify_one(); + } + } +} + +void +e2e_profile_07_test_client::on_message(const std::shared_ptr &_message) { + + VSOMEIP_INFO << __func__ << ": Received a message from Service [" + << std::setw(4) << std::setfill('0') << std::hex + << _message->get_service() << "." << _message->get_instance() + << "] to Client/Session [" + << _message->get_client() << "/" << _message->get_session() + << "]"; + + EXPECT_EQ(PROFILE_07_SERVICE, _message->get_service()); + EXPECT_EQ(PROFILE_07_INSTANCE, _message->get_instance()); + + // check fixed payload / CRC in response for service: d025 method: 0001 + if (vsomeip::message_type_e::MT_RESPONSE == _message->get_message_type() + && PROFILE_07_METHOD == _message->get_method()) { + // check for calculated CRC status OK for the predefined fixed payload sent by service + VSOMEIP_INFO << "Method ID 0x0001 -> IS_VALID_CRC = " + << std::boolalpha << _message->is_valid_crc(); + EXPECT_EQ(true, _message->is_valid_crc()); + + // check if payload is as expected as well (including CRC / counter / data ID) + std::shared_ptr its_payload = _message->get_payload(); + const auto its_data = its_payload->get_data(); + for (size_t i = 0; i < its_payload->get_length(); i++) + EXPECT_EQ(its_data[i], responses_[counters_[PROFILE_07_METHOD] + % PROFILE_07_NUM_MESSAGES][i]); + + counters_[PROFILE_07_METHOD]++; + + } else if (vsomeip::message_type_e::MT_NOTIFICATION == _message->get_message_type() + && PROFILE_07_EVENT == _message->get_method()) { + + // check CRC / payload calculated by sender for event 0x8001 against expected payload + // check for calculated CRC status OK for the calculated CRC / payload sent by service + VSOMEIP_INFO << __func__ << ": Event 0x8001 -> IS_VALID_CRC = " + << std::boolalpha << _message->is_valid_crc(); + EXPECT_EQ(true, _message->is_valid_crc()); + + // check if payload is as expected as well (including CRC / counter / data ID nibble) + std::shared_ptr its_payload = _message->get_payload(); + const auto its_data = its_payload->get_data(); + for (size_t i = 0; i< its_payload->get_length(); i++) + EXPECT_EQ(its_data[i], events_[counters_[PROFILE_07_EVENT] + % PROFILE_07_NUM_MESSAGES][i]); + + counters_[PROFILE_07_EVENT]++; + } + + received_++; + if (received_ == PROFILE_07_NUM_MESSAGES * 2) { + VSOMEIP_WARNING << __func__ << ": Client" + << std::setw(4) << std::setfill('0') << std::hex + << app_->get_client() + << " received all messages ~> going down!"; + } +} + +void +e2e_profile_07_test_client::run() { + + for (int i = 0; i < PROFILE_07_NUM_MESSAGES; ++i) { + { + std::unique_lock its_lock(mutex_); + while (!is_available_) { + condition_.wait(its_lock); + } + } + + auto request = vsomeip::runtime::get()->create_request(false); + request->set_service(PROFILE_07_SERVICE); + request->set_instance(PROFILE_07_INSTANCE); + request->set_interface_version(PROFILE_07_MAJOR); + + // send a request which is not e2e protected and expect an + // protected answer holding a fixed payload (E2E Profile 07) + // this call triggers also an event 0x8001 which holds a + // calculated payload + request->set_method(PROFILE_07_METHOD); + + app_->send(request); + + std::this_thread::sleep_for(std::chrono::milliseconds(250)); + } + + stop(); +} + +void +e2e_profile_07_test_client::join_sender_thread() { + + if (sender_.joinable()) { + sender_.join(); + } +} + +void +e2e_profile_07_test_client::shutdown_service() { + + auto request = vsomeip::runtime::get()->create_request(false); + request->set_service(PROFILE_07_SERVICE); + request->set_instance(PROFILE_07_INSTANCE); + request->set_method(PROFILE_07_SHUTDOWN); + request->set_interface_version(PROFILE_07_MAJOR); + + app_->send(request); + + std::this_thread::sleep_for(std::chrono::milliseconds(250)); + + // expect 10 responses + 10 events + EXPECT_EQ(received_, PROFILE_07_NUM_MESSAGES * 2); +} + +TEST(someip_e2e_profile_07_test, test_crc_calculation) { + + e2e_profile_07_test_client test_client; + + if (test_client.init()) { + test_client.start(); + test_client.join_sender_thread(); + } +} + +int main(int argc, char** argv) { + + // The first 8 bytes are the CRC calculated over all the data (except the CRC itself) and the previous 8 bytes from the vSomeIP header + // The next 4 bytes are the length of the data + // The next 4 bytes are the counter, starting at 0 + // the next 4 bytes are the DataID + // The rest are just random for the test + // { + // CRC, + // Length, Counter, + // DataID, Random Data, + // Random Data + // } + + responses_ = { + { + 0xf7, 0xa1, 0x9e, 0x0e, 0x9d, 0xbd, 0xa7, 0xca, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3d, 0x83, 0x3e, 0xba, 0x68, 0xed, 0x3f, 0xb3, + 0x7a, 0xf2, 0xbd, 0x96, 0xc1, 0x42, 0x3d, 0x25, + 0x1a, 0x62, 0xbd, 0xae, 0x77, 0xf3, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1d, 0xbd, + 0x4e, 0x01, 0x01, 0x3c, 0x2b, 0x87, 0xed, 0x00 + }, + { + 0xca, 0xb7, 0xae, 0x78, 0xe2, 0xa5, 0xdc, 0xab, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3c, 0x2f, 0x3e, 0xba, 0x46, 0x81, 0x3f, 0xb3, + 0x73, 0x8d, 0xbd, 0x93, 0xcb, 0xae, 0x3c, 0xf7, + 0xd2, 0x58, 0xbd, 0xa2, 0x6e, 0xcd, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1c, 0x89, + 0x24, 0x01, 0x01, 0x3c, 0x2b, 0x24, 0x45, 0x00 + }, + { + 0xbe, 0x5c, 0xe8, 0xd0, 0xa8, 0x3a, 0xca, 0x41, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3e, 0xf3, 0x3e, 0xba, 0x97, 0x45, 0x3f, 0xb3, + 0x86, 0x81, 0xbd, 0x8a, 0xda, 0xc2, 0x3c, 0xf6, + 0x00, 0x7a, 0xbd, 0xb4, 0xf9, 0xb9, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1c, 0x1b, + 0x72, 0x01, 0x01, 0x3c, 0x2a, 0x9e, 0x1f, 0x00 + } + }; + + events_ = { + { + 0x23, 0xfc, 0x1f, 0x7f, 0x13, 0x58, 0x95, 0xc0, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3d, 0x83, 0x3e, 0xba, 0x68, 0xed, 0x3f, 0xb3, + 0x7a, 0xf2, 0xbd, 0x96, 0xc1, 0x42, 0x3d, 0x25, + 0x1a, 0x62, 0xbd, 0xae, 0x77, 0xf3, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1d, 0xbd, + 0x4e, 0x01, 0x01, 0x3c, 0x2b, 0x87, 0xed, 0x00 + }, + { + 0xd0, 0x18, 0xa8, 0x8d, 0x18, 0xcf, 0x43, 0x6e, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3c, 0x2f, 0x3e, 0xba, 0x46, 0x81, 0x3f, 0xb3, + 0x73, 0x8d, 0xbd, 0x93, 0xcb, 0xae, 0x3c, 0xf7, + 0xd2, 0x58, 0xbd, 0xa2, 0x6e, 0xcd, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1c, 0x89, + 0x24, 0x01, 0x01, 0x3c, 0x2b, 0x24, 0x45, 0x00 + }, + { + 0xe1, 0x5d, 0x93, 0x59, 0x7e, 0x2a, 0xce, 0xc1, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3e, 0xf3, 0x3e, 0xba, 0x97, 0x45, 0x3f, 0xb3, + 0x86, 0x81, 0xbd, 0x8a, 0xda, 0xc2, 0x3c, 0xf6, + 0x00, 0x7a, 0xbd, 0xb4, 0xf9, 0xb9, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1c, 0x1b, + 0x72, 0x01, 0x01, 0x3c, 0x2a, 0x9e, 0x1f, 0x00 + } + }; + + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_client.hpp b/test/network_tests/e2e_tests/e2e_profile_07_test_client.hpp new file mode 100644 index 000000000..9b10a5891 --- /dev/null +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_client.hpp @@ -0,0 +1,48 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef E2E_PROFILE_07_TEST_CLIENT_HPP_ +#define E2E_PROFILE_07_TEST_CLIENT_HPP_ + +#include + +#include + +#include +#include +#include +#include + +class e2e_profile_07_test_client { +public: + e2e_profile_07_test_client(); + + bool init(); + void start(); + void stop(); + + void on_state(vsomeip::state_type_e _state); + void on_availability(vsomeip::service_t _service, + vsomeip::instance_t _instance, bool _is_available); + void on_message(const std::shared_ptr &_response); + + void run(); + void join_sender_thread(); + +private: + void shutdown_service(); + + std::shared_ptr app_; + + std::mutex mutex_; + std::condition_variable condition_; + bool is_available_; + + std::thread sender_; + + std::atomic received_; +}; + +#endif // E2E_PROFILE_07_TEST_CLIENT_HPP_ diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_common.hpp b/test/network_tests/e2e_tests/e2e_profile_07_test_common.hpp new file mode 100644 index 000000000..07b9b7679 --- /dev/null +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_common.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef E2E_PROFILE_07_TEST_COMMON_HPP_ +#define E2E_PROFILE_07_TEST_COMMON_HPP_ + +#include + +const vsomeip::service_t PROFILE_07_SERVICE = 0xd025; +const vsomeip::instance_t PROFILE_07_INSTANCE = 0x0001; +const vsomeip::major_version_t PROFILE_07_MAJOR = 0x01; +const vsomeip::minor_version_t PROFILE_07_MINOR = 0x00000000; + +const vsomeip::method_t PROFILE_07_METHOD = 0x0001; +const vsomeip::method_t PROFILE_07_SHUTDOWN = 0x0002; + +const vsomeip::eventgroup_t PROFILE_07_EVENTGROUP = 0x0001; +const vsomeip::event_t PROFILE_07_EVENT = 0x8001; + +#define PROFILE_07_NUM_MESSAGES 3 + +#endif // E2E_PROFILE_07_TEST_COMMON_HPP_ diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_external_master_start.sh b/test/network_tests/e2e_tests/e2e_profile_07_test_external_master_start.sh new file mode 100755 index 000000000..5b07bd0d1 --- /dev/null +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_external_master_start.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Purpose: This script is needed to start the services with +# one command. This is necessary as ctest - which is used to run the +# tests - isn't able to start multiple binaries for one testcase. Therefore +# the testcase simply executes this script. This script then runs the services +# and checks that all exit successfully. + +if [ $# -lt 1 ] +then + echo "Please pass a json file to this script" + echo "For example: $0 e2e_profile_07_test_client_external.json" + exit 1 +fi + +MASTER_JSON_FILE=$1 +SERVICE_JSON_FILE=${MASTER_JSON_FILE/client/service} +ALLOW_DENY=$2 + +FAIL=0 + +export VSOMEIP_CONFIGURATION=$1 +export VSOMEIP_APPLICATION_NAME=client-sample +./e2e_profile_07_test_client --remote & +PID_CLIENT=$! + + +if [ ! -z "$USE_LXC_TEST" ]; then + echo "starting external e2e profile 07 test on slave LXC" + ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip_lib/test/network_tests; ./e2e_profile_07_test_external_slave_start.sh $SERVICE_JSON_FILE\"" & +elif [ ! -z "$USE_DOCKER" ]; then + docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./e2e_profile_07_test_external_slave_start.sh $SERVICE_JSON_FILE" & +else +cat < > responses_; +std::vector > events_; + +std::map counters_; + +e2e_profile_07_test_service::e2e_profile_07_test_service() + : app_(vsomeip::runtime::get()->create_application()), + is_registered_(false), + blocked_(false), + offer_thread_(std::bind(&e2e_profile_07_test_service::run, this)), + received_(0) { +} + +bool +e2e_profile_07_test_service::init() { + + std::lock_guard its_lock(mutex_); + + if (!app_->init()) { + ADD_FAILURE() << __func__ << ": Cannot initialize application."; + return false; + } + + app_->register_message_handler(PROFILE_07_SERVICE, PROFILE_07_INSTANCE, + PROFILE_07_METHOD, + std::bind(&e2e_profile_07_test_service::on_message, this, + std::placeholders::_1)); + + app_->register_message_handler(PROFILE_07_SERVICE, PROFILE_07_INSTANCE, + PROFILE_07_SHUTDOWN, + std::bind(&e2e_profile_07_test_service::on_message_shutdown, this, + std::placeholders::_1)); + + app_->register_state_handler( + std::bind(&e2e_profile_07_test_service::on_state, this, + std::placeholders::_1)); + + // E2E Profile 07: Event 8001 + app_->offer_event(PROFILE_07_SERVICE, PROFILE_07_INSTANCE, + PROFILE_07_EVENT, { PROFILE_07_EVENTGROUP }, + vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(), + false, true, nullptr, vsomeip::reliability_type_e::RT_UNRELIABLE); + + // Initialize the attribute + auto its_payload = vsomeip::runtime::get()->create_payload(); + vsomeip::byte_t its_data[] = { + 0x00, 0x50, 0x8f, 0x80, 0x01, 0x00, 0x00, 0x2d, + 0xf3, 0x2a, 0x8c, 0x89, 0x05, 0x04, 0xcc, 0x46, + 0x00, 0x00, 0x09, 0x3d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x40, 0xb1, 0x3e, 0xba, 0xc4, 0x76, 0x3f, 0xb3, + 0x7b, 0x03, 0xbd, 0x95, 0x74, 0x53, 0x3d, 0x32, + 0x4b, 0x9d, 0xbd, 0xbc, 0xd6, 0x3b, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1f, 0xf5, + 0xf6, 0x01, 0x01, 0x3c, 0x2b, 0xb1, 0xa2, 0x00 + }; + its_payload->set_data(its_data, sizeof(its_data)); + + app_->notify(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, + static_cast(0x8001), its_payload); + + return true; +} + +void +e2e_profile_07_test_service::start() { + + VSOMEIP_INFO << __func__ << ": Starting..."; + app_->start(); +} + +void +e2e_profile_07_test_service::stop() { + + VSOMEIP_INFO << __func__ << ": Stopping..."; + app_->clear_all_handler(); + app_->stop(); +} + +void +e2e_profile_07_test_service::join_offer_thread() { + + if (offer_thread_.joinable()) { + offer_thread_.join(); + } +} + +void +e2e_profile_07_test_service::offer() { + + app_->offer_service(PROFILE_07_SERVICE, PROFILE_07_INSTANCE, + PROFILE_07_MAJOR, PROFILE_07_MINOR); +} + +void +e2e_profile_07_test_service::stop_offer() { + + app_->stop_offer_service(PROFILE_07_SERVICE, PROFILE_07_INSTANCE, + PROFILE_07_MAJOR, PROFILE_07_MINOR); +} + +void +e2e_profile_07_test_service::on_state(vsomeip::state_type_e _state) { + + VSOMEIP_INFO << __func__ << ": Application " + << app_->get_name() << " is " + << (_state == vsomeip::state_type_e::ST_REGISTERED ? + "registered." : "deregistered."); + + if (_state == vsomeip::state_type_e::ST_REGISTERED) { + if (!is_registered_) { + is_registered_ = true; + + std::lock_guard its_lock(mutex_); + blocked_ = true; + + // "start" the run method thread + condition_.notify_one(); + } + } else { + is_registered_ = false; + } +} + +void +e2e_profile_07_test_service::on_message( + const std::shared_ptr &_request) { + + ASSERT_EQ(PROFILE_07_SERVICE, _request->get_service()); + ASSERT_EQ(PROFILE_07_INSTANCE, _request->get_instance()); + + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::setw(4) << std::setfill('0') << std::hex + << _request->get_client() << "/" << _request->get_session() + << "] method: " << _request->get_method() ; + + std::shared_ptr its_response = + vsomeip::runtime::get()->create_response(_request); + std::shared_ptr< vsomeip::payload > its_response_payload = + vsomeip::runtime::get()->create_payload(); + std::shared_ptr its_event_payload = + vsomeip::runtime::get()->create_payload(); + + // send fixed payload for profile 07 CRC64 + if (PROFILE_07_METHOD == _request->get_method()) { + its_response_payload->set_data(responses_[counters_[PROFILE_07_METHOD] % PROFILE_07_NUM_MESSAGES]); + its_response->set_payload(its_response_payload); + app_->send(its_response); + + counters_[PROFILE_07_METHOD]++; + + // set value to field which gets filled by e2e protection with CRC on sending + its_event_payload->set_data(events_[counters_[PROFILE_07_EVENT] % PROFILE_07_NUM_MESSAGES]); + app_->notify(PROFILE_07_SERVICE, PROFILE_07_INSTANCE, PROFILE_07_EVENT, its_event_payload); + + counters_[PROFILE_07_EVENT]++; + } + + received_++; + if (received_ == PROFILE_07_NUM_MESSAGES) { + VSOMEIP_INFO << __func__ << ": Received all messages!"; + } +} + +void +e2e_profile_07_test_service::on_message_shutdown( + const std::shared_ptr &_request) { + + (void)_request; + VSOMEIP_INFO << __func__ << ": Shutdown method was called, going down now."; + stop(); +} + +void +e2e_profile_07_test_service::run() { + + std::unique_lock its_lock(mutex_); + while (!blocked_) + condition_.wait(its_lock); + + offer(); +} + +TEST(someip_e2e_profile_07_test, basic_subscribe_request_response) { + e2e_profile_07_test_service test_service; + if (test_service.init()) { + test_service.start(); + test_service.join_offer_thread(); + } +} + +#if defined(__linux__) || defined(ANDROID) || defined(__QNX__) +int main(int argc, char** argv) { + + + counters_[PROFILE_07_METHOD] = 0; + counters_[PROFILE_07_EVENT] = 0; + + std::string test_remote("--remote"); + std::string test_local("--local"); + std::string test_allow_remote_client("--allow"); + std::string test_deny_remote_client("--deny"); + std::string help("--help"); + + int i = 1; + while (i < argc) + { + if(test_remote == argv[i]) + { + is_remote_test = true; + } + else if(test_local == argv[i]) + { + is_remote_test = false; + } + else if(test_allow_remote_client == argv[i]) + { + remote_client_allowed = true; + } + else if(test_deny_remote_client == argv[i]) + { + remote_client_allowed = false; + } + else if(help == argv[i]) + { + VSOMEIP_INFO << "Parameters:\n" + << "--remote: Run test between two hosts\n" + << "--local: Run test locally\n" + << "--allow: test is started with a policy that allows remote messages sent by this test client to the service\n" + << "--deny: test is started with a policy that denies remote messages sent by this test client to the service\n" + << "--help: print this help"; + } + i++; + } + + // Payloads (without counter, data id and crc) + responses_ = { + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3d, 0x83, 0x3e, 0xba, 0x68, 0xed, 0x3f, 0xb3, + 0x7a, 0xf2, 0xbd, 0x96, 0xc1, 0x42, 0x3d, 0x25, + 0x1a, 0x62, 0xbd, 0xae, 0x77, 0xf3, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1d, 0xbd, + 0x4e, 0x01, 0x01, 0x3c, 0x2b, 0x87, 0xed, 0x00 + }, + { + 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x69, 0x02, 0x1c, + 0x00, 0x00, 0x09, 0x3d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3c, 0x2f, 0x3e, 0xba, 0x46, 0x81, 0x3f, 0xb3, + 0x73, 0x8d, 0xbd, 0x93, 0xcb, 0xae, 0x3c, 0xf7, + 0xd2, 0x58, 0xbd, 0xa2, 0x6e, 0xcd, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1c, 0x89, + 0x24, 0x01, 0x01, 0x3c, 0x2b, 0x24, 0x45, 0x00 + }, + { + 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x1b, 0x28, 0xae, + 0x00, 0x00, 0x09, 0x3d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3e, 0xf3, 0x3e, 0xba, 0x97, 0x45, 0x3f, 0xb3, + 0x86, 0x81, 0xbd, 0x8a, 0xda, 0xc2, 0x3c, 0xf6, + 0x00, 0x7a, 0xbd, 0xb4, 0xf9, 0xb9, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1c, 0x1b, + 0x72, 0x01, 0x01, 0x3c, 0x2a, 0x9e, 0x1f, 0x00 + } + }; + + events_ = { + { + 0x23, 0xfc, 0x1f, 0x7f, 0x13, 0x58, 0x95, 0xc0, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3d, 0x83, 0x3e, 0xba, 0x68, 0xed, 0x3f, 0xb3, + 0x7a, 0xf2, 0xbd, 0x96, 0xc1, 0x42, 0x3d, 0x25, + 0x1a, 0x62, 0xbd, 0xae, 0x77, 0xf3, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1d, 0xbd, + 0x4e, 0x01, 0x01, 0x3c, 0x2b, 0x87, 0xed, 0x00 + }, + { + 0xd0, 0x18, 0xa8, 0x8d, 0x18, 0xcf, 0x43, 0x6e, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3c, 0x2f, 0x3e, 0xba, 0x46, 0x81, 0x3f, 0xb3, + 0x73, 0x8d, 0xbd, 0x93, 0xcb, 0xae, 0x3c, 0xf7, + 0xd2, 0x58, 0xbd, 0xa2, 0x6e, 0xcd, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1c, 0x89, + 0x24, 0x01, 0x01, 0x3c, 0x2b, 0x24, 0x45, 0x00 + }, + { + 0xe1, 0x5d, 0x93, 0x59, 0x7e, 0x2a, 0xce, 0xc1, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x06, 0xfe, + 0x01, 0x3e, 0x4c, 0xcc, 0xcd, 0x80, 0x3f, 0xb2, + 0x3e, 0xf3, 0x3e, 0xba, 0x97, 0x45, 0x3f, 0xb3, + 0x86, 0x81, 0xbd, 0x8a, 0xda, 0xc2, 0x3c, 0xf6, + 0x00, 0x7a, 0xbd, 0xb4, 0xf9, 0xb9, 0x3f, 0x80, + 0x00, 0x00, 0xfc, 0x01, 0x01, 0x3c, 0x1c, 0x1b, + 0x72, 0x01, 0x01, 0x3c, 0x2a, 0x9e, 0x1f, 0x00 + } + }; + + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} +#endif diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_service.hpp b/test/network_tests/e2e_tests/e2e_profile_07_test_service.hpp new file mode 100644 index 000000000..ad6488a54 --- /dev/null +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_service.hpp @@ -0,0 +1,49 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef E2E_PROFILE_07_TEST_SERVICE_HPP_ +#define E2E_PROFILE_07_TEST_SERVICE_HPP_ + +#include + +#include + +#include "../someip_test_globals.hpp" +#include + +#include +#include +#include +#include + +class e2e_profile_07_test_service { +public: + e2e_profile_07_test_service(); + + bool init(); + void start(); + void stop(); + void offer(); + void stop_offer(); + void join_offer_thread(); + void on_state(vsomeip::state_type_e _state); + void on_message(const std::shared_ptr &_request); + void on_message_shutdown(const std::shared_ptr &_request); + void run(); + +private: + std::shared_ptr app_; + bool is_registered_; + + bool blocked_; + std::mutex mutex_; + std::condition_variable condition_; + + std::thread offer_thread_; + + std::atomic received_; +}; + +#endif // E2E_PROFILE_07_TEST_SERVICE_HPP_ diff --git a/test/network_tests/header_factory_tests/conf/header_factory_test_send_receive_starter.sh.bat.in b/test/network_tests/header_factory_tests/conf/header_factory_test_send_receive_starter.sh.bat.in new file mode 100755 index 000000000..c9ce0ea06 --- /dev/null +++ b/test/network_tests/header_factory_tests/conf/header_factory_test_send_receive_starter.sh.bat.in @@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Purpose: This script is needed to start the client and service with +# one command. This is necessary as ctest - which is used to run the +# tests - isn't able to start two binaries for one testcase. Therefore +# the testcase simply executes this script. This script then runs client +# and service and checks that both exit sucessfully. + +FAIL=0 + +# Start the service +export VSOMEIP_APPLICATION_NAME=header_factory_test_service +export VSOMEIP_CONFIGURATION=header_factory_test_service.json +./header_factory_test_service & +sleep 1 + +# Start the client +export VSOMEIP_APPLICATION_NAME=header_factory_test_client +export VSOMEIP_CONFIGURATION=header_factory_test_client.json +if ! ./header_factory_test_client +then + FAIL=$((FAIL+1)) +fi + +# Wait until service is finished +# Fail gets incremented if service exit +# with a non-zero exit code +wait $! || FAIL=$((FAIL+1)) + +# Check if client and server both exited sucessfully +exit $FAIL diff --git a/test/network_tests/initial_event_tests/initial_event_test_master_starter.sh b/test/network_tests/initial_event_tests/initial_event_test_master_starter.sh index 9d52e3ff7..b8f673350 100755 --- a/test/network_tests/initial_event_tests/initial_event_test_master_starter.sh +++ b/test/network_tests/initial_event_tests/initial_event_test_master_starter.sh @@ -117,6 +117,8 @@ do wait $job || FAIL=$(($FAIL+1)) done +echo "Starting stop service | Master" + # wait until all clients exited on slave side ./initial_event_test_stop_service MASTER & PID_STOP_SERVICE=$! @@ -132,7 +134,6 @@ kill $PID_SERVICE_TWO kill $PID_SERVICE_ONE sleep 1 -echo "" # Check if they exited successfully if [ $FAIL -eq 0 ] diff --git a/test/network_tests/initial_event_tests/initial_event_test_service.cpp b/test/network_tests/initial_event_tests/initial_event_test_service.cpp index d39b6254b..a1cd03e78 100644 --- a/test/network_tests/initial_event_tests/initial_event_test_service.cpp +++ b/test/network_tests/initial_event_tests/initial_event_test_service.cpp @@ -85,8 +85,10 @@ class initial_event_test_service : public vsomeip_utilities::base_logger { "registered." : "deregistered."); if (_state == vsomeip::state_type_e::ST_REGISTERED) { + { std::lock_guard its_lock(mutex_); wait_until_registered_ = false; + } condition_.notify_one(); } } diff --git a/test/network_tests/initial_event_tests/initial_event_test_slave_starter.sh b/test/network_tests/initial_event_tests/initial_event_test_slave_starter.sh index 6aea217bf..55f573fec 100755 --- a/test/network_tests/initial_event_tests/initial_event_test_slave_starter.sh +++ b/test/network_tests/initial_event_tests/initial_event_test_slave_starter.sh @@ -78,6 +78,7 @@ do wait $job || FAIL=$(($FAIL+1)) done +echo "Starting stop service | Slave" # wait until all clients exited on master side ./initial_event_test_stop_service SLAVE & PID_STOP_SERVICE=$! @@ -93,7 +94,6 @@ kill $PID_SERVICE_FIVE kill $PID_SERVICE_FOUR sleep 1 -echo "" # Check if they exited successfully if [ $FAIL -eq 0 ] diff --git a/test/network_tests/payload_tests/conf/external_local_payload_test_client_local_starter.sh.bat.in b/test/network_tests/payload_tests/conf/external_local_payload_test_client_local_starter.sh.bat.in new file mode 100755 index 000000000..d28d1e4ef --- /dev/null +++ b/test/network_tests/payload_tests/conf/external_local_payload_test_client_local_starter.sh.bat.in @@ -0,0 +1,87 @@ +#!/bin/sh +# Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Purpose: This script is needed to start the client and service with +# one command. This is necessary as ctest - which is used to run the +# tests - isn't able to start two binaries for one testcase. Therefore +# the testcase simply executes this script. This script then runs client +# and service and checks that both exit sucessfully. + +FAIL=0 + +# Parameter 1: the pid to check +# Parameter 2: number of TCP/UDP sockets the process should have open +check_tcp_udp_sockets_are_open () +{ + # Check that the passed pid/process does listen on at least one TCP/UDP socket + # awk is used to avoid the case when a inode number is the same as a PID. The awk + # program filters the netstat output down to the protocol (1st field) and + # the PID/Program name (last field) fields. + SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) + if [ $SERVICE_SOCKETS_LISTENING -lt $2 ] + then + FAIL=$(($FAIL+1)) + fi +} + +# Parameter 1: the pid to check +check_tcp_udp_sockets_are_closed () +{ + # Check that the passed pid/process does not listen on any TCP/UDP socket + # or has any active connection via a TCP/UDP socket + # awk is used to avoid the case when a inode number is the same as a PID. The awk + # program filters the netstat output down to the protocol (1st field) and + # the PID/Program name (last field) fields. + SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) + if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] + then + FAIL=$(($FAIL+1)) + fi + + SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) + if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] + then + FAIL=$(($FAIL+1)) + fi +} + +# Start the service +export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service +export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json +./payload_test_service & +SERIVCE_PID=$! +sleep 1; + +# The service should listen on a TCP and UDP socket now +check_tcp_udp_sockets_are_open $SERIVCE_PID 2 + +# Start the client +export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local +export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json +./payload_test_client & +CLIENT_PID=$! + +# The service should still listen on a TCP and UDP socket now +check_tcp_udp_sockets_are_open $SERIVCE_PID 2 +# The client should use the shortcut over a local UDS instead of TCP/UDP, +# therefore he shouldn't have any open TCP/UDP sockets +check_tcp_udp_sockets_are_closed $CLIENT_PID + +if [ ! -z "$USE_DOCKER" ]; then + FAIL=0 +fi + +# Wait until client and service are finished +for job in $(pgrep -P $$) +do + # Fail gets incremented if either client or service exit + # with a non-zero exit code + wait $job || FAIL=$(($FAIL+1)) +done + +# Check if client and server both exited sucessfully and the service didnt't +# have any open tcp/udp sockets +exit $FAIL diff --git a/test/network_tests/payload_tests/conf/local_payload_test_huge_payload_starter.sh.bat.in b/test/network_tests/payload_tests/conf/local_payload_test_huge_payload_starter.sh.bat.in new file mode 100755 index 000000000..499a80fb8 --- /dev/null +++ b/test/network_tests/payload_tests/conf/local_payload_test_huge_payload_starter.sh.bat.in @@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Purpose: This script is needed to start the client and service with +# one command. This is necessary as ctest - which is used to run the +# tests - isn't able to start two binaries for one testcase. Therefore +# the testcase simply executes this script. This script then runs client +# and service and checks that both exit sucessfully. + +FAIL=0 + +# Start the service +export VSOMEIP_APPLICATION_NAME=local_payload_test_service +export VSOMEIP_CONFIGURATION=local_payload_test_service.json +./payload_test_service & +sleep 1; + +# Start the client +export VSOMEIP_APPLICATION_NAME=local_payload_test_client +export VSOMEIP_CONFIGURATION=local_payload_test_client.json +if ! ./payload_test_client --number-of-messages 100 --max-payload-size 10485760 +then + FAIL=$((FAIL+1)) +fi + +# Wait until service is finished +# Fail gets incremented if service exit +# with a non-zero exit code +wait $! || FAIL=$((FAIL+1)) + +# Check if client and server both exited sucessfully +exit $FAIL diff --git a/test/network_tests/payload_tests/conf/local_payload_test_starter.sh.bat.in b/test/network_tests/payload_tests/conf/local_payload_test_starter.sh.bat.in new file mode 100755 index 000000000..3a9294c1a --- /dev/null +++ b/test/network_tests/payload_tests/conf/local_payload_test_starter.sh.bat.in @@ -0,0 +1,64 @@ +#!/bin/sh +# Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Purpose: This script is needed to start the client and service with +# one command. This is necessary as ctest - which is used to run the +# tests - isn't able to start two binaries for one testcase. Therefore +# the testcase simply executes this script. This script then runs client +# and service and checks that both exit sucessfully. + +FAIL=0 + +# Parameter 1: the pid to check +check_tcp_udp_sockets_are_closed () +{ + # Check that the service does not listen on any TCP/UDP socket + # or has any active connection via a TCP/UDP socket + # awk is used to avoid the case when a inode number is the same as a PID. The awk + # program filters the netstat output down to the protocol (1st field) and + # the PID/Program name (last field) fields. + SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) + if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] + then + FAIL=$(($FAIL+1)) + fi + + SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) + if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] + then + FAIL=$(($FAIL+1)) + fi +} + +# Start the service +export VSOMEIP_APPLICATION_NAME=local_payload_test_service +export VSOMEIP_CONFIGURATION=local_payload_test_service.json +./payload_test_service & +SERIVCE_PID=$! +sleep 1; + +check_tcp_udp_sockets_are_closed $SERIVCE_PID + +# Start the client +export VSOMEIP_APPLICATION_NAME=local_payload_test_client +export VSOMEIP_CONFIGURATION=local_payload_test_client.json +./payload_test_client & +CLIENT_PID=$! + +check_tcp_udp_sockets_are_closed $SERIVCE_PID +check_tcp_udp_sockets_are_closed $CLIENT_PID + +# Wait until client and service are finished +for job in $(pgrep -P $$) +do + # Fail gets incremented if either client or service exit + # with a non-zero exit code + wait $job || FAIL=$(($FAIL+1)) +done + +# Check if client and server both exited sucessfully and the service didnt't +# have any open tcp/udp sockets +exit $FAIL diff --git a/test/network_tests/payload_tests/external_local_payload_test_client_local_starter.sh b/test/network_tests/payload_tests/external_local_payload_test_client_local_starter.sh index c73dd8161..63ff279aa 100755 --- a/test/network_tests/payload_tests/external_local_payload_test_client_local_starter.sh +++ b/test/network_tests/payload_tests/external_local_payload_test_client_local_starter.sh @@ -16,9 +16,9 @@ FAIL=0 # Parameter 2: number of TCP/UDP sockets the process should have open check_tcp_udp_sockets_are_open () { - # Check that the passed pid/process does listen on at least one TCP/UDP socket + # Check that the passed pid/process does listen on at least one TCP/UDP socket # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and + # program filters the netstat output down to the protocol (1st field) and # the PID/Program name (last field) fields. SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) if [ $SERVICE_SOCKETS_LISTENING -lt $2 ] @@ -30,10 +30,10 @@ check_tcp_udp_sockets_are_open () # Parameter 1: the pid to check check_tcp_udp_sockets_are_closed () { - # Check that the passed pid/process does not listen on any TCP/UDP socket + # Check that the passed pid/process does not listen on any TCP/UDP socket # or has any active connection via a TCP/UDP socket # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and + # program filters the netstat output down to the protocol (1st field) and # the PID/Program name (last field) fields. SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] diff --git a/test/network_tests/payload_tests/local_payload_test_starter.sh b/test/network_tests/payload_tests/local_payload_test_starter.sh index abc45772d..38a6f0379 100755 --- a/test/network_tests/payload_tests/local_payload_test_starter.sh +++ b/test/network_tests/payload_tests/local_payload_test_starter.sh @@ -15,10 +15,10 @@ FAIL=0 # Parameter 1: the pid to check check_tcp_udp_sockets_are_closed () { - # Check that the service does not listen on any TCP/UDP socket + # Check that the service does not listen on any TCP/UDP socket # or has any active connection via a TCP/UDP socket # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and + # program filters the netstat output down to the protocol (1st field) and # the PID/Program name (last field) fields. SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] diff --git a/test/network_tests/suspend_resume_tests/suspend_resume_test_slave_starter.sh b/test/network_tests/suspend_resume_tests/suspend_resume_test_slave_starter.sh index 9cbf85dd0..dbbbbb8cb 100755 --- a/test/network_tests/suspend_resume_tests/suspend_resume_test_slave_starter.sh +++ b/test/network_tests/suspend_resume_tests/suspend_resume_test_slave_starter.sh @@ -20,10 +20,10 @@ do wait $job || ((FAIL+=1)) done -# Check if both exited successfully +# Check if both exited successfully if [ $FAIL -eq 0 ] then exit 0 else exit 1 -fi \ No newline at end of file +fi