summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1015
-rw-r--r--test/application_tests/application_test.cpp35
-rw-r--r--test/application_tests/application_test_client.cpp8
-rw-r--r--test/application_tests/application_test_client_availability.cpp2
-rw-r--r--test/application_tests/application_test_daemon.cpp2
-rw-r--r--test/application_tests/application_test_service.cpp8
-rw-r--r--test/application_tests/application_test_single_process.cpp6
-rwxr-xr-xtest/application_tests/application_test_starter.sh6
-rw-r--r--test/application_tests/conf/application_test_daemon.json.in2
-rw-r--r--test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in2
-rw-r--r--test/big_payload_tests/big_payload_test_client.cpp32
-rw-r--r--test/big_payload_tests/big_payload_test_client.hpp3
-rwxr-xr-xtest/big_payload_tests/big_payload_test_external_starter.sh26
-rw-r--r--test/big_payload_tests/big_payload_test_globals.hpp3
-rw-r--r--test/big_payload_tests/big_payload_test_local.json6
-rw-r--r--test/big_payload_tests/big_payload_test_local_limited.json6
-rw-r--r--test/big_payload_tests/big_payload_test_local_queue_limited.json8
-rw-r--r--test/big_payload_tests/big_payload_test_local_random.json4
-rw-r--r--test/big_payload_tests/big_payload_test_service.cpp148
-rw-r--r--test/big_payload_tests/big_payload_test_service.hpp4
-rwxr-xr-xtest/big_payload_tests/big_payload_test_service_external_start.sh6
-rw-r--r--test/big_payload_tests/big_payload_test_udp_client.json44
-rw-r--r--test/big_payload_tests/big_payload_test_udp_service.json41
-rw-r--r--test/big_payload_tests/conf/big_payload_test_udp_client.json.in44
-rw-r--r--test/big_payload_tests/conf/big_payload_test_udp_service.json.in41
-rwxr-xr-xtest/client_id_tests/client_id_test_master_starter.sh9
-rw-r--r--test/client_id_tests/client_id_test_service.cpp4
-rw-r--r--test/client_id_tests/client_id_test_utility.cpp658
-rw-r--r--test/client_id_tests/client_id_test_utility.json2
-rw-r--r--test/client_id_tests/client_id_test_utility_discontinuous_masked_511.json2
-rw-r--r--test/client_id_tests/client_id_test_utility_masked_127.json2
-rw-r--r--test/client_id_tests/client_id_test_utility_masked_4095.json4
-rw-r--r--test/client_id_tests/client_id_test_utility_masked_511.json4
-rw-r--r--test/configuration_tests/configuration-test-deprecated.json30
-rw-r--r--test/configuration_tests/configuration-test.cpp211
-rw-r--r--test/configuration_tests/configuration-test.json42
-rw-r--r--test/cpu_load_tests/conf/cpu_load_test_client_master.json.in6
-rw-r--r--test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in6
-rw-r--r--test/cpu_load_tests/conf/cpu_load_test_service_master.json.in7
-rw-r--r--test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in7
-rw-r--r--test/cpu_load_tests/cpu_load_measurer.cpp3
-rw-r--r--test/cpu_load_tests/cpu_load_test_client.cpp10
-rwxr-xr-xtest/cpu_load_tests/cpu_load_test_master_starter.sh9
-rw-r--r--test/cpu_load_tests/cpu_load_test_service.cpp6
-rw-r--r--test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_client.cpp748
-rw-r--r--test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_globals.hpp39
-rwxr-xr-xtest/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_master_starter.sh70
-rw-r--r--test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_service.cpp184
-rwxr-xr-xtest/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_slave_starter.sh33
-rw-r--r--test/e2e_tests/e2e_test_client.cpp16
-rwxr-xr-xtest/e2e_tests/e2e_test_external_master_start.sh2
-rw-r--r--test/e2e_tests/e2e_test_service.cpp12
-rw-r--r--test/event_tests/conf/event_test_master.json.in2
-rw-r--r--test/event_tests/conf/event_test_slave_tcp.json.in2
-rw-r--r--test/event_tests/conf/event_test_slave_udp.json.in2
-rw-r--r--test/event_tests/event_test_client.cpp8
-rwxr-xr-xtest/event_tests/event_test_master_starter.sh4
-rw-r--r--test/event_tests/event_test_service.cpp13
-rwxr-xr-xtest/event_tests/event_test_slave_starter.sh2
-rw-r--r--test/header_factory_tests/header_factory_test_client.cpp3
-rw-r--r--test/header_factory_tests/header_factory_test_client.hpp2
-rw-r--r--test/header_factory_tests/header_factory_test_service.cpp2
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in93
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_udp.json.in (renamed from test/debug_diag_job_plugin_tests/conf/debug_diag_job_plugin_test_master.json.in)41
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in93
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_udp.json.in67
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in93
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_udp.json.in66
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in93
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_udp.json.in67
-rw-r--r--test/initial_event_tests/initial_event_test_availability_checker.cpp4
-rw-r--r--test/initial_event_tests/initial_event_test_client.cpp102
-rw-r--r--test/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_master_udp.json66
-rw-r--r--test/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_slave_udp.json67
-rw-r--r--test/initial_event_tests/initial_event_test_diff_client_ids_same_ports_master_udp.json66
-rw-r--r--test/initial_event_tests/initial_event_test_diff_client_ids_same_ports_slave_udp.json67
-rwxr-xr-xtest/initial_event_tests/initial_event_test_master_starter.sh49
-rw-r--r--test/initial_event_tests/initial_event_test_service.cpp11
-rwxr-xr-xtest/initial_event_tests/initial_event_test_slave_starter.sh35
-rw-r--r--test/initial_event_tests/initial_event_test_stop_service.cpp14
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_client.cpp38
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_service.cpp4
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_starter.sh4
-rw-r--r--test/malicious_data_tests/conf/malicious_data_test_master.json.in2
-rwxr-xr-xtest/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in13
-rw-r--r--test/malicious_data_tests/malicious_data_test_msg_sender.cpp19
-rw-r--r--test/malicious_data_tests/malicious_data_test_service.cpp7
-rw-r--r--test/npdu_tests/conf/npdu_test_client_no_npdu.json.in39
-rw-r--r--test/npdu_tests/conf/npdu_test_client_npdu.json.in167
-rw-r--r--test/npdu_tests/conf/npdu_test_service_no_npdu.json.in87
-rw-r--r--test/npdu_tests/conf/npdu_test_service_npdu.json.in168
-rw-r--r--test/npdu_tests/npdu_test_client.cpp599
-rw-r--r--test/npdu_tests/npdu_test_client.hpp103
-rw-r--r--test/npdu_tests/npdu_test_client_no_npdu.json39
-rwxr-xr-xtest/npdu_tests/npdu_test_client_no_npdu_start.sh82
-rw-r--r--test/npdu_tests/npdu_test_client_npdu.json167
-rwxr-xr-xtest/npdu_tests/npdu_test_client_npdu_start.sh75
-rw-r--r--test/npdu_tests/npdu_test_globals.hpp45
-rw-r--r--test/npdu_tests/npdu_test_rmd.cpp160
-rw-r--r--test/npdu_tests/npdu_test_rmd.hpp (renamed from test/security_config_plugin_tests/security_config_plugin_test_service.hpp)30
-rw-r--r--test/npdu_tests/npdu_test_service.cpp306
-rw-r--r--test/npdu_tests/npdu_test_service.hpp64
-rw-r--r--test/npdu_tests/npdu_test_service_no_npdu.json87
-rwxr-xr-xtest/npdu_tests/npdu_test_service_no_npdu_start.sh64
-rw-r--r--test/npdu_tests/npdu_test_service_npdu.json168
-rwxr-xr-xtest/npdu_tests/npdu_test_service_npdu_start.sh64
-rwxr-xr-xtest/npdu_tests/npdu_test_starter.sh96
-rw-r--r--test/offer_tests/conf/offer_test_big_sd_msg_master.json.in2
-rwxr-xr-xtest/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in13
-rw-r--r--test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in2
-rw-r--r--test/offer_tests/conf/offer_test_external_master.json.in2
-rwxr-xr-xtest/offer_tests/conf/offer_test_external_master_starter.sh.in26
-rw-r--r--test/offer_tests/conf/offer_test_external_slave.json.in2
-rw-r--r--test/offer_tests/offer_test_big_sd_msg_client.cpp24
-rw-r--r--test/offer_tests/offer_test_big_sd_msg_service.cpp53
-rwxr-xr-xtest/offer_tests/offer_test_big_sd_msg_slave_starter.sh2
-rw-r--r--test/offer_tests/offer_test_client.cpp24
-rwxr-xr-xtest/offer_tests/offer_test_external_slave_starter.sh2
-rw-r--r--test/offer_tests/offer_test_local.json2
-rwxr-xr-xtest/offer_tests/offer_test_local_starter.sh8
-rw-r--r--test/offer_tests/offer_test_service.cpp12
-rw-r--r--test/offer_tests/offer_test_service_external.cpp8
-rw-r--r--test/offered_services_info_test/offered_services_info_test_client.cpp13
-rw-r--r--test/offered_services_info_test/offered_services_info_test_local.json22
-rwxr-xr-xtest/offered_services_info_test/offered_services_info_test_local_starter.sh4
-rw-r--r--test/offered_services_info_test/offered_services_info_test_service.cpp16
-rw-r--r--test/payload_tests/conf/external_local_payload_test_client_external.json.in7
-rw-r--r--test/payload_tests/conf/external_local_payload_test_client_local.json.in7
-rw-r--r--test/payload_tests/conf/external_local_payload_test_service.json.in7
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_external_starter.sh9
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_and_external_starter.sh9
-rw-r--r--test/payload_tests/payload_test_client.cpp10
-rw-r--r--test/payload_tests/payload_test_service.cpp9
-rw-r--r--test/payload_tests/payload_test_service.hpp4
-rw-r--r--test/pending_subscription_tests/conf/pending_subscription_test_master.json.in15
-rwxr-xr-xtest/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in13
-rw-r--r--test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp1305
-rw-r--r--test/pending_subscription_tests/pending_subscription_test_service.cpp34
-rw-r--r--test/readme.txt51
-rw-r--r--test/restart_routing_tests/restart_routing_test_client.cpp15
-rw-r--r--test/restart_routing_tests/restart_routing_test_client.hpp2
-rw-r--r--test/restart_routing_tests/restart_routing_test_client.json2
-rw-r--r--test/restart_routing_tests/restart_routing_test_service.cpp2
-rw-r--r--test/restart_routing_tests/restart_routing_test_service.json4
-rwxr-xr-xtest/restart_routing_tests/restart_routing_test_starter.sh24
-rwxr-xr-xtest/routing_tests/conf/local_routing_test_starter.sh.in2
-rw-r--r--test/routing_tests/external_local_routing_test_service.cpp2
-rwxr-xr-xtest/routing_tests/external_local_routing_test_starter.sh9
-rw-r--r--test/routing_tests/local_routing_test_client.cpp3
-rw-r--r--test/routing_tests/local_routing_test_client.hpp1
-rw-r--r--test/routing_tests/local_routing_test_client.json2
-rw-r--r--test/routing_tests/local_routing_test_service.cpp2
-rw-r--r--test/routing_tests/local_routing_test_service.json2
-rw-r--r--test/second_address_tests/conf/second_address_test_master_client.json.in (renamed from test/debug_diag_job_plugin_tests/conf/debug_diag_job_plugin_test_slave.json.in)17
-rw-r--r--test/second_address_tests/conf/second_address_test_master_service_udp.json.in40
-rw-r--r--test/second_address_tests/conf/second_address_test_slave_client.json.in32
-rw-r--r--test/second_address_tests/conf/second_address_test_slave_service_udp.json.in40
-rwxr-xr-xtest/second_address_tests/conf/second_address_test_slave_starter.sh.in60
-rw-r--r--test/second_address_tests/second_address_test_client.cpp353
-rw-r--r--test/second_address_tests/second_address_test_globals.hpp29
-rwxr-xr-xtest/second_address_tests/second_address_test_master_starter.sh77
-rw-r--r--test/second_address_tests/second_address_test_service.cpp252
-rw-r--r--test/security_config_plugin_tests/conf/security_config_plugin_test_local.json.in128
-rwxr-xr-xtest/security_config_plugin_tests/security_config_plugin_test_client.cpp1045
-rwxr-xr-xtest/security_config_plugin_tests/security_config_plugin_test_globals.hpp37
-rwxr-xr-xtest/security_config_plugin_tests/security_config_plugin_test_local_starter.sh65
-rw-r--r--test/security_config_plugin_tests/security_config_plugin_test_service.cpp222
-rw-r--r--test/security_tests/conf/security_test_config_client_external_allow.json.in4
-rw-r--r--test/security_tests/conf/security_test_config_client_external_deny.json.in4
-rw-r--r--test/security_tests/conf/security_test_config_service_external_allow.json.in4
-rw-r--r--test/security_tests/conf/security_test_config_service_external_deny.json.in4
-rw-r--r--test/security_tests/conf/security_test_local_config.json.in4
-rw-r--r--test/security_tests/security_test_client.cpp16
-rwxr-xr-xtest/security_tests/security_test_external_master_start.sh6
-rwxr-xr-xtest/security_tests/security_test_external_slave_start.sh4
-rwxr-xr-xtest/security_tests/security_test_local_start.sh4
-rw-r--r--test/security_tests/security_test_service.cpp10
-rw-r--r--test/someip_test_globals.hpp3
-rw-r--r--test/someip_tp_tests/conf/someip_tp_test_master.json.in45
-rwxr-xr-xtest/someip_tp_tests/conf/someip_tp_test_master_starter.sh.in65
-rw-r--r--test/someip_tp_tests/someip_tp_test_globals.hpp40
-rw-r--r--test/someip_tp_tests/someip_tp_test_master.json45
-rwxr-xr-xtest/someip_tp_tests/someip_tp_test_master_starter.sh65
-rw-r--r--test/someip_tp_tests/someip_tp_test_msg_sender.cpp1387
-rw-r--r--test/someip_tp_tests/someip_tp_test_service.cpp412
-rwxr-xr-xtest/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh54
-rw-r--r--test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp97
-rwxr-xr-xtest/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh34
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in33
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json.in61
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json.in (renamed from test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in)21
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp.json.in (renamed from test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in)21
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in33
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json.in61
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in33
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json.in61
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in33
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json.in61
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in2
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in2
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in2
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json61
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json61
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp.json61
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json61
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json61
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json61
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_master_starter.sh54
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp27
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh11
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp27
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh2
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_service.cpp83
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh37
214 files changed, 9536 insertions, 5447 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f8f1d5d..b3cd6a9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -67,18 +67,21 @@ endfunction()
##############################################################################
# configuration-test
##############################################################################
-if(NOT ${TESTS_BAT})
+if(NOT ${TESTS_BAT})
set(TEST_CONFIGURATION configuration-test)
- add_executable(${TEST_CONFIGURATION} configuration_tests/configuration-test.cpp)
+ add_executable(${TEST_CONFIGURATION}
+ configuration_tests/configuration-test.cpp
+ ${PROJECT_SOURCE_DIR}/implementation/plugin/src/plugin_manager_impl.cpp
+ )
target_link_libraries(${TEST_CONFIGURATION}
- vsomeip
- vsomeip-cfg
+ vsomeip3
+ vsomeip3-cfg
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
)
-
+
# The following will make sure that ${TEST_CONFIGURATION_CONFIG_FILE} is copied
# from the config folder into the test folder in the builddirectory
# This makes it possible to call the configuration test within the build directory
@@ -101,7 +104,7 @@ if(NOT ${TESTS_BAT})
add_executable(${TEST_APPLICATION} application_tests/${TEST_APPLICATION}.cpp)
target_link_libraries(${TEST_APPLICATION}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -110,7 +113,7 @@ if(NOT ${TESTS_BAT})
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}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -119,7 +122,7 @@ if(NOT ${TESTS_BAT})
set(TEST_APPLICATION_AVAILABILITY_NAME ${TEST_APPLICATION}_availability)
add_executable(${TEST_APPLICATION_AVAILABILITY_NAME} application_tests/${TEST_APPLICATION_AVAILABILITY_NAME}.cpp)
target_link_libraries(${TEST_APPLICATION_AVAILABILITY_NAME}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -176,7 +179,7 @@ if(NOT ${TESTS_BAT})
${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER}
${TEST_APPLICATION}
)
-
+
set(TEST_APPLICATION_SINGLE_PROCESS_STARTER ${TEST_APPLICATION}_single_process_starter.sh)
copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_SINGLE_PROCESS_STARTER}
${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_STARTER}
@@ -198,7 +201,7 @@ if(NOT ${TESTS_BAT})
set(TEST_MAGIC_COOKIES_CLIENT ${TEST_MAGIC_COOKIES_NAME}_client)
add_executable(${TEST_MAGIC_COOKIES_CLIENT} magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT}.cpp)
target_link_libraries(${TEST_MAGIC_COOKIES_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
@@ -208,7 +211,7 @@ if(NOT ${TESTS_BAT})
set(TEST_MAGIC_COOKIES_SERVICE ${TEST_MAGIC_COOKIES_NAME}_service)
add_executable(${TEST_MAGIC_COOKIES_SERVICE} magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE}.cpp)
target_link_libraries(${TEST_MAGIC_COOKIES_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
@@ -268,7 +271,7 @@ if(NOT ${TESTS_BAT})
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
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
@@ -281,7 +284,7 @@ if(NOT ${TESTS_BAT})
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
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
@@ -305,7 +308,7 @@ if(NOT ${TESTS_BAT})
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
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
@@ -343,7 +346,7 @@ if(NOT ${TESTS_BAT})
set(TEST_LOCAL_ROUTING_SERVICE local_routing_test_service)
add_executable(${TEST_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_LOCAL_ROUTING_SERVICE}.cpp)
target_link_libraries(${TEST_LOCAL_ROUTING_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -366,7 +369,7 @@ if(NOT ${TESTS_BAT})
set(TEST_LOCAL_ROUTING_CLIENT local_routing_test_client)
add_executable(${TEST_LOCAL_ROUTING_CLIENT} routing_tests/${TEST_LOCAL_ROUTING_CLIENT}.cpp)
target_link_libraries(${TEST_LOCAL_ROUTING_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -402,7 +405,7 @@ if(NOT ${TESTS_BAT})
set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE external_local_routing_test_service)
add_executable(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.cpp)
target_link_libraries(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -460,7 +463,7 @@ else()
set(TEST_LOCAL_ROUTING_SERVICE local_routing_test_service)
add_executable(${TEST_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_LOCAL_ROUTING_SERVICE}.cpp)
target_link_libraries(${TEST_LOCAL_ROUTING_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -483,7 +486,7 @@ else()
set(TEST_LOCAL_ROUTING_CLIENT local_routing_test_client)
add_executable(${TEST_LOCAL_ROUTING_CLIENT} routing_tests/${TEST_LOCAL_ROUTING_CLIENT}.cpp)
target_link_libraries(${TEST_LOCAL_ROUTING_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -524,7 +527,7 @@ if(NOT ${TESTS_BAT})
set(TEST_RESTART_ROUTING_SERVICE restart_routing_test_service)
add_executable(${TEST_RESTART_ROUTING_SERVICE} restart_routing_tests/${TEST_RESTART_ROUTING_SERVICE}.cpp)
target_link_libraries(${TEST_RESTART_ROUTING_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -551,7 +554,7 @@ if(NOT ${TESTS_BAT})
restart_routing_tests/${TEST_RESTART_ROUTING_CLIENT}.cpp
)
target_link_libraries(${TEST_RESTART_ROUTING_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -601,7 +604,7 @@ if (${TEST_SECURITY})
add_executable(${TEST_SECURITY_SERVICE} security_tests/${TEST_SECURITY_SERVICE}.cpp)
target_link_libraries(${TEST_SECURITY_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -695,7 +698,7 @@ if (${TEST_SECURITY})
security_tests/${TEST_SECURITY_CLIENT}.cpp
)
target_link_libraries(${TEST_SECURITY_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -713,7 +716,7 @@ if(NOT ${TESTS_BAT})
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
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -741,7 +744,7 @@ if(NOT ${TESTS_BAT})
payload_tests/stopwatch.cpp
)
target_link_libraries(${TEST_PAYLOAD_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -892,7 +895,7 @@ if(NOT ${TESTS_BAT})
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
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -901,7 +904,7 @@ if(NOT ${TESTS_BAT})
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
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1058,6 +1061,27 @@ if(NOT ${TESTS_BAT})
${PROJECT_BINARY_DIR}/test/${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(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${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(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE}
+ ${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)
@@ -1091,6 +1115,7 @@ if(NOT ${TESTS_BAT})
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)
set(TEST_EXTERNAL_BIG_PAYLOAD_STARTER ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_starter.sh)
copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER}
${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER}
@@ -1121,7 +1146,7 @@ if(NOT ${TESTS_BAT})
set(TEST_CLIENT_ID_SERVICE ${TEST_CLIENT_ID_NAME}_service)
add_executable(${TEST_CLIENT_ID_SERVICE} client_id_tests/${TEST_CLIENT_ID_NAME}_service.cpp)
target_link_libraries(${TEST_CLIENT_ID_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1132,8 +1157,8 @@ if(NOT ${TESTS_BAT})
client_id_tests/${TEST_CLIENT_ID_UTILITY}.cpp
${PROJECT_SOURCE_DIR}/implementation/utility/src/utility.cpp)
target_link_libraries(${TEST_CLIENT_ID_UTILITY}
- vsomeip
- vsomeip-cfg
+ vsomeip3
+ vsomeip3-cfg
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1315,7 +1340,7 @@ if(NOT ${TESTS_BAT})
set(TEST_SUBSCRIBE_NOTIFY_SERVICE ${TEST_SUBSCRIBE_NOTIFY_NAME}_service)
add_executable(${TEST_SUBSCRIBE_NOTIFY_SERVICE} subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_NAME}_service.cpp)
target_link_libraries(${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1370,6 +1395,30 @@ if(NOT ${TESTS_BAT})
${TEST_SUBSCRIBE_NOTIFY_SERVICE}
)
+ set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE
+ ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}
+ ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
+ )
+
+ set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE
+ ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}
+ ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
+ )
+
set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE
${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master.json)
configure_file(
@@ -1418,6 +1467,30 @@ if(NOT ${TESTS_BAT})
${TEST_SUBSCRIBE_NOTIFY_SERVICE}
)
+ set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE
+ ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}
+ ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
+ )
+
+ set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE
+ ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}
+ ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
+ )
+
set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE
${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_master.json)
configure_file(
@@ -1490,27 +1563,27 @@ if(NOT ${TESTS_BAT})
${TEST_SUBSCRIBE_NOTIFY_SERVICE}
)
- set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_master.json)
+ set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE
+ ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_master_udp.json)
configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE}
@ONLY)
copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE}
${TEST_SUBSCRIBE_NOTIFY_SERVICE}
)
- set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_slave.json)
+ set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE
+ ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_slave_udp.json)
configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE}
@ONLY)
copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
+ ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE}
${TEST_SUBSCRIBE_NOTIFY_SERVICE}
)
@@ -1552,13 +1625,13 @@ if(NOT ${TESTS_BAT})
# subscribe_notify_test_one_event_two_eventgroups
set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME subscribe_notify_test_one_event_two_eventgroups)
-
+
# service
set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_service)
add_executable(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}
subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}.cpp)
target_link_libraries(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1568,7 +1641,7 @@ if(NOT ${TESTS_BAT})
add_executable(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}
subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}.cpp)
target_link_libraries(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1631,12 +1704,12 @@ if(NOT ${TESTS_BAT})
set(TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_service)
add_executable(${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_service.cpp)
target_link_libraries(${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
)
-
+
# Copy config files for test into $BUILDDIR/test
set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_master.json)
@@ -1736,7 +1809,7 @@ if(NOT ${TESTS_BAT})
cpu_load_tests/cpu_load_measurer.cpp
)
target_link_libraries(${TEST_CPU_LOAD_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1771,7 +1844,7 @@ if(NOT ${TESTS_BAT})
cpu_load_tests/cpu_load_measurer.cpp
)
target_link_libraries(${TEST_CPU_LOAD_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1820,16 +1893,16 @@ if(NOT ${TESTS_BAT})
set(TEST_INITIAL_EVENT_SERVICE ${TEST_INITIAL_EVENT_NAME}_service)
add_executable(${TEST_INITIAL_EVENT_SERVICE} initial_event_tests/${TEST_INITIAL_EVENT_NAME}_service.cpp)
target_link_libraries(${TEST_INITIAL_EVENT_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
)
-
+
set(TEST_INITIAL_EVENT_CLIENT ${TEST_INITIAL_EVENT_NAME}_client)
add_executable(${TEST_INITIAL_EVENT_CLIENT} initial_event_tests/${TEST_INITIAL_EVENT_NAME}_client.cpp)
target_link_libraries(${TEST_INITIAL_EVENT_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1838,7 +1911,7 @@ if(NOT ${TESTS_BAT})
set(TEST_INITIAL_EVENT_AVAILABILITY_CHECKER ${TEST_INITIAL_EVENT_NAME}_availability_checker)
add_executable(${TEST_INITIAL_EVENT_AVAILABILITY_CHECKER} initial_event_tests/${TEST_INITIAL_EVENT_NAME}_availability_checker.cpp)
target_link_libraries(${TEST_INITIAL_EVENT_AVAILABILITY_CHECKER}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1847,7 +1920,7 @@ if(NOT ${TESTS_BAT})
set(TEST_INITIAL_EVENT_STOP_SERVICE ${TEST_INITIAL_EVENT_NAME}_stop_service)
add_executable(${TEST_INITIAL_EVENT_STOP_SERVICE} initial_event_tests/${TEST_INITIAL_EVENT_NAME}_stop_service.cpp)
target_link_libraries(${TEST_INITIAL_EVENT_STOP_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -1891,6 +1964,19 @@ if(NOT ${TESTS_BAT})
${TEST_INITIAL_EVENT_SERVICE}
)
+ # Copy config files for test into $BUILDDIR/test
+ set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE
+ ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_master_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}
+ ${TEST_INITIAL_EVENT_SERVICE}
+ )
+
set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE
${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_slave_tcp.json)
configure_file(
@@ -1903,6 +1989,18 @@ if(NOT ${TESTS_BAT})
${TEST_INITIAL_EVENT_SERVICE}
)
+ set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE
+ ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_slave_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}
+ ${TEST_INITIAL_EVENT_SERVICE}
+ )
+
set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE
${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_master.json)
configure_file(
@@ -1951,6 +2049,30 @@ if(NOT ${TESTS_BAT})
${TEST_INITIAL_EVENT_SERVICE}
)
+ set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE
+ ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_master_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}
+ ${TEST_INITIAL_EVENT_SERVICE}
+ )
+
+ set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE
+ ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_slave_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}
+ ${TEST_INITIAL_EVENT_SERVICE}
+ )
+
set(TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE
${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_master.json)
configure_file(
@@ -2068,7 +2190,7 @@ if(NOT ${TESTS_BAT})
set(TEST_OFFER_SERVICE ${TEST_OFFER_NAME}_service)
add_executable(${TEST_OFFER_SERVICE} offer_tests/${TEST_OFFER_NAME}_service.cpp)
target_link_libraries(${TEST_OFFER_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2077,7 +2199,7 @@ if(NOT ${TESTS_BAT})
set(TEST_OFFER_CLIENT ${TEST_OFFER_NAME}_client)
add_executable(${TEST_OFFER_CLIENT} offer_tests/${TEST_OFFER_NAME}_client.cpp)
target_link_libraries(${TEST_OFFER_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2086,7 +2208,7 @@ if(NOT ${TESTS_BAT})
set(TEST_OFFER_SERVICE_EXTERNAL ${TEST_OFFER_NAME}_service_external)
add_executable(${TEST_OFFER_SERVICE_EXTERNAL} offer_tests/${TEST_OFFER_NAME}_service_external.cpp)
target_link_libraries(${TEST_OFFER_SERVICE_EXTERNAL}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2105,7 +2227,7 @@ if(NOT ${TESTS_BAT})
set(TEST_OFFER_BIG_SERVICE ${TEST_OFFER_BIG_NAME}_service)
add_executable(${TEST_OFFER_BIG_SERVICE} offer_tests/${TEST_OFFER_BIG_NAME}_service.cpp)
target_link_libraries(${TEST_OFFER_BIG_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2114,7 +2236,7 @@ if(NOT ${TESTS_BAT})
set(TEST_OFFER_BIG_CLIENT ${TEST_OFFER_BIG_NAME}_client)
add_executable(${TEST_OFFER_BIG_CLIENT} offer_tests/${TEST_OFFER_BIG_NAME}_client.cpp)
target_link_libraries(${TEST_OFFER_BIG_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2223,7 +2345,7 @@ if(NOT ${TESTS_BAT})
set(TEST_OFFERED_SERVICES_INFO_SERVICE ${TEST_OFFERED_SERVICES_INFO_NAME}_service)
add_executable(${TEST_OFFERED_SERVICES_INFO_SERVICE} offered_services_info_test/${TEST_OFFERED_SERVICES_INFO_NAME}_service.cpp)
target_link_libraries(${TEST_OFFERED_SERVICES_INFO_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2232,7 +2354,7 @@ if(NOT ${TESTS_BAT})
set(TEST_OFFERED_SERVICES_INFO_CLIENT ${TEST_OFFERED_SERVICES_INFO_NAME}_client)
add_executable(${TEST_OFFERED_SERVICES_INFO_CLIENT} offered_services_info_test/${TEST_OFFERED_SERVICES_INFO_NAME}_client.cpp)
target_link_libraries(${TEST_OFFERED_SERVICES_INFO_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2262,7 +2384,7 @@ if(NOT ${TESTS_BAT})
set(TEST_PENDING_SUBSCRIPTION_SERVICE ${TEST_PENDING_SUBSCRIPTION_NAME}_service)
add_executable(${TEST_PENDING_SUBSCRIPTION_SERVICE} pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_NAME}_service.cpp)
target_link_libraries(${TEST_PENDING_SUBSCRIPTION_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2286,8 +2408,8 @@ if(NOT ${TESTS_BAT})
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
- vsomeip
- vsomeip-sd
+ vsomeip3
+ vsomeip3-sd
)
# copy starter scripts into builddir
@@ -2322,7 +2444,7 @@ if(NOT ${TESTS_BAT})
set(TEST_MALICIOUS_DATA_SERVICE ${TEST_MALICIOUS_DATA_NAME}_service)
add_executable(${TEST_MALICIOUS_DATA_SERVICE} malicious_data_tests/${TEST_MALICIOUS_DATA_NAME}_service.cpp)
target_link_libraries(${TEST_MALICIOUS_DATA_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2346,8 +2468,8 @@ if(NOT ${TESTS_BAT})
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
- vsomeip
- vsomeip-sd
+ vsomeip3
+ vsomeip3-sd
)
# copy starter scripts into builddir
@@ -2375,132 +2497,6 @@ if(NOT ${TESTS_BAT})
endif()
##############################################################################
-# security_config_plugin_test
-##############################################################################
-if (${TEST_SECURITY})
- if(NOT ${TESTS_BAT})
- set(TEST_SECURITY_CONFIG_PLUGIN_NAME security_config_plugin_test)
- set(TEST_SECURITY_CONFIG_PLUGIN_CLIENT ${TEST_SECURITY_CONFIG_PLUGIN_NAME}_client)
- add_executable(${TEST_SECURITY_CONFIG_PLUGIN_CLIENT}
- security_config_plugin_tests/${TEST_SECURITY_CONFIG_PLUGIN_CLIENT}.cpp
- )
-
- set(TEST_SECURITY_CONFIG_PLUGIN_SERVICE ${TEST_SECURITY_CONFIG_PLUGIN_NAME}_service)
- add_executable(${TEST_SECURITY_CONFIG_PLUGIN_SERVICE}
- security_config_plugin_tests/${TEST_SECURITY_CONFIG_PLUGIN_SERVICE}.cpp
- )
-
- message(STATUS "Using uid: ${TEST_UID}, gid: ${TEST_GID}")
-
- # Copy config file for vsomeipd, client and service into $BUILDDIR/test
- set(TEST_SECURITY_CONFIG_PLUGIN_LOCAL_CONFIG_FILE ${TEST_SECURITY_CONFIG_PLUGIN_NAME}_local.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/security_config_plugin_tests/conf/${TEST_SECURITY_CONFIG_PLUGIN_LOCAL_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/security_config_plugin_tests/${TEST_SECURITY_CONFIG_PLUGIN_LOCAL_CONFIG_FILE}
- @ONLY)
-
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/security_config_plugin_tests/${TEST_SECURITY_CONFIG_PLUGIN_LOCAL_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_CONFIG_PLUGIN_LOCAL_CONFIG_FILE}
- ${TEST_SECURITY_CONFIG_PLUGIN_CLIENT}
- ${TEST_SECURITY_CONFIG_PLUGIN_SERVICE}
- )
-
-
- # Copy bashscript to start vsomeipd and client into $BUILDDIR/test
- set(TEST_SECURITY_CONFIG_PLUGIN_LOCAL_STARTER ${TEST_SECURITY_CONFIG_PLUGIN_NAME}_local_starter.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/security_config_plugin_tests/${TEST_SECURITY_CONFIG_PLUGIN_LOCAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_CONFIG_PLUGIN_LOCAL_STARTER}
- ${TEST_SECURITY_CONFIG_PLUGIN_CLIENT}
- ${TEST_SECURITY_CONFIG_PLUGIN_SERVICE}
- )
-
- target_link_libraries(${TEST_SECURITY_CONFIG_PLUGIN_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- target_link_libraries(${TEST_SECURITY_CONFIG_PLUGIN_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
- endif()
-endif()
-
-#############################################################################
-# debug_diag_job_plugin_test
-##############################################################################
-
-if(NOT ${TESTS_BAT})
- set(TEST_DEBUG_DIAG_JOB_NAME debug_diag_job_plugin_test)
-
- set(TEST_DEBUG_DIAG_JOB_SERVICE ${TEST_DEBUG_DIAG_JOB_NAME}_service)
- add_executable(${TEST_DEBUG_DIAG_JOB_SERVICE} debug_diag_job_plugin_tests/${TEST_DEBUG_DIAG_JOB_SERVICE}.cpp)
- target_link_libraries(${TEST_DEBUG_DIAG_JOB_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_DEBUG_DIAG_JOB_MASTER_CONFIG_FILE ${TEST_DEBUG_DIAG_JOB_NAME}_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/debug_diag_job_plugin_tests/conf/${TEST_DEBUG_DIAG_JOB_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/debug_diag_job_plugin_tests/${TEST_DEBUG_DIAG_JOB_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/debug_diag_job_plugin_tests/${TEST_DEBUG_DIAG_JOB_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_DEBUG_DIAG_JOB_MASTER_CONFIG_FILE}
- ${TEST_DEBUG_DIAG_JOB_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_DEBUG_DIAG_JOB_MASTER_STARTER ${TEST_DEBUG_DIAG_JOB_NAME}_master_starter.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/debug_diag_job_plugin_tests/${TEST_DEBUG_DIAG_JOB_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_DEBUG_DIAG_JOB_MASTER_STARTER}
- ${TEST_DEBUG_DIAG_JOB_SERVICE}
- )
-
- set(TEST_DEBUG_DIAG_JOB_CLIENT ${TEST_DEBUG_DIAG_JOB_NAME}_client)
- add_executable(${TEST_DEBUG_DIAG_JOB_CLIENT}
- debug_diag_job_plugin_tests/${TEST_DEBUG_DIAG_JOB_CLIENT}.cpp
- )
- target_link_libraries(${TEST_DEBUG_DIAG_JOB_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_DEBUG_DIAG_JOB_SLAVE_CONFIG_FILE ${TEST_DEBUG_DIAG_JOB_NAME}_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/debug_diag_job_plugin_tests/conf/${TEST_DEBUG_DIAG_JOB_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/debug_diag_job_plugin_tests/${TEST_DEBUG_DIAG_JOB_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/debug_diag_job_plugin_tests/${TEST_DEBUG_DIAG_JOB_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_DEBUG_DIAG_JOB_SLAVE_CONFIG_FILE}
- ${TEST_DEBUG_DIAG_JOB_CLIENT}
- )
-
- # Copy bashscript to start client into $BUILDDIR/test
- set(TEST_DEBUG_DIAG_JOB_SLAVE_STARTER ${TEST_DEBUG_DIAG_JOB_NAME}_slave_starter.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/debug_diag_job_plugin_tests/${TEST_DEBUG_DIAG_JOB_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_DEBUG_DIAG_JOB_SLAVE_STARTER}
- ${TEST_DEBUG_DIAG_JOB_CLIENT}
- )
-endif()
-
-##############################################################################
# e2e test
##############################################################################
@@ -2511,7 +2507,7 @@ if(NOT ${TESTS_BAT})
add_executable(${TEST_E2E_SERVICE} e2e_tests/${TEST_E2E_SERVICE}.cpp)
target_link_libraries(${TEST_E2E_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2521,7 +2517,7 @@ if(NOT ${TESTS_BAT})
e2e_tests/${TEST_E2E_CLIENT}.cpp
)
target_link_libraries(${TEST_E2E_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2579,7 +2575,7 @@ if(NOT ${TESTS_BAT})
add_executable(${TEST_EVENT_SERVICE} event_tests/${TEST_EVENT_SERVICE}.cpp)
target_link_libraries(${TEST_EVENT_SERVICE}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2589,7 +2585,7 @@ if(NOT ${TESTS_BAT})
event_tests/${TEST_EVENT_CLIENT}.cpp
)
target_link_libraries(${TEST_EVENT_CLIENT}
- vsomeip
+ vsomeip3
${Boost_LIBRARIES}
${DL_LIBRARY}
${TEST_LINK_LIBRARIES}
@@ -2646,6 +2642,367 @@ if(NOT ${TESTS_BAT})
endif()
+##############################################################################
+# npdu-test
+##############################################################################
+if(NOT ${TESTS_BAT})
+ set(TEST_NPDU_NAME npdu_test)
+
+ set(TEST_NPDU_DAEMON npdu_test_rmd)
+ set(TEST_NPDU_DAEMON_CLIENT ${TEST_NPDU_DAEMON}_client_side)
+ add_executable(${TEST_NPDU_DAEMON_CLIENT} npdu_tests/${TEST_NPDU_DAEMON}.cpp)
+ set_target_properties(${TEST_NPDU_DAEMON_CLIENT} PROPERTIES COMPILE_FLAGS -DRMD_CLIENT_SIDE)
+ target_link_libraries(${TEST_NPDU_DAEMON_CLIENT}
+ vsomeip3
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_NPDU_DAEMON_SERVICE ${TEST_NPDU_DAEMON}_service_side)
+ add_executable(${TEST_NPDU_DAEMON_SERVICE} npdu_tests/${TEST_NPDU_DAEMON}.cpp)
+ set_target_properties(${TEST_NPDU_DAEMON_SERVICE} PROPERTIES COMPILE_FLAGS -DRMD_SERVICE_SIDE)
+ target_link_libraries(${TEST_NPDU_DAEMON_SERVICE}
+ vsomeip3
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ ##############################################################################
+
+ set(TEST_NPDU_SERVICE npdu_test_service)
+
+ set(TEST_NPDU_SERVICE_ONE npdu_test_service_1)
+ add_executable(${TEST_NPDU_SERVICE_ONE} npdu_tests/${TEST_NPDU_SERVICE}.cpp)
+ set_target_properties(${TEST_NPDU_SERVICE_ONE} PROPERTIES COMPILE_FLAGS -DSERVICE_NUMBER=0)
+ target_link_libraries(${TEST_NPDU_SERVICE_ONE}
+ vsomeip3
+ vsomeip3-cfg
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_NPDU_SERVICE_TWO npdu_test_service_2)
+ add_executable(${TEST_NPDU_SERVICE_TWO} npdu_tests/${TEST_NPDU_SERVICE}.cpp)
+ set_target_properties(${TEST_NPDU_SERVICE_TWO} PROPERTIES COMPILE_FLAGS -DSERVICE_NUMBER=1)
+ target_link_libraries(${TEST_NPDU_SERVICE_TWO}
+ vsomeip3
+ vsomeip3-cfg
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_NPDU_SERVICE_THREE npdu_test_service_3)
+ add_executable(${TEST_NPDU_SERVICE_THREE} npdu_tests/${TEST_NPDU_SERVICE}.cpp)
+ set_target_properties(${TEST_NPDU_SERVICE_THREE} PROPERTIES COMPILE_FLAGS -DSERVICE_NUMBER=2)
+ target_link_libraries(${TEST_NPDU_SERVICE_THREE}
+ vsomeip3
+ vsomeip3-cfg
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_NPDU_SERVICE_FOUR npdu_test_service_4)
+ add_executable(${TEST_NPDU_SERVICE_FOUR} npdu_tests/${TEST_NPDU_SERVICE}.cpp)
+ set_target_properties(${TEST_NPDU_SERVICE_FOUR} PROPERTIES COMPILE_FLAGS -DSERVICE_NUMBER=3)
+ target_link_libraries(${TEST_NPDU_SERVICE_FOUR}
+ vsomeip3
+ vsomeip3-cfg
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ # Copy config file for service w/o npdu into $BUILDDIR/test
+ set(TEST_NPDU_SERVICE_CONFIG_FILE ${TEST_NPDU_SERVICE}_no_npdu.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/conf/${TEST_NPDU_SERVICE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_SERVICE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_SERVICE_CONFIG_FILE}
+ ${TEST_NPDU_SERVICE_ONE}
+ )
+
+ # Copy bashscript to start service w/o npdu into $BUILDDIR/test
+ set(TEST_NPDU_SERVICE_START_SCRIPT ${TEST_NPDU_SERVICE}_no_npdu_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_SERVICE_START_SCRIPT}
+ ${TEST_NPDU_SERVICE_ONE}
+ )
+
+ # Copy config file for service with npdu into $BUILDDIR/test
+ set(TEST_NPDU_SERVICE_CONFIG_FILE ${TEST_NPDU_SERVICE}_npdu.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/conf/${TEST_NPDU_SERVICE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_SERVICE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_SERVICE_CONFIG_FILE}
+ ${TEST_NPDU_SERVICE_ONE}
+ )
+
+ # Copy bashscript to start service with npdu into $BUILDDIR/test
+ set(TEST_NPDU_SERVICE_START_SCRIPT ${TEST_NPDU_SERVICE}_npdu_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_SERVICE_START_SCRIPT}
+ ${TEST_NPDU_SERVICE_ONE}
+ )
+
+ ##############################################################################
+
+ set(TEST_NPDU_CLIENT npdu_test_client)
+
+ set(TEST_NPDU_CLIENT_ONE npdu_test_client_1)
+ add_executable(${TEST_NPDU_CLIENT_ONE} npdu_tests/${TEST_NPDU_CLIENT}.cpp)
+ target_link_libraries(${TEST_NPDU_CLIENT_ONE}
+ vsomeip3
+ vsomeip3-cfg
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_NPDU_CLIENT_TWO npdu_test_client_2)
+ add_executable(${TEST_NPDU_CLIENT_TWO} npdu_tests/${TEST_NPDU_CLIENT}.cpp)
+ target_link_libraries(${TEST_NPDU_CLIENT_TWO}
+ vsomeip3
+ vsomeip3-cfg
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_NPDU_CLIENT_THREE npdu_test_client_3)
+ add_executable(${TEST_NPDU_CLIENT_THREE} npdu_tests/${TEST_NPDU_CLIENT}.cpp)
+ target_link_libraries(${TEST_NPDU_CLIENT_THREE}
+ vsomeip3
+ vsomeip3-cfg
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_NPDU_CLIENT_FOUR npdu_test_client_4)
+ add_executable(${TEST_NPDU_CLIENT_FOUR} npdu_tests/${TEST_NPDU_CLIENT}.cpp)
+ target_link_libraries(${TEST_NPDU_CLIENT_FOUR}
+ vsomeip3
+ vsomeip3-cfg
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ # Copy config files for client w/o npdu into $BUILDDIR/test
+ set(TEST_NPDU_CLIENT_CONFIG_FILE ${TEST_NPDU_CLIENT}_no_npdu.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/conf/${TEST_NPDU_CLIENT_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_CLIENT_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_CLIENT_CONFIG_FILE}
+ ${TEST_NPDU_CLIENT_ONE}
+ )
+
+ # Copy bashscript to start client w/o npdu into $BUILDDIR/test
+ set(TEST_NPDU_CLIENT_START_SCRIPT ${TEST_NPDU_CLIENT}_no_npdu_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_CLIENT_START_SCRIPT}
+ ${TEST_NPDU_CLIENT_ONE}
+ )
+
+ # Copy config file for client with npdu into $BUILDDIR/test
+ set(TEST_NPDU_CLIENT_CONFIG_FILE ${TEST_NPDU_CLIENT}_npdu.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/conf/${TEST_NPDU_CLIENT_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_CLIENT_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_CLIENT_CONFIG_FILE}
+ ${TEST_NPDU_CLIENT_ONE}
+ )
+
+ # Copy bashscript to start client with npdu into $BUILDDIR/test
+ set(TEST_NPDU_CLIENT_START_SCRIPT ${TEST_NPDU_CLIENT}_npdu_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_CLIENT_START_SCRIPT}
+ ${TEST_NPDU_CLIENT_ONE}
+ )
+
+ ##############################################################################
+
+ set(TEST_NPDU_STARTER ${TEST_NPDU_NAME}_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/npdu_tests/${TEST_NPDU_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_STARTER}
+ ${TEST_NPDU_DAEMON_CLIENT}
+ )
+endif()
+
+##############################################################################
+# someip tp tests
+##############################################################################
+
+if(NOT ${TESTS_BAT})
+ set(TEST_SOMEIPTP_NAME someip_tp_test)
+ set(TEST_SOMEIPTP_SERVICE ${TEST_SOMEIPTP_NAME}_service)
+
+ add_executable(${TEST_SOMEIPTP_SERVICE} someip_tp_tests/${TEST_SOMEIPTP_SERVICE}.cpp)
+ target_link_libraries(${TEST_SOMEIPTP_SERVICE}
+ vsomeip3
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ file(GLOB sd_sources
+ "../implementation/service_discovery/src/*entry*.cpp"
+ "../implementation/service_discovery/src/*option*.cpp"
+ "../implementation/service_discovery/src/*message*.cpp"
+ )
+ set(TEST_SOMEIPTP_CLIENT ${TEST_SOMEIPTP_NAME}_msg_sender)
+ add_executable(${TEST_SOMEIPTP_CLIENT}
+ someip_tp_tests/${TEST_SOMEIPTP_CLIENT}.cpp
+ ${PROJECT_SOURCE_DIR}/implementation/message/src/deserializer.cpp
+ ${PROJECT_SOURCE_DIR}/implementation/message/src/message_impl.cpp
+ ${PROJECT_SOURCE_DIR}/implementation/message/src/payload_impl.cpp
+ ${PROJECT_SOURCE_DIR}/implementation/endpoints/src/tp.cpp
+ ${PROJECT_SOURCE_DIR}/implementation/endpoints/src/tp_reassembler.cpp
+ ${PROJECT_SOURCE_DIR}/implementation/endpoints/src/tp_message.cpp
+ ${sd_sources}
+ )
+
+ target_link_libraries(${TEST_SOMEIPTP_CLIENT}
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ vsomeip3
+ vsomeip3-sd
+ )
+
+ # Copy service config file for external allow tests into $BUILDDIR/test
+ set(TEST_SOMEIPTP_MASTER_CONFIG_FILE ${TEST_SOMEIPTP_NAME}_master.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/someip_tp_tests/conf/${TEST_SOMEIPTP_MASTER_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/someip_tp_tests/${TEST_SOMEIPTP_MASTER_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/someip_tp_tests/${TEST_SOMEIPTP_MASTER_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SOMEIPTP_MASTER_CONFIG_FILE}
+ ${TEST_SOMEIPTP_CLIENT}
+ )
+
+ # Copy bashscript to start test (master) into $BUILDDIR/test
+ set(TEST_SOMEIPTP_MASTER_START_SCRIPT ${TEST_SOMEIPTP_NAME}_master_starter.sh)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/someip_tp_tests/conf/${TEST_SOMEIPTP_MASTER_START_SCRIPT}.in
+ ${PROJECT_SOURCE_DIR}/test/someip_tp_tests/${TEST_SOMEIPTP_MASTER_START_SCRIPT}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/someip_tp_tests/${TEST_SOMEIPTP_MASTER_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SOMEIPTP_MASTER_START_SCRIPT}
+ ${TEST_SOMEIPTP_SERVICE}
+ )
+endif()
+
+##############################################################################
+# second IP address tests
+##############################################################################
+
+if(NOT ${TESTS_BAT} AND ${TEST_SECOND_ADDRESS})
+ set(TEST_SECOND_ADDRESS_NAME second_address_test)
+ set(TEST_SECOND_ADDRESS_SERVICE ${TEST_SECOND_ADDRESS_NAME}_service)
+ set(TEST_SECOND_ADDRESS_CLIENT ${TEST_SECOND_ADDRESS_NAME}_client)
+
+ add_executable(${TEST_SECOND_ADDRESS_SERVICE}
+ second_address_tests/${TEST_SECOND_ADDRESS_SERVICE}.cpp
+ )
+ target_link_libraries(${TEST_SECOND_ADDRESS_SERVICE}
+ vsomeip3
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ add_executable(${TEST_SECOND_ADDRESS_CLIENT}
+ second_address_tests/${TEST_SECOND_ADDRESS_CLIENT}.cpp
+ )
+ target_link_libraries(${TEST_SECOND_ADDRESS_CLIENT}
+ vsomeip3
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE ${TEST_SECOND_ADDRESS_NAME}_master_service_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/conf/${TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE}
+ ${TEST_SECOND_ADDRESS_SERVICE}
+ )
+
+ set(TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE ${TEST_SECOND_ADDRESS_NAME}_slave_client.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/conf/${TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE}
+ ${TEST_SECOND_ADDRESS_CLIENT}
+ )
+
+ set(TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE ${TEST_SECOND_ADDRESS_NAME}_master_client.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/conf/${TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE}
+ ${TEST_SECOND_ADDRESS_CLIENT}
+ )
+
+ set(TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE ${TEST_SECOND_ADDRESS_NAME}_slave_service_udp.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/conf/${TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE}
+ ${TEST_SECOND_ADDRESS_SERVICE}
+ )
+
+ set(TEST_SECOND_ADDRESS_MASTER_START_SCRIPT ${TEST_SECOND_ADDRESS_NAME}_master_starter.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SECOND_ADDRESS_MASTER_START_SCRIPT}
+ ${TEST_SECOND_ADDRESS_SERVICE}
+ )
+
+ set(TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT ${TEST_SECOND_ADDRESS_NAME}_slave_starter.sh)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/conf/${TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT}.in
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT}
+ ${TEST_SECOND_ADDRESS_CLIENT}
+ )
+endif()
##############################################################################
# Add for every test a dependency to gtest
@@ -2691,15 +3048,29 @@ if(NOT ${TESTS_BAT})
add_dependencies(${TEST_MALICIOUS_DATA_SERVICE} gtest)
add_dependencies(${TEST_MALICIOUS_DATA_CLIENT} gtest)
if (${TEST_SECURITY})
- add_dependencies(${TEST_SECURITY_CONFIG_PLUGIN_CLIENT} gtest)
- add_dependencies(${TEST_SECURITY_CONFIG_PLUGIN_SERVICE} gtest)
+ add_dependencies(${TEST_SECURITY_SERVICE} gtest)
+ add_dependencies(${TEST_SECURITY_CLIENT} gtest)
endif()
- add_dependencies(${TEST_DEBUG_DIAG_JOB_SERVICE} gtest)
- add_dependencies(${TEST_DEBUG_DIAG_JOB_CLIENT} gtest)
add_dependencies(${TEST_E2E_SERVICE} gtest)
add_dependencies(${TEST_E2E_CLIENT} gtest)
add_dependencies(${TEST_EVENT_SERVICE} gtest)
add_dependencies(${TEST_EVENT_CLIENT} gtest)
+ add_dependencies(${TEST_NPDU_SERVICE_ONE} gtest)
+ add_dependencies(${TEST_NPDU_SERVICE_TWO} gtest)
+ add_dependencies(${TEST_NPDU_SERVICE_THREE} gtest)
+ add_dependencies(${TEST_NPDU_SERVICE_FOUR} gtest)
+ add_dependencies(${TEST_NPDU_CLIENT_ONE} gtest)
+ add_dependencies(${TEST_NPDU_CLIENT_TWO} gtest)
+ add_dependencies(${TEST_NPDU_CLIENT_THREE} gtest)
+ add_dependencies(${TEST_NPDU_CLIENT_FOUR} gtest)
+ add_dependencies(${TEST_NPDU_DAEMON_CLIENT} gtest)
+ add_dependencies(${TEST_NPDU_DAEMON_SERVICE} gtest)
+ add_dependencies(${TEST_SOMEIPTP_CLIENT} gtest)
+ add_dependencies(${TEST_SOMEIPTP_SERVICE} gtest)
+ if(${TEST_SECOND_ADDRESS})
+ add_dependencies(${TEST_SECOND_ADDRESS_CLIENT} gtest)
+ add_dependencies(${TEST_SECOND_ADDRESS_SERVICE} gtest)
+ endif()
else()
add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest)
add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest)
@@ -2749,8 +3120,6 @@ if(NOT ${TESTS_BAT})
if (${TEST_SECURITY})
add_dependencies(build_tests ${TEST_SECURITY_SERVICE})
add_dependencies(build_tests ${TEST_SECURITY_CLIENT})
- add_dependencies(build_tests ${TEST_SECURITY_CONFIG_PLUGIN_CLIENT})
- add_dependencies(build_tests ${TEST_SECURITY_CONFIG_PLUGIN_SERVICE})
endif()
add_dependencies(build_tests ${TEST_OFFERED_SERVICES_INFO_CLIENT})
add_dependencies(build_tests ${TEST_OFFERED_SERVICES_INFO_SERVICE})
@@ -2758,18 +3127,33 @@ if(NOT ${TESTS_BAT})
add_dependencies(build_tests ${TEST_PENDING_SUBSCRIPTION_CLIENT})
add_dependencies(build_tests ${TEST_MALICIOUS_DATA_SERVICE})
add_dependencies(build_tests ${TEST_MALICIOUS_DATA_CLIENT})
- add_dependencies(build_tests ${TEST_DEBUG_DIAG_JOB_SERVICE})
- add_dependencies(build_tests ${TEST_DEBUG_DIAG_JOB_CLIENT})
add_dependencies(build_tests ${TEST_E2E_SERVICE})
add_dependencies(build_tests ${TEST_E2E_CLIENT})
add_dependencies(build_tests ${TEST_EVENT_SERVICE})
add_dependencies(build_tests ${TEST_EVENT_CLIENT})
+ add_dependencies(build_tests ${TEST_NPDU_SERVICE_ONE})
+ add_dependencies(build_tests ${TEST_NPDU_SERVICE_TWO})
+ add_dependencies(build_tests ${TEST_NPDU_SERVICE_THREE})
+ add_dependencies(build_tests ${TEST_NPDU_SERVICE_FOUR})
+ add_dependencies(build_tests ${TEST_NPDU_CLIENT_ONE})
+ add_dependencies(build_tests ${TEST_NPDU_CLIENT_TWO})
+ add_dependencies(build_tests ${TEST_NPDU_CLIENT_THREE})
+ add_dependencies(build_tests ${TEST_NPDU_CLIENT_FOUR})
+ add_dependencies(build_tests ${TEST_NPDU_DAEMON_CLIENT})
+ add_dependencies(build_tests ${TEST_NPDU_DAEMON_SERVICE})
+ add_dependencies(build_tests ${TEST_SOMEIPTP_CLIENT})
+ add_dependencies(build_tests ${TEST_SOMEIPTP_SERVICE})
+ if(${TEST_SECOND_ADDRESS})
+ add_dependencies(build_tests ${TEST_SECOND_ADDRESS_CLIENT})
+ add_dependencies(build_tests ${TEST_SECOND_ADDRESS_SERVICE})
+ endif()
else()
add_dependencies(build_tests ${TEST_LOCAL_ROUTING_SERVICE})
add_dependencies(build_tests ${TEST_LOCAL_ROUTING_CLIENT})
endif()
-
+# some tests require the routingmanagerd
+add_dependencies(build_tests routingmanagerd)
##############################################################################
# Add tests
@@ -2888,6 +3272,11 @@ if(NOT ${TESTS_BAT})
)
set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC} PROPERTIES TIMEOUT 120)
+ add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_UDP}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} UDP
+ )
+ set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_UDP} PROPERTIES TIMEOUT 120)
+
# client id tests
add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
@@ -2938,55 +3327,39 @@ if(NOT ${TESTS_BAT})
# subscribe notify tests
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
+
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE} SAME_SERVICE_ID)
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_udp
@@ -2999,25 +3372,17 @@ if(NOT ${TESTS_BAT})
# subscribe notify one id tests
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
# cpu load tests
add_test(NAME ${TEST_CPU_LOAD_NAME}
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_MASTER_STARTER}
@@ -3026,159 +3391,111 @@ if(NOT ${TESTS_BAT})
# initial event tests
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE})
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE})
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE})
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} MULTIPLE_EVENTS)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE} MULTIPLE_EVENTS)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_partial_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_same_service_id_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID MULTIPLE_EVENTS)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID MULTIPLE_EVENTS)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_partial_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY SERVICE_OFFERED_TCP_AND_UDP)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_same_service_id_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_partial_subscription_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ONLY_ONE)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ONLY_ONE)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_partial_subscription_udp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_partial_subscription_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ONLY_ONE)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ONLY_ONE)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_partial_subscription_tcp PROPERTIES TIMEOUT 120)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_partial_subscription_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ONLY_ONE)
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ONLY_ONE)
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_partial_subscription_both_tcp_and_udp PROPERTIES TIMEOUT 120)
# offer tests
@@ -3191,12 +3508,12 @@ if(NOT ${TESTS_BAT})
add_test(NAME ${TEST_OFFER_BIG_NAME}
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_MASTER_STARTER})
set_tests_properties(${TEST_OFFER_BIG_NAME} PROPERTIES TIMEOUT 360)
-
+
# offered services info tets
add_test(NAME ${TEST_OFFERED_SERVICES_INFO_NAME}_local
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFERED_SERVICES_INFO_LOCAL_STARTER})
- set_tests_properties(${TEST_OFFERED_SERVICES_INFO_NAME}_local PROPERTIES TIMEOUT 180)
-
+ set_tests_properties(${TEST_OFFERED_SERVICES_INFO_NAME}_local PROPERTIES TIMEOUT 180)
+
# Restart-Routing tests
add_test(NAME ${TEST_RESTART_ROUTING_NAME}
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_STARTER}
@@ -3212,11 +3529,6 @@ if(NOT ${TESTS_BAT})
add_test(NAME ${TEST_SECURITY_NAME}_external_deny
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_EXTERNAL_MASTER_START_SCRIPT} security_test_config_client_external_deny.json --deny
)
-
- # security_config_plugin_test
- add_test(NAME ${TEST_SECURITY_CONFIG_PLUGIN_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_CONFIG_PLUGIN_LOCAL_STARTER})
- set_tests_properties(${TEST_SECURITY_CONFIG_PLUGIN_NAME} PROPERTIES TIMEOUT 180)
endif()
# pending subscriptions test
@@ -3273,10 +3585,14 @@ if(NOT ${TESTS_BAT})
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MALICIOUS_DATA_MASTER_STARTER} WRONG_HEADER_FIELDS_UDP)
set_tests_properties(${TEST_MALICIOUS_DATA_NAME}_wrong_header_fields_udp PROPERTIES TIMEOUT 180)
- # debug_diag_job_plugin_test
- add_test(NAME ${TEST_DEBUG_DIAG_JOB_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_DEBUG_DIAG_JOB_MASTER_STARTER})
- set_tests_properties(${TEST_DEBUG_DIAG_JOB_NAME} PROPERTIES TIMEOUT 180)
+ # npdu tests
+ add_test(NAME ${TEST_NPDU_NAME}_udp
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_STARTER} UDP sync)
+ set_tests_properties(${TEST_NPDU_NAME}_udp PROPERTIES TIMEOUT 840)
+
+ add_test(NAME ${TEST_NPDU_NAME}_tcp
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_NPDU_STARTER} TCP sync)
+ set_tests_properties(${TEST_NPDU_NAME}_tcp PROPERTIES TIMEOUT 840)
# e2e test
add_test(NAME ${TEST_E2E_NAME}_external
@@ -3299,6 +3615,43 @@ if(NOT ${TESTS_BAT})
add_test(NAME ${TEST_EVENT_NAME}_payload_dynamic_tcp
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EVENT_MASTER_START_SCRIPT} PAYLOAD_DYNAMIC TCP)
set_tests_properties(${TEST_EVENT_NAME}_payload_dynamic_tcp PROPERTIES TIMEOUT 180)
+
+ # SOME/IP-TP tests
+ add_test(NAME ${TEST_SOMEIPTP_NAME}_in_sequence
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SOMEIPTP_MASTER_START_SCRIPT} IN_SEQUENCE)
+ set_tests_properties(${TEST_SOMEIPTP_NAME}_in_sequence PROPERTIES TIMEOUT 180)
+
+ add_test(NAME ${TEST_SOMEIPTP_NAME}_mixed
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SOMEIPTP_MASTER_START_SCRIPT} MIXED)
+ set_tests_properties(${TEST_SOMEIPTP_NAME}_mixed PROPERTIES TIMEOUT 180)
+
+ add_test(NAME ${TEST_SOMEIPTP_NAME}_incomplete
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SOMEIPTP_MASTER_START_SCRIPT} INCOMPLETE)
+ set_tests_properties(${TEST_SOMEIPTP_NAME}_incomplete PROPERTIES TIMEOUT 180)
+
+ add_test(NAME ${TEST_SOMEIPTP_NAME}_duplicate
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SOMEIPTP_MASTER_START_SCRIPT} DUPLICATE)
+ set_tests_properties(${TEST_SOMEIPTP_NAME}_duplicate PROPERTIES TIMEOUT 180)
+
+ add_test(NAME ${TEST_SOMEIPTP_NAME}_overlap
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SOMEIPTP_MASTER_START_SCRIPT} OVERLAP)
+ set_tests_properties(${TEST_SOMEIPTP_NAME}_overlap PROPERTIES TIMEOUT 180)
+
+ add_test(NAME ${TEST_SOMEIPTP_NAME}_overlap_front_back
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SOMEIPTP_MASTER_START_SCRIPT} OVERLAP_FRONT_BACK)
+ set_tests_properties(${TEST_SOMEIPTP_NAME}_overlap_front_back PROPERTIES TIMEOUT 180)
+
+ if(${TEST_SECOND_ADDRESS})
+ add_test(NAME ${TEST_SECOND_ADDRESS_NAME}_second_ip_address_service_udp
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SECOND_ADDRESS_MASTER_START_SCRIPT} SERVICE UDP
+ )
+ set_tests_properties(${TEST_SECOND_ADDRESS_NAME}_second_ip_address_service_udp PROPERTIES TIMEOUT 180)
+
+ add_test(NAME ${TEST_SECOND_ADDRESS_NAME}_second_ip_address_client_udp
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SECOND_ADDRESS_MASTER_START_SCRIPT} CLIENT UDP
+ )
+ set_tests_properties(${TEST_SECOND_ADDRESS_NAME}_second_ip_address_client_udp PROPERTIES TIMEOUT 180)
+ endif()
else()
# Routing tests
add_test(NAME ${TEST_LOCAL_ROUTING_NAME}
diff --git a/test/application_tests/application_test.cpp b/test/application_tests/application_test.cpp
index 7862528..e39cf1f 100644
--- a/test/application_tests/application_test.cpp
+++ b/test/application_tests/application_test.cpp
@@ -250,6 +250,8 @@ protected:
void TearDown() {
shutdown_thread_.join();
app_->stop();
+ app_.reset();
+ std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
void on_state(vsomeip::state_type_e _state) {
@@ -283,15 +285,23 @@ protected:
void send_shutdown_message() {
{
std::unique_lock<std::mutex> its_lock(mutex_);
- while(!is_registered_) {
- cv_.wait(its_lock);
+ while (!is_registered_) {
+ if (std::cv_status::timeout
+ == cv_.wait_for(its_lock, std::chrono::seconds(10))) {
+ ADD_FAILURE()<< "Application wasn't registered in time!";
+ is_registered_ = true;
+ }
}
app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID);
app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- while(!is_available_) {
- cv_.wait(its_lock);
+ while (!is_available_) {
+ if (std::cv_status::timeout
+ == cv_.wait_for(its_lock, std::chrono::seconds(10))) {
+ ADD_FAILURE()<< "Service didn't become available in time!";
+ is_available_ = true;
+ }
}
}
@@ -316,6 +326,7 @@ protected:
void SetUp() {
is_registered_ = false;
is_available_ = false;
+ exception_method_called_ = false;
app_ = runtime::get()->create_application("application_test");
if (!app_->init()) {
@@ -352,6 +363,8 @@ protected:
void TearDown() {
shutdown_thread_.join();
app_->stop();
+ app_.reset();
+ std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
void on_state(vsomeip::state_type_e _state) {
@@ -385,6 +398,11 @@ protected:
void on_message_exception(const std::shared_ptr<message>& _request)
{
(void)_request;
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ exception_method_called_ = true;
+ cv_.notify_one();
+ }
throw std::invalid_argument("something went terribly wrong");
}
@@ -409,7 +427,13 @@ protected:
r->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
r->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN+1);
app_->send(r);
- std::this_thread::sleep_for(std::chrono::milliseconds(50));
+
+ {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (!exception_method_called_) {
+ cv_.wait(its_lock);
+ }
+ }
//shutdown test
@@ -421,6 +445,7 @@ protected:
bool is_registered_;
bool is_available_;
+ bool exception_method_called_;
std::shared_ptr<application> app_;
std::condition_variable cv_;
std::mutex mutex_;
diff --git a/test/application_tests/application_test_client.cpp b/test/application_tests/application_test_client.cpp
index 25f7c09..30d0084 100644
--- a/test/application_tests/application_test_client.cpp
+++ b/test/application_tests/application_test_client.cpp
@@ -17,7 +17,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "application_test_globals.hpp"
@@ -26,7 +26,6 @@ public:
application_test_client(struct application_test::service_info _service_info) :
service_info_(_service_info),
app_(vsomeip::runtime::get()->create_application("client")),
- service_available_(false),
wait_until_registered_(true),
wait_until_service_available_(true),
wait_for_stop_(true),
@@ -164,12 +163,14 @@ public:
<< " responses. Delta: " << sent_requests_ - received_responses_;
std::uint32_t counter(0);
if (check) {
- while(sent_requests_ < received_responses_) {
+ while(sent_requests_ == 0 || sent_requests_ < received_responses_) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
if(++counter > 50) {
break;
}
}
+ EXPECT_GT(sent_requests_, 0u);
+ EXPECT_GT(received_responses_, 0u);
EXPECT_EQ(sent_requests_, received_responses_);
}
stop_condition_.notify_one();
@@ -178,7 +179,6 @@ public:
private:
struct application_test::service_info service_info_;
std::shared_ptr<vsomeip::application> app_;
- bool service_available_;
bool wait_until_registered_;
bool wait_until_service_available_;
diff --git a/test/application_tests/application_test_client_availability.cpp b/test/application_tests/application_test_client_availability.cpp
index 5148d58..16fe87b 100644
--- a/test/application_tests/application_test_client_availability.cpp
+++ b/test/application_tests/application_test_client_availability.cpp
@@ -17,7 +17,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "application_test_globals.hpp"
diff --git a/test/application_tests/application_test_daemon.cpp b/test/application_tests/application_test_daemon.cpp
index 43876ea..2f0b244 100644
--- a/test/application_tests/application_test_daemon.cpp
+++ b/test/application_tests/application_test_daemon.cpp
@@ -7,7 +7,7 @@
#include <future>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
class application_test_daemon {
public:
diff --git a/test/application_tests/application_test_service.cpp b/test/application_tests/application_test_service.cpp
index 0064fd3..77d40cd 100644
--- a/test/application_tests/application_test_service.cpp
+++ b/test/application_tests/application_test_service.cpp
@@ -17,7 +17,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "application_test_globals.hpp"
@@ -25,11 +25,10 @@ class application_test_service {
public:
application_test_service(struct application_test::service_info _service_info) :
service_info_(_service_info),
- // service with number 1 uses "vsomeipd" as application name
+ // service with number 1 uses "routingmanagerd" as application name
// this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
+ // including the ones with routingmanagerd
app_(vsomeip::runtime::get()->create_application("service")),
- counter_(0),
wait_until_registered_(true),
stop_called_(false),
offer_thread_(std::bind(&application_test_service::run, this)) {
@@ -119,7 +118,6 @@ public:
private:
struct application_test::service_info service_info_;
std::shared_ptr<vsomeip::application> app_;
- std::uint32_t counter_;
bool wait_until_registered_;
std::mutex mutex_;
diff --git a/test/application_tests/application_test_single_process.cpp b/test/application_tests/application_test_single_process.cpp
index 1d0d4a0..b4497a7 100644
--- a/test/application_tests/application_test_single_process.cpp
+++ b/test/application_tests/application_test_single_process.cpp
@@ -11,14 +11,14 @@
TEST(someip_application_test_single_process, notify_increasing_counter)
{
// start application acting as daemon (rm_stub)
- application_test_daemon its_daemon;
+ auto its_daemon = std::make_shared<application_test_daemon>();
// start receiver service (rm_proxy)
application_test_service its_receiver(application_test::service);
// stop the daemon (rm_stub goes away)
- its_daemon.stop();
-
+ its_daemon->stop();
+ its_daemon.reset();
// restart client which tries to communicate with service multiple times
// thus it will always be the new routing manager
for (int var = 0; var < 10; ++var) {
diff --git a/test/application_tests/application_test_starter.sh b/test/application_tests/application_test_starter.sh
index 3efc1b4..bb17515 100755
--- a/test/application_tests/application_test_starter.sh
+++ b/test/application_tests/application_test_starter.sh
@@ -25,12 +25,12 @@ fi
cat <<End-of-message
*******************************************************************************
*******************************************************************************
-** Now running same tests with vsomeipd
+** Now running same tests with routingmanagerd
*******************************************************************************
*******************************************************************************
End-of-message
export VSOMEIP_CONFIGURATION=application_test_no_dispatch_threads_daemon.json
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
DAEMON_PID=$!
./application_test
if [ $? -ne 0 ]
@@ -42,7 +42,7 @@ kill $DAEMON_PID
wait $DAEMON_PID
export VSOMEIP_CONFIGURATION=application_test_daemon.json
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
DAEMON_PID=$!
./application_test
if [ $? -ne 0 ]
diff --git a/test/application_tests/conf/application_test_daemon.json.in b/test/application_tests/conf/application_test_daemon.json.in
index c84adf5..f7fd3dc 100644
--- a/test/application_tests/conf/application_test_daemon.json.in
+++ b/test/application_tests/conf/application_test_daemon.json.in
@@ -27,7 +27,7 @@
"reliable":"30503"
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in b/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in
index 8dec80e..8c7622a 100644
--- a/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in
+++ b/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in
@@ -26,7 +26,7 @@
"reliable":"30503"
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/big_payload_tests/big_payload_test_client.cpp b/test/big_payload_tests/big_payload_test_client.cpp
index 23a7241..48ee6c2 100644
--- a/test/big_payload_tests/big_payload_test_client.cpp
+++ b/test/big_payload_tests/big_payload_test_client.cpp
@@ -10,7 +10,6 @@ big_payload_test_client::big_payload_test_client(
bool _use_tcp, big_payload_test::test_mode _test_mode) :
app_(vsomeip::runtime::get()->create_application("big_payload_test_client")),
request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- running_(true),
blocked_(false),
is_available_(false),
test_mode_(_test_mode),
@@ -37,6 +36,9 @@ big_payload_test_client::big_payload_test_client(
case big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC:
service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_SPECIFIC;
break;
+ case big_payload_test::test_mode::UDP:
+ service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_UDP;
+ break;
default:
service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID;
break;
@@ -81,7 +83,10 @@ void big_payload_test_client::stop()
|| test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
|| test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
- ASSERT_EQ(number_of_acknowledged_messages_, number_of_messages_to_send_ / 4);
+ EXPECT_EQ(number_of_acknowledged_messages_, number_of_messages_to_send_ / 4);
+ } else if (test_mode_ == big_payload_test::test_mode::UDP) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(3000));
+ EXPECT_EQ(number_of_acknowledged_messages_, number_of_messages_to_send_);
}
app_->clear_all_handler();
app_->stop();
@@ -93,9 +98,11 @@ void big_payload_test_client::join_sender_thread(){
|| test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
|| test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
|| test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- ASSERT_EQ(number_of_acknowledged_messages_, number_of_messages_to_send_ / 4);
+ EXPECT_EQ(number_of_acknowledged_messages_, number_of_messages_to_send_ / 4);
+ } else if (test_mode_ == big_payload_test::test_mode::UDP) {
+ EXPECT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
} else {
- ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
+ EXPECT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
}
}
@@ -145,6 +152,8 @@ void big_payload_test_client::on_message(const std::shared_ptr<vsomeip::message>
if(test_mode_ == big_payload_test::test_mode::RANDOM) {
ASSERT_LT(_response->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE_RANDOM);
+ } else if (test_mode_ == big_payload_test::test_mode::UDP) {
+ EXPECT_EQ(big_payload_test::BIG_PAYLOAD_SIZE_UDP, _response->get_payload()->get_length());
} else {
ASSERT_EQ(_response->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE);
}
@@ -200,7 +209,7 @@ void big_payload_test_client::run()
for (unsigned int i = 0; i < number_of_messages_to_send_; i++)
{
if (test_mode_ == big_payload_test::test_mode::RANDOM) {
- unsigned int datasize(std::rand() % big_payload_test::BIG_PAYLOAD_SIZE_RANDOM);
+ unsigned int datasize(static_cast<unsigned int>(std::rand()) % big_payload_test::BIG_PAYLOAD_SIZE_RANDOM);
its_payload_data.assign(datasize, big_payload_test::DATA_CLIENT_TO_SERVICE);
} else if (test_mode_ == big_payload_test::test_mode::LIMITED
|| test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
@@ -214,13 +223,16 @@ void big_payload_test_client::run()
its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
big_payload_test::DATA_CLIENT_TO_SERVICE);
}
+ } else if (test_mode_ == big_payload_test::test_mode::UDP) {
+ its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE_UDP,
+ big_payload_test::DATA_CLIENT_TO_SERVICE);
} else {
its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
big_payload_test::DATA_CLIENT_TO_SERVICE);
}
its_payload->set_data(its_payload_data);
request_->set_payload(its_payload);
- app_->send(request_, true);
+ app_->send(request_);
if (test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
|| test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
@@ -244,10 +256,10 @@ void big_payload_test_client::run()
|| test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
|| test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
|| test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- ASSERT_EQ(number_of_messages_to_send_ / 4,
+ EXPECT_EQ(number_of_messages_to_send_ / 4,
number_of_acknowledged_messages_);
} else {
- ASSERT_EQ(number_of_sent_messages_,
+ EXPECT_EQ(number_of_sent_messages_,
number_of_acknowledged_messages_);
}
}
@@ -259,7 +271,7 @@ static big_payload_test::test_mode test_mode(big_payload_test::test_mode::UNKNOW
TEST(someip_big_payload_test, send_ten_messages_to_service)
{
- bool use_tcp = true;
+ bool use_tcp = (test_mode != big_payload_test::test_mode::UDP);
big_payload_test_client test_client_(use_tcp, test_mode);
if (test_client_.init()) {
test_client_.start();
@@ -282,6 +294,8 @@ int main(int argc, char** argv)
test_mode = big_payload_test::test_mode::QUEUE_LIMITED_GENERAL;
} else if (std::string("QUEUELIMITEDSPECIFIC") == std::string(argv[1])) {
test_mode = big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC;
+ } else if (std::string("UDP") == std::string(argv[1])) {
+ test_mode = big_payload_test::test_mode::UDP;
}
}
return RUN_ALL_TESTS();
diff --git a/test/big_payload_tests/big_payload_test_client.hpp b/test/big_payload_tests/big_payload_test_client.hpp
index fb03a8e..bb81fdc 100644
--- a/test/big_payload_tests/big_payload_test_client.hpp
+++ b/test/big_payload_tests/big_payload_test_client.hpp
@@ -17,7 +17,7 @@
#include <atomic>
#include "big_payload_test_globals.hpp"
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
class big_payload_test_client
{
@@ -39,7 +39,6 @@ private:
std::shared_ptr<vsomeip::message> request_;
std::mutex mutex_;
std::condition_variable condition_;
- bool running_;
bool blocked_;
bool is_available_;
big_payload_test::test_mode test_mode_;
diff --git a/test/big_payload_tests/big_payload_test_external_starter.sh b/test/big_payload_tests/big_payload_test_external_starter.sh
index 6c04a3d..aa2f1a5 100755
--- a/test/big_payload_tests/big_payload_test_external_starter.sh
+++ b/test/big_payload_tests/big_payload_test_external_starter.sh
@@ -10,9 +10,9 @@
# 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 != "LIMITEDGENERAL" && $1 != "QUEUELIMITEDGENERAL" && $1 != "QUEUELIMITEDSPECIFIC" ]]
+if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "LIMITEDGENERAL" && $1 != "QUEUELIMITEDGENERAL" && $1 != "QUEUELIMITEDSPECIFIC" && $1 != "UDP" ]]
then
- echo "The only allowed parameter to this script is RANDOM or LIMITED or LIMITEDGENERAL."
+ echo "The only allowed parameter to this script is RANDOM or LIMITED, LIMITEDGENERAL, QUEUELIMITEDGENERAL, QUEUELIMITEDSPECIFIC or UDP"
echo "Like $0 RANDOM"
exit 1
fi
@@ -28,6 +28,8 @@ elif [[ $# -gt 0 && $1 == "QUEUELIMITEDGENERAL" ]]; then
export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client_queue_limited_general.json
elif [[ $# -gt 0 && $1 == "QUEUELIMITEDSPECIFIC" ]]; then
export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client_queue_limited_specific.json
+elif [[ $# -gt 0 && $1 == "UDP" ]]; then
+ export VSOMEIP_CONFIGURATION=big_payload_test_udp_client.json
else
export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client.json
fi
@@ -37,15 +39,15 @@ BIG_PAYLOAD_TEST_PID=$!
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting big payload test on slave LXC"
if [[ $# -gt 0 ]]; then
- 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/test; ./big_payload_test_service_external_start.sh $1\"" &
+ 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; ./big_payload_test_service_external_start.sh $1\"" &
else
- 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/test; ./big_payload_test_service_external_start.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; ./big_payload_test_service_external_start.sh"' &
fi
elif [ ! -z "$USE_DOCKER" ]; then
if [[ $# -gt 0 ]]; then
- docker run --name bpts --cap-add=NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./big_payload_test_service_external_start.sh $1" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./big_payload_test_service_external_start.sh $1" &
else
- docker run --name bpts --cap-add=NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./big_payload_test_service_external_start.sh" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./big_payload_test_service_external_start.sh" &
fi
else
cat <<End-of-message
@@ -71,15 +73,5 @@ do
wait $job || ((FAIL+=1))
done
-if [ ! -z "$USE_DOCKER" ]; then
- docker wait bpts
- docker rm bpts
-fi
-
# Check if client and server both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
+exit $FAIL
diff --git a/test/big_payload_tests/big_payload_test_globals.hpp b/test/big_payload_tests/big_payload_test_globals.hpp
index 5488259..187ff4a 100644
--- a/test/big_payload_tests/big_payload_test_globals.hpp
+++ b/test/big_payload_tests/big_payload_test_globals.hpp
@@ -10,6 +10,7 @@
namespace big_payload_test {
constexpr std::uint32_t BIG_PAYLOAD_SIZE = 1024*600;
+ constexpr std::uint32_t BIG_PAYLOAD_SIZE_UDP = 1024*30;
constexpr std::uint32_t BIG_PAYLOAD_SIZE_RANDOM = 1024*1024*10;
constexpr vsomeip::byte_t DATA_SERVICE_TO_CLIENT = 0xAA;
constexpr vsomeip::byte_t DATA_CLIENT_TO_SERVICE = 0xFF;
@@ -23,6 +24,7 @@ namespace big_payload_test {
constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_LIMITED_GENERAL = 0x1237;
constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_GENERAL = 0x1238;
constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_SPECIFIC = 0x1239;
+ constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_UDP = 0x1240;
constexpr vsomeip::service_t TEST_SERVICE_INSTANCE_ID = 0x1;
constexpr vsomeip::method_t TEST_SERVICE_METHOD_ID = 0x8421;
@@ -33,6 +35,7 @@ namespace big_payload_test {
LIMITED_GENERAL,
QUEUE_LIMITED_GENERAL,
QUEUE_LIMITED_SPECIFIC,
+ UDP,
UNKNOWN
};
}
diff --git a/test/big_payload_tests/big_payload_test_local.json b/test/big_payload_tests/big_payload_test_local.json
index aa7b3ea..983dea6 100644
--- a/test/big_payload_tests/big_payload_test_local.json
+++ b/test/big_payload_tests/big_payload_test_local.json
@@ -15,11 +15,13 @@
[
{
"name":"big_payload_test_service",
- "id":"0x1277"
+ "id":"0x1277",
+ "max_dispatchers" : "0"
},
{
"name":"big_payload_test_client",
- "id":"0x1344"
+ "id":"0x1344",
+ "max_dispatchers" : "0"
}
],
"services":
diff --git a/test/big_payload_tests/big_payload_test_local_limited.json b/test/big_payload_tests/big_payload_test_local_limited.json
index a711df1..4e8c666 100644
--- a/test/big_payload_tests/big_payload_test_local_limited.json
+++ b/test/big_payload_tests/big_payload_test_local_limited.json
@@ -15,11 +15,13 @@
[
{
"name":"big_payload_test_service",
- "id":"0x1277"
+ "id":"0x1277",
+ "max_dispatchers" : "0"
},
{
"name":"big_payload_test_client",
- "id":"0x1344"
+ "id":"0x1344",
+ "max_dispatchers" : "0"
}
],
"services":
diff --git a/test/big_payload_tests/big_payload_test_local_queue_limited.json b/test/big_payload_tests/big_payload_test_local_queue_limited.json
index eac38b2..9700309 100644
--- a/test/big_payload_tests/big_payload_test_local_queue_limited.json
+++ b/test/big_payload_tests/big_payload_test_local_queue_limited.json
@@ -15,11 +15,13 @@
[
{
"name":"big_payload_test_service",
- "id":"0x1277"
+ "id":"0x1277",
+ "max_dispatchers" : "0"
},
{
"name":"big_payload_test_client",
- "id":"0x1344"
+ "id":"0x1344",
+ "max_dispatchers" : "0"
}
],
"services":
@@ -29,7 +31,7 @@
"instance":"0x5678"
}
],
- "endpoint-queue-limit-local" : "614430",
+ "endpoint-queue-limit-local" : "614429",
"routing":"big_payload_test_service",
"service-discovery":
{
diff --git a/test/big_payload_tests/big_payload_test_local_random.json b/test/big_payload_tests/big_payload_test_local_random.json
index b49683e..0cf2081 100644
--- a/test/big_payload_tests/big_payload_test_local_random.json
+++ b/test/big_payload_tests/big_payload_test_local_random.json
@@ -16,12 +16,12 @@
{
"name":"big_payload_test_service",
"id":"0x1277",
- "max_dispatch_time" : "5000"
+ "max_dispatchers" : "0"
},
{
"name":"big_payload_test_client",
"id":"0x1344",
- "max_dispatch_time" : "5000"
+ "max_dispatchers" : "0"
}
],
"services":
diff --git a/test/big_payload_tests/big_payload_test_service.cpp b/test/big_payload_tests/big_payload_test_service.cpp
index a6868cf..89fe838 100644
--- a/test/big_payload_tests/big_payload_test_service.cpp
+++ b/test/big_payload_tests/big_payload_test_service.cpp
@@ -36,6 +36,10 @@ big_payload_test_service::big_payload_test_service(big_payload_test::test_mode _
expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2;
service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_SPECIFIC;
break;
+ case big_payload_test::test_mode::UDP:
+ expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES;
+ service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_UDP;
+ break;
default:
expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES;
service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID;
@@ -122,68 +126,13 @@ void big_payload_test_service::on_message(const std::shared_ptr<vsomeip::message
<< std::setw(4) << std::setfill('0') << std::hex
<< _request->get_session() << "] size: " << std::dec
<< _request->get_payload()->get_length();
-
- static vsomeip::session_t last_session(0);
- ASSERT_GT(_request->get_session(), last_session);
- last_session = _request->get_session();
- if (test_mode_ == big_payload_test::test_mode::RANDOM) {
- ASSERT_LT(_request->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE_RANDOM);
- } else {
- ASSERT_EQ(_request->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE);
- }
- bool check(true);
- vsomeip::length_t len = _request->get_payload()->get_length();
- vsomeip::byte_t* datap = _request->get_payload()->get_data();
- for(unsigned int i = 0; i < len; ++i) {
- check = check && datap[i] == big_payload_test::DATA_CLIENT_TO_SERVICE;
- }
- if(!check) {
- GTEST_FATAL_FAILURE_("wrong data transmitted");
- }
-
- number_of_received_messages_++;
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()
- ->create_payload();
- std::vector<vsomeip::byte_t> its_payload_data;
- if (test_mode_ == big_payload_test::test_mode::RANDOM) {
- its_payload_data.assign(std::rand() % big_payload_test::BIG_PAYLOAD_SIZE_RANDOM,
- big_payload_test::DATA_SERVICE_TO_CLIENT);
- } else if (test_mode_ == big_payload_test::test_mode::LIMITED
- || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- if (number_of_received_messages_ % 2) {
- // try to send to big response for half of the received messsages.
- // this way the client will only get replies for a fourth of his sent
- // requests as he tries to sent to big data for every second request
- // as well
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE + 1,
- big_payload_test::DATA_SERVICE_TO_CLIENT);
- } else {
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
- big_payload_test::DATA_SERVICE_TO_CLIENT);
- }
- } else {
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
- big_payload_test::DATA_SERVICE_TO_CLIENT);
- }
-
- its_payload->set_data(its_payload_data);
- its_response->set_payload(its_payload);
-
- app_->send(its_response, true);
-
- if(number_of_received_messages_ == expected_messages_) {
- ASSERT_EQ(expected_messages_, number_of_received_messages_);
+ {
std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
+ incoming_requests_.push(_request);
condition_.notify_one();
}
+
+
}
void big_payload_test_service::run()
@@ -198,16 +147,87 @@ void big_payload_test_service::run()
// wait for shutdown
blocked_ = false;
- while (!blocked_) {
- condition_.wait(its_lock);
+ while (!blocked_ || !incoming_requests_.empty()) {
+ if (incoming_requests_.empty()) {
+ condition_.wait(its_lock);
+ }
+ auto _request = incoming_requests_.front();
+ incoming_requests_.pop();
+ number_of_received_messages_++;
+ its_lock.unlock();
+
+ static vsomeip::session_t last_session(0);
+ ASSERT_GT(_request->get_session(), last_session);
+ last_session = _request->get_session();
+ if (test_mode_ == big_payload_test::test_mode::RANDOM) {
+ EXPECT_LT(_request->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE_RANDOM);
+ } else if (test_mode_ == big_payload_test::test_mode::UDP) {
+ EXPECT_EQ(big_payload_test::BIG_PAYLOAD_SIZE_UDP, _request->get_payload()->get_length());
+ } else {
+ EXPECT_EQ(big_payload_test::BIG_PAYLOAD_SIZE, _request->get_payload()->get_length());
+ }
+ bool check(true);
+ vsomeip::length_t len = _request->get_payload()->get_length();
+ vsomeip::byte_t* datap = _request->get_payload()->get_data();
+ for(unsigned int i = 0; i < len; ++i) {
+ check = check && datap[i] == big_payload_test::DATA_CLIENT_TO_SERVICE;
+ }
+ if(!check) {
+ GTEST_FATAL_FAILURE_("wrong data transmitted");
+ }
+
+ // send response
+ std::shared_ptr<vsomeip::message> its_response =
+ vsomeip::runtime::get()->create_response(_request);
+
+ std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()
+ ->create_payload();
+ std::vector<vsomeip::byte_t> its_payload_data;
+ if (test_mode_ == big_payload_test::test_mode::RANDOM) {
+ its_payload_data.assign(static_cast<unsigned int>(std::rand()) % big_payload_test::BIG_PAYLOAD_SIZE_RANDOM,
+ big_payload_test::DATA_SERVICE_TO_CLIENT);
+ } else if (test_mode_ == big_payload_test::test_mode::LIMITED
+ || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
+ || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
+ || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
+ if (number_of_received_messages_ % 2) {
+ // try to send to big response for half of the received messsages.
+ // this way the client will only get replies for a fourth of his sent
+ // requests as he tries to sent to big data for every second request
+ // as well
+ its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE + 1,
+ big_payload_test::DATA_SERVICE_TO_CLIENT);
+ } else {
+ its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
+ big_payload_test::DATA_SERVICE_TO_CLIENT);
+ }
+ } else if (test_mode_ == big_payload_test::test_mode::UDP) {
+ its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE_UDP,
+ big_payload_test::DATA_SERVICE_TO_CLIENT);
+ } else {
+ its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
+ big_payload_test::DATA_SERVICE_TO_CLIENT);
+ }
+
+ its_payload->set_data(its_payload_data);
+ its_response->set_payload(its_payload);
+
+ app_->send(its_response);
+
+ if(number_of_received_messages_ == expected_messages_) {
+ ASSERT_EQ(expected_messages_, number_of_received_messages_);
+ blocked_ = true;
+ }
+ its_lock.lock();
}
}
std::this_thread::sleep_for(std::chrono::seconds(3));
if (test_mode_ == big_payload_test::test_mode::LIMITED
|| test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
|| test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- ASSERT_EQ(number_of_received_messages_, expected_messages_);
+ || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC
+ || test_mode_ == big_payload_test::test_mode::UDP) {
+ EXPECT_EQ(expected_messages_, number_of_received_messages_);
}
stop();
}
@@ -239,6 +259,8 @@ int main(int argc, char** argv)
test_mode = big_payload_test::test_mode::QUEUE_LIMITED_GENERAL;
} else if (std::string("QUEUELIMITEDSPECIFIC") == std::string(argv[1])) {
test_mode = big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC;
+ } else if (std::string("UDP") == std::string(argv[1])) {
+ test_mode = big_payload_test::test_mode::UDP;
}
}
return RUN_ALL_TESTS();
diff --git a/test/big_payload_tests/big_payload_test_service.hpp b/test/big_payload_tests/big_payload_test_service.hpp
index 8db42f7..fcb5e9e 100644
--- a/test/big_payload_tests/big_payload_test_service.hpp
+++ b/test/big_payload_tests/big_payload_test_service.hpp
@@ -13,9 +13,10 @@
#include <mutex>
#include <condition_variable>
#include <functional>
+#include <queue>
#include "big_payload_test_globals.hpp"
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
class big_payload_test_service
@@ -43,6 +44,7 @@ private:
std::thread offer_thread_;
std::uint32_t expected_messages_;
vsomeip::service_t service_id_;
+ std::queue<std::shared_ptr<vsomeip::message>> incoming_requests_;
};
#endif /* BIGPAYLOADTESTSERVICE_HPP_ */
diff --git a/test/big_payload_tests/big_payload_test_service_external_start.sh b/test/big_payload_tests/big_payload_test_service_external_start.sh
index de3224c..ac8dd60 100755
--- a/test/big_payload_tests/big_payload_test_service_external_start.sh
+++ b/test/big_payload_tests/big_payload_test_service_external_start.sh
@@ -4,9 +4,9 @@
# 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/.
-if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "LIMITEDGENERAL" && $1 != "QUEUELIMITEDGENERAL" && $1 != "QUEUELIMITEDSPECIFIC" ]]
+if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "LIMITEDGENERAL" && $1 != "QUEUELIMITEDGENERAL" && $1 != "QUEUELIMITEDSPECIFIC" && $1 != "UDP" ]]
then
- echo "The only allowed parameter to this script is RANDOM, LIMITED, LIMITEDGENERAL, QUEUELIMITEDGENERAL or QUEUELIMITEDSPECIFIC"
+ echo "The only allowed parameter to this script is RANDOM, LIMITED, LIMITEDGENERAL, QUEUELIMITEDGENERAL, QUEUELIMITEDSPECIFIC or UDP"
echo "Like $0 RANDOM"
exit 1
fi
@@ -20,6 +20,8 @@ elif [[ $# -gt 0 && $1 == "QUEUELIMITEDGENERAL" ]]; then
export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service_queue_limited_general.json
elif [[ $# -gt 0 && $1 == "QUEUELIMITEDSPECIFIC" ]]; then
export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service_queue_limited_specific.json
+elif [[ $# -gt 0 && $1 == "UDP" ]]; then
+ export VSOMEIP_CONFIGURATION=big_payload_test_udp_service.json
else
export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service.json
fi
diff --git a/test/big_payload_tests/big_payload_test_udp_client.json b/test/big_payload_tests/big_payload_test_udp_client.json
new file mode 100644
index 0000000..d499638
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_udp_client.json
@@ -0,0 +1,44 @@
+{
+ "unicast":"10.0.3.1",
+ "netmask":"255.255.255.0",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"true",
+ "path":"/var/log/vsomeip.log"
+ },
+ "dlt":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"big_payload_test_client",
+ "id":"0x1343",
+ "max_dispatchers" : "0"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1240",
+ "instance":"0x01",
+ "unicast":"10.0.3.2",
+ "unreliable": "30509",
+ "someip-tp" : {
+ "client-to-service" : [ "0x8421" ]
+ }
+ }
+ ],
+ "max-payload-size-reliable":"614400",
+ "routing":"big_payload_test_client",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.244.224.245",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/big_payload_tests/big_payload_test_udp_service.json b/test/big_payload_tests/big_payload_test_udp_service.json
new file mode 100644
index 0000000..886ed4b
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_udp_service.json
@@ -0,0 +1,41 @@
+{
+ "unicast":"10.0.3.2",
+ "logging":
+ {
+ "level":"debug",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"big_payload_test_service",
+ "id":"0x1277",
+ "max_dispatchers" : "0"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1240",
+ "instance":"0x01",
+ "unreliable": "30509",
+ "someip-tp" : {
+ "service-to-client" : [ "0x8421" ]
+ }
+ }
+ ],
+ "routing":"big_payload_test_service",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.244.224.245",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/big_payload_tests/conf/big_payload_test_udp_client.json.in b/test/big_payload_tests/conf/big_payload_test_udp_client.json.in
new file mode 100644
index 0000000..5a7ee36
--- /dev/null
+++ b/test/big_payload_tests/conf/big_payload_test_udp_client.json.in
@@ -0,0 +1,44 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "netmask":"255.255.255.0",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"true",
+ "path":"/var/log/vsomeip.log"
+ },
+ "dlt":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"big_payload_test_client",
+ "id":"0x1343",
+ "max_dispatchers" : "0"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1240",
+ "instance":"0x01",
+ "unicast":"@TEST_IP_SLAVE@",
+ "unreliable": "30509",
+ "someip-tp" : {
+ "client-to-service" : [ "0x8421" ]
+ }
+ }
+ ],
+ "max-payload-size-reliable":"614400",
+ "routing":"big_payload_test_client",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.244.224.245",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/big_payload_tests/conf/big_payload_test_udp_service.json.in b/test/big_payload_tests/conf/big_payload_test_udp_service.json.in
new file mode 100644
index 0000000..7f71a05
--- /dev/null
+++ b/test/big_payload_tests/conf/big_payload_test_udp_service.json.in
@@ -0,0 +1,41 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"debug",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"big_payload_test_service",
+ "id":"0x1277",
+ "max_dispatchers" : "0"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1240",
+ "instance":"0x01",
+ "unreliable": "30509",
+ "someip-tp" : {
+ "service-to-client" : [ "0x8421" ]
+ }
+ }
+ ],
+ "routing":"big_payload_test_service",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.244.224.245",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/client_id_tests/client_id_test_master_starter.sh b/test/client_id_tests/client_id_test_master_starter.sh
index c0b2a0b..eea65af 100755
--- a/test/client_id_tests/client_id_test_master_starter.sh
+++ b/test/client_id_tests/client_id_test_master_starter.sh
@@ -42,9 +42,9 @@ sleep 1
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting client id 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/test; ./client_id_test_slave_starter.sh $CLIENT_JSON_FILE\"" &
+ 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; ./client_id_test_slave_starter.sh $CLIENT_JSON_FILE\"" &
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name citms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./client_id_test_slave_starter.sh $CLIENT_JSON_FILE" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./client_id_test_slave_starter.sh $CLIENT_JSON_FILE" &
else
cat <<End-of-message
*******************************************************************************
@@ -71,11 +71,6 @@ do
fi
done
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop citms
- docker rm citms
-fi
-
# Check if both exited successfully
if [ $FAIL -eq 0 ]
then
diff --git a/test/client_id_tests/client_id_test_service.cpp b/test/client_id_tests/client_id_test_service.cpp
index 9306bad..b9bb0a1 100644
--- a/test/client_id_tests/client_id_test_service.cpp
+++ b/test/client_id_tests/client_id_test_service.cpp
@@ -15,7 +15,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "client_id_test_globals.hpp"
@@ -248,7 +248,7 @@ static int service_number;
TEST(someip_client_id_test, send_ten_messages_to_service)
{
client_id_test_service its_sample(
- client_id_test::service_infos[service_number]);
+ client_id_test::service_infos[static_cast<size_t>(service_number)]);
}
#ifndef _WIN32
diff --git a/test/client_id_tests/client_id_test_utility.cpp b/test/client_id_tests/client_id_test_utility.cpp
index e7f9770..189bb65 100644
--- a/test/client_id_tests/client_id_test_utility.cpp
+++ b/test/client_id_tests/client_id_test_utility.cpp
@@ -5,18 +5,19 @@
#include <gtest/gtest.h>
-#include <unistd.h> // for access()
-#include <sstream>
-
-#include <vsomeip/constants.hpp>
+#include <thread>
+#include <future>
+#include <cstring>
+#include <vsomeip/vsomeip.hpp>
#include "../../implementation/utility/include/utility.hpp"
#include "../../implementation/configuration/include/configuration.hpp"
-#include "../../implementation/plugin/include/plugin_manager.hpp"
+#include "../../implementation/configuration/include/configuration_plugin.hpp"
+#include "../../implementation/plugin/include/plugin_manager_impl.hpp"
using namespace vsomeip;
-static const std::string APPLICATION_NAME_ROUTING_MANAGER = "vsomeipd";
+static const std::string APPLICATION_NAME_ROUTING_MANAGER = "routingmanagerd";
static const std::string APPLICATION_NAME_NOT_PREDEFINED = "test-application-name";
@@ -46,50 +47,53 @@ public:
auto its_plugin = vsomeip::plugin_manager::get()->get_plugin(
vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY);
if (its_plugin) {
- configuration_ = std::dynamic_pointer_cast<vsomeip::configuration>(its_plugin);
+ auto its_config_plugin = std::dynamic_pointer_cast<vsomeip::configuration_plugin>(its_plugin);
+ if (its_config_plugin) {
+ configuration_ = its_config_plugin->get_configuration(APPLICATION_NAME_ROUTING_MANAGER);
+ }
}
}
protected:
virtual void SetUp() {
- unlink(std::string("/dev/shm").append(utility::get_shm_name(configuration_)).c_str());
- ASSERT_FALSE(file_exist(std::string("/dev/shm").append(utility::get_shm_name(configuration_))));
ASSERT_TRUE(static_cast<bool>(configuration_));
configuration_->load(APPLICATION_NAME_ROUTING_MANAGER);
diagnosis_mask_ = configuration_->get_diagnosis_mask();
diagnosis_ = configuration_->get_diagnosis_address();
// calculate all client IDs based on mask
- client_id_base_ = static_cast<client_t>((diagnosis_ << 8) & diagnosis_mask_);
- CLIENT_ID_ROUTING_MANAGER = client_id_base_ | 0x1;
+ client_id_base_ = static_cast<client_t>(diagnosis_ << 8);
+ CLIENT_ID_ROUTING_MANAGER =
+ static_cast<client_t>((configuration_->get_diagnosis_address()
+ << 8) & configuration_->get_diagnosis_mask());
APPLICATION_IN_CLIENT_ID = static_cast<client_t>(client_id_base_ | 0x11);
APPLICATION_IN_CLIENT_ID_TWO = static_cast<client_t>(client_id_base_ | 0x12);
- utility::auto_configuration_init(configuration_);
- EXPECT_TRUE(file_exist(std::string("/dev/shm").append(utility::get_shm_name(configuration_))));
+ app_ = vsomeip::runtime::get()->create_application(APPLICATION_NAME_ROUTING_MANAGER);
+ EXPECT_TRUE(app_->init());
+ EXPECT_EQ(CLIENT_ID_ROUTING_MANAGER, app_->get_client());
+
+ rm_impl_thread_ = std::thread([&](){
+ app_->start();
+ });
+ // ensure clean preconditions
+ utility::reset_client_ids();
+ // required as there are two static versions of the utility class in this
+ // test, one in the test itself and one in libvsomeip...
client_id_routing_manager_ = utility::request_client_id(
- configuration_, APPLICATION_NAME_ROUTING_MANAGER, 0x0);
- EXPECT_EQ(client_id_base_ | 0x1, client_id_routing_manager_);
- EXPECT_TRUE(utility::is_routing_manager_host(client_id_routing_manager_));
+ configuration_, APPLICATION_NAME_ROUTING_MANAGER, static_cast<client_t>(
+ (configuration_->get_diagnosis_address() << 8)
+ & configuration_->get_diagnosis_mask()));
+ EXPECT_EQ(CLIENT_ID_ROUTING_MANAGER, client_id_routing_manager_);
}
virtual void TearDown() {
- utility::auto_configuration_exit(client_id_routing_manager_, configuration_);
- EXPECT_FALSE(file_exist(std::string("/dev/shm").append(utility::get_shm_name(configuration_))));
- }
-
- bool file_exist(const std::string &_path) {
- const int ret = ::access(_path.c_str(), F_OK);
- if (ret == -1 && errno == ENOENT) {
- return false;
- } else if (ret == -1) {
- std::stringstream its_stream;
- its_stream << "file_exists (" << _path << "): ";
- std::perror(its_stream.str().c_str());
- return false;
- } else {
- return true;
+ app_->stop();
+ if (rm_impl_thread_.joinable()) {
+ rm_impl_thread_.join();
}
+ app_.reset();
+ utility::release_client_id(client_id_routing_manager_);
}
protected:
@@ -98,388 +102,304 @@ protected:
std::uint16_t diagnosis_;
std::uint16_t diagnosis_mask_;
client_t client_id_base_;
+ std::shared_ptr<vsomeip::application> app_;
+ std::thread rm_impl_thread_;
};
-TEST_F(client_id_utility_test, request_release_client_id) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
+class app_wrapper {
+public:
+ app_wrapper(const std::string& _name) :
+ app_(vsomeip::runtime::get()->create_application(_name)),
+ client_(VSOMEIP_CLIENT_UNSET) {
+ EXPECT_TRUE(app_->init());
+ app_->register_state_handler(
+ std::bind(&app_wrapper::on_state, this, std::placeholders::_1));
+ app_thread_ = std::thread([&](){ app_->start(); });
+ }
+
+ ~app_wrapper() {
+ app_->stop();
+ if (app_thread_.joinable()) {
+ app_thread_.join();
+ }
+ app_.reset();
+ }
+
+ void on_state(const vsomeip::state_type_e& _state) {
+ if (_state == vsomeip::state_type_e::ST_REGISTERED) {
+ client_ = app_->get_client();
+ registered_.set_value();
+ }
+ };
+
+ client_t get_client() {
+ if (std::future_status::timeout
+ == registered_.get_future().wait_for(
+ std::chrono::seconds(11))) {
+ ADD_FAILURE()<< __LINE__ << " application wasn't registered within time";
+ }
+ return client_;
+ }
+
+ std::shared_ptr<vsomeip::application> get_app() {
+ return app_;
+ }
- utility::release_client_id(its_client_id);
+private:
+ std::shared_ptr<vsomeip::application> app_;
+ std::promise<void> registered_;
+ std::thread app_thread_;
+ vsomeip::client_t client_;
+};
+
+TEST_F(client_id_utility_test, request_release_client_id) {
+ app_wrapper app(APPLICATION_NAME_NOT_PREDEFINED);
+ EXPECT_EQ(client_id_base_ | 0x1, app.get_client());
}
TEST_F(client_id_utility_test, request_client_id_twice) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
-
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x3, its_client_id_2);
+ app_wrapper app(APPLICATION_NAME_NOT_PREDEFINED);
+ EXPECT_EQ(client_id_base_ | 0x1, app.get_client());
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
+ app_wrapper app2(APPLICATION_NAME_NOT_PREDEFINED);
+ EXPECT_EQ(client_id_base_ | 0x2, app2.get_client());
}
-TEST_F(client_id_utility_test, release_unknown_client_id) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
+TEST_F(client_id_utility_test, ensure_sequential_ascending_client_id_allocation) {
+ app_wrapper app(APPLICATION_NAME_NOT_PREDEFINED);
+ EXPECT_EQ(client_id_base_ | 0x1, app.get_client());
- utility::release_client_id(0x4711);
- utility::release_client_id(its_client_id);
+ auto app2 = std::make_shared<app_wrapper>(APPLICATION_NAME_NOT_PREDEFINED);
+ client_t app2_client = app2->get_client();
+ EXPECT_EQ(client_id_base_ | 0x2, app2_client);
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x3, its_client_id_2);
- utility::release_client_id(its_client_id_2);
-}
+ app2.reset();
-TEST_F(client_id_utility_test, release_client_id_twice)
-{
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
+ auto app3 = std::make_shared<app_wrapper>(APPLICATION_NAME_NOT_PREDEFINED);
+ client_t app3_client = app3->get_client();
+ EXPECT_EQ(client_id_base_ | 0x3, app3_client);
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id);
+ EXPECT_GT(app3_client, app2_client);
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x3, its_client_id_2);
- utility::release_client_id(its_client_id_2);
}
TEST_F(client_id_utility_test, ensure_preconfigured_client_ids_not_used_for_autoconfig)
{
// request client ids until 10 over the preconfigured one
- const std::uint16_t limit = static_cast<std::uint16_t>((APPLICATION_IN_CLIENT_ID & ~diagnosis_mask_) + 10u);
+ const std::uint16_t limit =
+ static_cast<std::uint16_t>((APPLICATION_IN_CLIENT_ID
+ & ~diagnosis_mask_) + std::uint16_t(10));
+
+ std::vector<std::shared_ptr<app_wrapper>> its_apps;
+ its_apps.reserve(limit);
- std::vector<client_t> its_client_ids;
for (int i = 0; i < limit; i++ ) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- its_client_ids.push_back(its_client_id);
- EXPECT_NE(APPLICATION_IN_CLIENT_ID, its_client_id);
- } else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
- }
+ its_apps.emplace_back(
+ std::make_shared<app_wrapper>(APPLICATION_NAME_NOT_PREDEFINED + std::to_string(i)));
}
-
- // release all
- for (const client_t c : its_client_ids) {
- utility::release_client_id(c);
+ for (const auto& a : its_apps) {
+ EXPECT_NE(APPLICATION_IN_CLIENT_ID, a->get_client());
}
-}
-
-TEST_F(client_id_utility_test,
- ensure_preconfigured_client_ids_in_diagnosis_range_dont_influence_autoconfig_client_ids)
-{
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
-
- client_t its_client_id2 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID, its_client_id2);
-
- client_t its_client_id3 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME_TWO, APPLICATION_IN_CLIENT_ID_TWO);
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID_TWO, its_client_id3);
-
-
- client_t its_client_id4 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x3, its_client_id4);
-
- client_t its_client_id5 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x4, its_client_id5);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id2);
- utility::release_client_id(its_client_id3);
- utility::release_client_id(its_client_id4);
- utility::release_client_id(its_client_id5);
+ its_apps.clear();
}
TEST_F(client_id_utility_test,
request_predefined_client_id_in_diagnosis_range) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID, its_client_id);
-
- utility::release_client_id(its_client_id);
+ auto app1 = std::make_shared<app_wrapper>(APPLICATION_IN_NAME);
+ EXPECT_EQ(APPLICATION_IN_CLIENT_ID, app1->get_client());
}
TEST_F(client_id_utility_test,
request_predefined_client_id_in_diagnosis_range_twice) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID, its_client_id);
+ auto app1 = std::make_shared<app_wrapper>(APPLICATION_IN_NAME);
+ EXPECT_EQ(APPLICATION_IN_CLIENT_ID, app1->get_client());
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_2);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
+ // preconfigured is already taken -> autogenerated ID should be returned
+ auto app2 = std::make_shared<app_wrapper>(APPLICATION_IN_NAME);
+ EXPECT_EQ(client_id_base_ | 0x1, app2->get_client());
}
TEST_F(client_id_utility_test,
- request_different_client_id_with_predefined_app_name_in_diagnosis_range) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, static_cast<client_t>(APPLICATION_IN_CLIENT_ID + 1u));
- // has to get predefined client id although other was requested
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID, its_client_id);
-
- // predefined in json is now already used and requested should be assigned
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, static_cast<client_t>(APPLICATION_IN_CLIENT_ID + 1u));
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID + 1u, its_client_id_2);
-
- client_t its_client_id_3 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_3);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
- utility::release_client_id(its_client_id_3);
+ request_predefined_client_id_outside_diagnosis_range_high) {
+ auto app1 = std::make_shared<app_wrapper>(APPLICATION_OUT_HIGH_NAME);
+ // we should get the client ID defined in the json file
+ EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID, app1->get_client());
}
TEST_F(client_id_utility_test,
- request_predefined_client_id_outside_diagnosis_range_low) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID);
- EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID, its_client_id);
+ request_client_id_with_predefined_app_name_outside_diagnosis_range_high_multiple) {
- utility::release_client_id(its_client_id);
-}
+ auto app1 = std::make_shared<app_wrapper>(APPLICATION_OUT_HIGH_NAME);
+ // we should get the client ID defined in the json file
+ EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID, app1->get_client());
-TEST_F(client_id_utility_test,
- request_predefined_client_id_outside_diagnosis_range_low_twice) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID);
- EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID, its_client_id);
+ // preconfigured is already taken -> autogenerated ID should be returned
+ auto app2 = std::make_shared<app_wrapper>(APPLICATION_OUT_HIGH_NAME);
+ EXPECT_EQ(client_id_base_ | 0x1, app2->get_client());
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_2);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
+ auto app3 = std::make_shared<app_wrapper>(APPLICATION_OUT_HIGH_NAME);
+ EXPECT_EQ(client_id_base_ | 0x2, app3->get_client());
}
TEST_F(client_id_utility_test,
- request_different_client_id_with_predefined_app_name_outside_diagnosis_range_low) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID + 1u);
- // has to get predefined client id although other was requested
- EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID, its_client_id);
-
- // predefined in json is now already used and requested should be assigned
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID + 1u);
- EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID + 1u, its_client_id_2);
-
- client_t its_client_id_3 = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_3);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
- utility::release_client_id(its_client_id_3);
+ request_predefined_client_id_outside_diagnosis_range_low) {
+ auto app1 = std::make_shared<app_wrapper>(APPLICATION_OUT_LOW_NAME);
+ // we should get the client ID defined in the json file
+ EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID, app1->get_client());
}
TEST_F(client_id_utility_test,
- request_predefined_client_id_outside_diagnosis_range_high) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID);
- EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID, its_client_id);
+ request_predefined_client_id_outside_diagnosis_range_low_multiple) {
+ auto app1 = std::make_shared<app_wrapper>(APPLICATION_OUT_LOW_NAME);
+ // we should get the client ID defined in the json file
+ EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID, app1->get_client());
- utility::release_client_id(its_client_id);
+ // preconfigured is already taken -> autogenerated ID should be returned
+ auto app2 = std::make_shared<app_wrapper>(APPLICATION_OUT_LOW_NAME);
+ EXPECT_EQ(client_id_base_ | 0x1, app2->get_client());
+
+ auto app3 = std::make_shared<app_wrapper>(APPLICATION_OUT_LOW_NAME);
+ EXPECT_EQ(client_id_base_ | 0x2, app3->get_client());
}
TEST_F(client_id_utility_test,
- request_predefined_client_id_outside_diagnosis_range_high_twice) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID);
- EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID, its_client_id);
+ ensure_preconfigured_client_ids_in_diagnosis_range_dont_influence_autoconfig_client_ids)
+{
+ auto app0 = std::make_shared<app_wrapper>(APPLICATION_NAME_NOT_PREDEFINED);
+ EXPECT_EQ(client_id_base_ | 0x1, app0->get_client());
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_2);
+ auto app1 = std::make_shared<app_wrapper>(APPLICATION_IN_NAME);
+ EXPECT_EQ(APPLICATION_IN_CLIENT_ID, app1->get_client());
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
-}
+ auto app2 = std::make_shared<app_wrapper>(APPLICATION_IN_NAME_TWO);
+ EXPECT_EQ(APPLICATION_IN_CLIENT_ID_TWO, app2->get_client());
-TEST_F(client_id_utility_test,
- request_different_client_id_with_predefined_app_name_outside_diagnosis_range_high) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID + 1u);
- // has to get predefined client id although other was requested
- EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID, its_client_id);
-
- // predefined in json is now already used and requested should be assigned
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID + 1u);
- EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID + 1u, its_client_id_2);
-
- client_t its_client_id_3 = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_3);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
- utility::release_client_id(its_client_id_3);
-}
+ auto app3 = std::make_shared<app_wrapper>(APPLICATION_NAME_NOT_PREDEFINED);
+ EXPECT_EQ(client_id_base_ | 0x2, app3->get_client());
+ auto app4 = std::make_shared<app_wrapper>(APPLICATION_NAME_NOT_PREDEFINED);
+ EXPECT_EQ(client_id_base_ | 0x3, app4->get_client());
+}
TEST_F(client_id_utility_test, exhaust_client_id_range_sequential) {
- std::vector<client_t> its_client_ids;
+ std::vector<vsomeip::client_t> its_clients;
std::uint16_t its_max_clients(0);
for (int var = 0; var < __builtin_popcount(static_cast<std::uint16_t>(~diagnosis_mask_)); ++var) {
its_max_clients = static_cast<std::uint16_t>(its_max_clients | (1 << var));
}
- const std::uint16_t max_possible_clients = its_max_clients;
- // -1 for the routing manager, -2 as two predefined client IDs are present
- // in the json file which aren't assigned via autoconfiguration
- const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(max_possible_clients - 3u);
+ // -2 as two predefined client IDs are present in the json file which
+ // aren't assigned via autoconfiguration
+ const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(its_max_clients - 2u);
// acquire maximum amount of client IDs
- for (std::uint16_t i = 0; i < max_allowed_clients; i++) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- if (i > 0) {
- EXPECT_LT(its_client_ids.back(), its_client_id);
+ for (int var = 0; var < 2; ++var) {
+ for (std::uint16_t i = 0; i < max_allowed_clients; i++) {
+ const vsomeip::client_t its_client =
+ vsomeip::utility::request_client_id(configuration_,
+ APPLICATION_NAME_NOT_PREDEFINED + std::to_string(i),
+ VSOMEIP_CLIENT_UNSET);
+ if (its_client != VSOMEIP_CLIENT_UNSET) {
+ if (i > 0) {
+ EXPECT_LT(its_clients.back(), its_client);
+ }
+ its_clients.push_back(its_client);
+ } else {
+ ADD_FAILURE() << "Received VSOMEIP_CLIENT_UNSET "
+ << static_cast<std::uint32_t>(i);
}
- its_client_ids.push_back(its_client_id);
- } else {
- ADD_FAILURE()<< "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
}
- }
-
- // check limit is reached
- client_t its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
-
- // release all
- for (const client_t c : its_client_ids) {
- utility::release_client_id(c);
- }
- its_client_ids.clear();
- its_illegal_client_id = 0xFFFF;
-
- // One more time!
-
- // acquire maximum amount of client IDs
- for (std::uint16_t i = 0; i < max_allowed_clients; i++) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- its_client_ids.push_back(its_client_id);
- } else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
- }
- }
-
- // check limit is reached
- its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
-
- // release all
- for (const client_t c : its_client_ids) {
- utility::release_client_id(c);
+ // check limit is reached
+ EXPECT_EQ(VSOMEIP_CLIENT_UNSET, vsomeip::utility::request_client_id(
+ configuration_, APPLICATION_NAME_NOT_PREDEFINED + "max",
+ VSOMEIP_CLIENT_UNSET));
+ for (const auto c : its_clients) {
+ utility::release_client_id(c);
+ }
}
}
TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented) {
- std::vector<client_t> its_client_ids;
+ std::vector<client_t> its_clients;
- // -1 for the routing manager, -2 as two predefined client IDs are present
- // in the json file which aren't assigned via autoconfiguration
+ // -2 as two predefined client IDs are present in the json file which
+ // aren't assigned via autoconfiguration
std::uint16_t its_max_clients(0);
for (int var = 0; var < __builtin_popcount(static_cast<std::uint16_t>(~diagnosis_mask_)); ++var) {
its_max_clients = static_cast<std::uint16_t>(its_max_clients | (1 << var));
}
- const std::uint16_t max_possible_clients = its_max_clients;
- const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(max_possible_clients - 3u);
-
- // acquire maximum amount of client IDs
- for (std::uint16_t i = 0; i < max_allowed_clients; i++) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- if (i > 0) {
- EXPECT_LT(its_client_ids.back(), its_client_id);
+ const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(its_max_clients - 2u);
+
+ for (int var = 0; var < 2; ++var) {
+ // acquire maximum amount of client IDs
+ for (std::uint16_t i = 0; i < max_allowed_clients; i++) {
+ const vsomeip::client_t its_client =
+ vsomeip::utility::request_client_id(configuration_,
+ APPLICATION_NAME_NOT_PREDEFINED + std::to_string(i),
+ VSOMEIP_CLIENT_UNSET);
+ if (its_client != VSOMEIP_CLIENT_UNSET) {
+ if ((var == 0 && i > 0) ||
+ (var == 1 && i > 1) // special case as in the 1st run the last assigned client ID was 63fe
+ // due to the releases. In the 2nd run the first client ID therefore will be 63ff
+ ) {
+ EXPECT_LT(its_clients.back(), its_client);
+ }
+ its_clients.push_back(its_client);
+ } else {
+ ADD_FAILURE() << "Received VSOMEIP_CLIENT_UNSET "
+ << static_cast<std::uint32_t>(i);
}
- its_client_ids.push_back(its_client_id);
- } else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
}
- }
- // check limit is reached
- client_t its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
-
- // release every second requested client ID
- std::vector<client_t> its_released_client_ids;
- for (size_t i = 0; i < its_client_ids.size(); i++ ) {
- if (i % 2) {
- its_released_client_ids.push_back(its_client_ids[i]);
- utility::release_client_id(its_client_ids[i]);
+ // check limit is reached
+ EXPECT_EQ(VSOMEIP_CLIENT_UNSET, vsomeip::utility::request_client_id(
+ configuration_, APPLICATION_NAME_NOT_PREDEFINED + "max",
+ VSOMEIP_CLIENT_UNSET));
+
+ // release every second requested client ID
+ std::vector<client_t> its_released_client_ids;
+ for (size_t i = 0; i < its_clients.size(); i++ ) {
+ if (i % 2) {
+ its_released_client_ids.push_back(its_clients[i]);
+ utility::release_client_id(its_clients[i]);
+ }
}
- }
- for (const client_t c : its_released_client_ids) {
- for (auto it = its_client_ids.begin(); it != its_client_ids.end(); ) {
- if (*it == c) {
- it = its_client_ids.erase(it);
- } else {
- ++it;
+ for (const client_t c : its_released_client_ids) {
+ for (auto it = its_clients.begin(); it != its_clients.end(); ) {
+ if (*it == c) {
+ it = its_clients.erase(it);
+ } else {
+ ++it;
+ }
}
}
- }
- // acquire client IDs up to the maximum allowed amount again
- for (std::uint16_t i = 0; i < its_released_client_ids.size(); i++) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- if (i > 0) {
- EXPECT_LT(its_client_ids.back(), its_client_id);
+ // acquire client IDs up to the maximum allowed amount again
+ for (std::uint16_t i = 0; i < its_released_client_ids.size(); i++) {
+ const vsomeip::client_t its_client =
+ vsomeip::utility::request_client_id(configuration_,
+ APPLICATION_NAME_NOT_PREDEFINED + std::to_string(i),
+ VSOMEIP_CLIENT_UNSET);
+ if (its_client != VSOMEIP_CLIENT_UNSET) {
+ if (i > 0) {
+ EXPECT_LT(its_clients.back(), its_client);
+ }
+ its_clients.push_back(its_client);
+ } else {
+ ADD_FAILURE() << "Received VSOMEIP_CLIENT_UNSET "
+ << static_cast<std::uint32_t>(i);
}
- its_client_ids.push_back(its_client_id);
- } else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
}
- }
- // check limit is reached
- its_illegal_client_id = 0xFFFF;
- its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
+ // check limit is reached
+ EXPECT_EQ(VSOMEIP_CLIENT_UNSET, vsomeip::utility::request_client_id(
+ configuration_, APPLICATION_NAME_NOT_PREDEFINED + "max2",
+ VSOMEIP_CLIENT_UNSET));
- // release all
- for (const client_t c : its_client_ids) {
- utility::release_client_id(c);
+ // release all
+ for (const auto c : its_clients) {
+ utility::release_client_id(c);
+ }
+ its_clients.clear();
}
}
@@ -496,23 +416,29 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented_extended) {
for (int var = 0; var < __builtin_popcount(static_cast<std::uint16_t>(~diagnosis_mask_)); ++var) {
its_max_clients = static_cast<std::uint16_t>(its_max_clients | (1 << var));
}
+ const std::uint16_t its_diagnosis_mask = configuration_->get_diagnosis_mask();
+ const std::uint16_t its_client_mask = static_cast<std::uint16_t>(~its_diagnosis_mask);
+ const client_t its_masked_diagnosis_address = static_cast<client_t>(
+ (configuration_->get_diagnosis_address() << 8) & its_diagnosis_mask);
+ const client_t its_biggest_client = its_masked_diagnosis_address | its_client_mask;
+
const std::uint16_t max_possible_clients = its_max_clients;
const std::uint16_t intermediate_release = 3;
- const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(max_possible_clients - 3u);
-
+ const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(max_possible_clients - 2u);
// acquire (almost) maximum amount of client IDs
for (std::uint16_t i = 0; i < max_allowed_clients - intermediate_release; i++) {
client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
+ APPLICATION_NAME_NOT_PREDEFINED + std::to_string(i),
+ VSOMEIP_CLIENT_UNSET);
+ EXPECT_NE(VSOMEIP_CLIENT_UNSET, its_client_id);
+ if (its_client_id != VSOMEIP_CLIENT_UNSET) {
if (i > 0) {
EXPECT_LT(its_client_ids.back(), its_client_id);
}
its_client_ids.push_back(its_client_id);
} else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
+ ADD_FAILURE() << "Received VSOMEIP_CLIENT_UNSET "
<< static_cast<std::uint32_t>(i);
}
}
@@ -528,13 +454,15 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented_extended) {
// acquire some more client IDs, these should be bigger than the already acquired
for (std::uint16_t i = 0; i < intermediate_release; i++) {
client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
+ APPLICATION_NAME_NOT_PREDEFINED + std::to_string(i)
+ + "intermediate",
+ VSOMEIP_CLIENT_UNSET);
+ EXPECT_NE(VSOMEIP_CLIENT_UNSET, its_client_id);
+ if (its_client_id != VSOMEIP_CLIENT_UNSET) {
EXPECT_LT(its_client_ids.back(), its_client_id);
its_client_ids.push_back(its_client_id);
} else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
+ ADD_FAILURE() << "Received VSOMEIP_CLIENT_UNSET "
<< static_cast<std::uint32_t>(i);
}
}
@@ -542,9 +470,10 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented_extended) {
// check correct wrap around of client IDs
for (std::uint16_t i = 0; i < intermediate_release; i++) {
client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
+ APPLICATION_NAME_NOT_PREDEFINED + std::to_string(i),
+ VSOMEIP_CLIENT_UNSET);
+ EXPECT_NE(VSOMEIP_CLIENT_UNSET, its_client_id);
+ if (its_client_id != VSOMEIP_CLIENT_UNSET) {
if (i == 0) {
EXPECT_GT(its_client_ids.back(), its_client_id);
} else {
@@ -552,15 +481,15 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented_extended) {
}
its_client_ids.push_back(its_client_id);
} else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
+ ADD_FAILURE() << "Received VSOMEIP_CLIENT_UNSET "
<< static_cast<std::uint32_t>(i);
}
}
// check limit is reached
client_t its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
+ APPLICATION_NAME_NOT_PREDEFINED, VSOMEIP_CLIENT_UNSET);
+ EXPECT_EQ(VSOMEIP_CLIENT_UNSET, its_illegal_client_id);
// release every second requested client ID
std::vector<client_t> its_released_client_ids;
@@ -583,15 +512,16 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented_extended) {
// acquire client IDs up to the maximum allowed amount again
for (std::uint16_t i = 0; i < its_released_client_ids.size(); i++) {
client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- if (i > 0) {
+ APPLICATION_NAME_NOT_PREDEFINED + std::to_string(i),
+ VSOMEIP_CLIENT_UNSET);
+ EXPECT_NE(VSOMEIP_CLIENT_UNSET, its_client_id);
+ if (its_client_id != VSOMEIP_CLIENT_UNSET) {
+ if (i > 0 && its_client_ids.back() != its_biggest_client) {
EXPECT_LT(its_client_ids.back(), its_client_id);
}
its_client_ids.push_back(its_client_id);
} else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
+ ADD_FAILURE() << "Received VSOMEIP_CLIENT_UNSET "
<< static_cast<std::uint32_t>(i);
}
}
@@ -599,8 +529,8 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented_extended) {
// check limit is reached
its_illegal_client_id = 0xFFFF;
its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
+ APPLICATION_NAME_NOT_PREDEFINED, VSOMEIP_CLIENT_UNSET);
+ EXPECT_EQ(VSOMEIP_CLIENT_UNSET, its_illegal_client_id);
// release all
for (const client_t c : its_client_ids) {
@@ -617,20 +547,20 @@ TEST_F(client_id_utility_test, request_released_client_id_after_maximum_client_i
const std::uint16_t max_possible_clients = its_max_clients;
// -1 for the routing manager, -2 as two predefined client IDs are present
// in the json file which aren't assigned via autoconfiguration
- const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(max_possible_clients - 3u);
+ const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(max_possible_clients - 2u);
// acquire (almost) maximum amount of client IDs
for (std::uint16_t i = 0; i < max_allowed_clients - 1; i++) {
client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
+ APPLICATION_NAME_NOT_PREDEFINED, VSOMEIP_CLIENT_UNSET);
+ EXPECT_NE(VSOMEIP_CLIENT_UNSET, its_client_id);
+ if (its_client_id != VSOMEIP_CLIENT_UNSET) {
if (i > 0) {
EXPECT_LT(its_client_ids.back(), its_client_id);
}
its_client_ids.push_back(its_client_id);
} else {
- ADD_FAILURE()<< "Received ILLEGAL_CLIENT "
+ ADD_FAILURE()<< "Received VSOMEIP_CLIENT_UNSET "
<< static_cast<std::uint32_t>(i);
}
}
@@ -640,27 +570,27 @@ TEST_F(client_id_utility_test, request_released_client_id_after_maximum_client_i
// requesting an ID should return the maximum possible ID
client_t its_max_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_max_client_id);
+ APPLICATION_NAME_NOT_PREDEFINED, VSOMEIP_CLIENT_UNSET);
+ EXPECT_NE(VSOMEIP_CLIENT_UNSET, its_max_client_id);
its_client_ids.push_back(its_max_client_id);
// requesting an ID should work as we have released one before
client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
+ APPLICATION_NAME_NOT_PREDEFINED, VSOMEIP_CLIENT_UNSET);
+ EXPECT_NE(VSOMEIP_CLIENT_UNSET, its_client_id);
its_client_ids.push_back(its_client_id);
// requesting an ID should not work as all IDs are in use now
client_t its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
+ APPLICATION_NAME_NOT_PREDEFINED, VSOMEIP_CLIENT_UNSET);
+ EXPECT_EQ(VSOMEIP_CLIENT_UNSET, its_illegal_client_id);
// release another ID
utility::release_client_id(its_client_ids[5]);
its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
+ APPLICATION_NAME_NOT_PREDEFINED, VSOMEIP_CLIENT_UNSET);
+ EXPECT_NE(VSOMEIP_CLIENT_UNSET, its_client_id);
its_client_ids.push_back(its_client_id);
// release all
diff --git a/test/client_id_tests/client_id_test_utility.json b/test/client_id_tests/client_id_test_utility.json
index e928b05..e07eb9a 100644
--- a/test/client_id_tests/client_id_test_utility.json
+++ b/test/client_id_tests/client_id_test_utility.json
@@ -31,5 +31,5 @@
"id":"0x7411"
}
],
- "routing":"vsomeipd"
+ "routing":"routingmanagerd"
}
diff --git a/test/client_id_tests/client_id_test_utility_discontinuous_masked_511.json b/test/client_id_tests/client_id_test_utility_discontinuous_masked_511.json
index 4195bad..af3dfd6 100644
--- a/test/client_id_tests/client_id_test_utility_discontinuous_masked_511.json
+++ b/test/client_id_tests/client_id_test_utility_discontinuous_masked_511.json
@@ -32,5 +32,5 @@
"id":"0x7411"
}
],
- "routing":"vsomeipd"
+ "routing":"routingmanagerd"
}
diff --git a/test/client_id_tests/client_id_test_utility_masked_127.json b/test/client_id_tests/client_id_test_utility_masked_127.json
index c7c255b..8aa5135 100644
--- a/test/client_id_tests/client_id_test_utility_masked_127.json
+++ b/test/client_id_tests/client_id_test_utility_masked_127.json
@@ -32,5 +32,5 @@
"id":"0x7411"
}
],
- "routing":"vsomeipd"
+ "routing":"routingmanagerd"
}
diff --git a/test/client_id_tests/client_id_test_utility_masked_4095.json b/test/client_id_tests/client_id_test_utility_masked_4095.json
index dfc42c0..8604435 100644
--- a/test/client_id_tests/client_id_test_utility_masked_4095.json
+++ b/test/client_id_tests/client_id_test_utility_masked_4095.json
@@ -11,7 +11,7 @@
},
"dlt":"false"
},
- "diagnosis":"0x63",
+ "diagnosis":"0x60",
"diagnosis_mask":"0xF000",
"applications":
[
@@ -32,5 +32,5 @@
"id":"0x7411"
}
],
- "routing":"vsomeipd"
+ "routing":"routingmanagerd"
}
diff --git a/test/client_id_tests/client_id_test_utility_masked_511.json b/test/client_id_tests/client_id_test_utility_masked_511.json
index 274a5e0..a57d382 100644
--- a/test/client_id_tests/client_id_test_utility_masked_511.json
+++ b/test/client_id_tests/client_id_test_utility_masked_511.json
@@ -11,7 +11,7 @@
},
"dlt":"false"
},
- "diagnosis":"0x63",
+ "diagnosis":"0x62",
"diagnosis_mask":"0xFE00",
"applications":
[
@@ -32,5 +32,5 @@
"id":"0x7411"
}
],
- "routing":"vsomeipd"
+ "routing":"routingmanagerd"
}
diff --git a/test/configuration_tests/configuration-test-deprecated.json b/test/configuration_tests/configuration-test-deprecated.json
index ecbe43b..f9b23d8 100644
--- a/test/configuration_tests/configuration-test-deprecated.json
+++ b/test/configuration_tests/configuration-test-deprecated.json
@@ -306,7 +306,6 @@
"policies" :
[
{
- "client" : "0x1277",
"credentials" : { "uid" : "1000", "gid" : "1000" },
"allow" :
{
@@ -328,7 +327,7 @@
}
},
{
- "client" : { "first" : "0x1343", "last" : "0x1346" },
+ "credentials" : { "uid" : "2000", "gid" : "2000" },
"allow" :
{
"requests":
@@ -364,7 +363,7 @@
}
},
{
- "client" : { "first" : "0x1443", "last" : "0x1446" },
+ "credentials" : { "uid" : "4000", "gid" : "4000" },
"deny" :
{
"requests":
@@ -397,19 +396,19 @@
}
},
{
- "client" : "0x1550",
+ "credentials" : { "uid" : "5000", "gid" : "5000" },
"deny" :
{
}
},
{
- "client" : "0x1660",
+ "credentials" : { "uid" : "6000", "gid" : "6000" },
"allow" :
{
}
},
{
- "client" : "0x1770",
+ "credentials" : { "uid" : "7000", "gid" : "7000" },
"deny" :
{
"requests":
@@ -427,7 +426,7 @@
}
},
{
- "client" : "0x1880",
+ "credentials" : { "uid" : "8000", "gid" : "8000" },
"allow" :
{
"requests":
@@ -443,6 +442,23 @@
}
]
}
+ },
+ {
+ "credentials" : {
+ "allow": [
+ {
+ "uid": [
+ "9000"
+ ],
+ "gid": [
+ "9000"
+ ]
+ }
+ ]
+ },
+ "deny" :
+ {
+ }
}
]
},
diff --git a/test/configuration_tests/configuration-test.cpp b/test/configuration_tests/configuration-test.cpp
index c84af38..558cd4e 100644
--- a/test/configuration_tests/configuration-test.cpp
+++ b/test/configuration_tests/configuration-test.cpp
@@ -10,13 +10,15 @@
#include <vsomeip/constants.hpp>
#include <vsomeip/plugins/application_plugin.hpp>
-
+#include <vsomeip/internal/logger.hpp>
#include "../implementation/configuration/include/configuration.hpp"
-#include "../implementation/configuration/include/configuration_impl.hpp"
-#include "../implementation/logging/include/logger.hpp"
-#include "../implementation/configuration/include/policy.hpp"
-#include "../implementation/plugin/include/plugin_manager.hpp"
+#include "../../implementation/plugin/include/plugin_manager_impl.hpp"
+#include "../../implementation/configuration/include/configuration_impl.hpp"
+#include "../../implementation/configuration/include/configuration_plugin.hpp"
+#include "../../implementation/security/include/security_impl.hpp"
+
+namespace vsomeip = vsomeip_v3;
#define CONFIGURATION_FILE "configuration-test.json"
#define DEPRECATED_CONFIGURATION_FILE "configuration-test-deprecated.json"
@@ -125,23 +127,34 @@ void check_file(const std::string &_config_file,
const std::string &_expected_protocol,
const std::string &_expected_multicast,
uint16_t _expected_port,
- int32_t _expected_initial_delay_min,
- int32_t _expected_initial_delay_max,
+ uint32_t _expected_initial_delay_min,
+ uint32_t _expected_initial_delay_max,
int32_t _expected_repetitions_base_delay,
uint8_t _expected_repetitions_max,
vsomeip::ttl_t _expected_ttl,
vsomeip::ttl_t _expected_cyclic_offer_delay,
vsomeip::ttl_t _expected_request_response_delay) {
- // 0. Create configuration object
+
+ // 0. Set environment variable to config file and load it
+#ifndef _WIN32
+ setenv("VSOMEIP_CONFIGURATION", _config_file.c_str(), 1);
+#else
+ _putenv_s("VSOMEIP_CONFIGURATION", _config_file.c_str()
+#endif
+
+ // 1. Create configuration object
std::shared_ptr<vsomeip::configuration> its_configuration;
- auto its_plugin = vsomeip::plugin_manager::get()->get_plugin(
+ auto its_plugin = vsomeip::plugin_manager_impl::get()->get_plugin(
vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY);
if (its_plugin) {
- its_configuration = std::dynamic_pointer_cast<vsomeip::configuration>(its_plugin);
+ auto its_configuration_plugin
+ = std::dynamic_pointer_cast<vsomeip::configuration_plugin>(its_plugin);
+ if (its_configuration_plugin)
+ its_configuration = its_configuration_plugin->get_configuration(EXPECTED_ROUTING_MANAGER_HOST);
}
- // 1. Did we get a configuration object?
+ // 2. Did we get a configuration object?
if (0 == its_configuration) {
ADD_FAILURE() << "No configuration object. "
"Either memory overflow or loading error detected!";
@@ -154,14 +167,6 @@ void check_file(const std::string &_config_file,
new vsomeip::cfg::configuration_impl(its_copied_config);
delete its_new_config;
- // 2. Set environment variable to config file and load it
-#ifndef _WIN32
- setenv("VSOMEIP_CONFIGURATION", _config_file.c_str(), 1);
-#else
- _putenv_s("VSOMEIP_CONFIGURATION", _config_file.c_str()
-#endif
- its_configuration->load(EXPECTED_ROUTING_MANAGER_HOST);
-
its_configuration->set_configuration_path("/my/test/path");
// 3. Check host address
@@ -309,13 +314,13 @@ void check_file(const std::string &_config_file,
std::map<vsomeip::plugin_type_e, std::set<std::string>> its_plugins =
its_configuration->get_plugins(EXPECTED_ROUTING_MANAGER_HOST);
EXPECT_EQ(1u, its_plugins.size());
- for (const auto plugin : its_plugins) {
+ for (const auto& plugin : its_plugins) {
EXPECT_EQ(vsomeip::plugin_type_e::APPLICATION_PLUGIN, plugin.first);
- for (auto its_library : plugin.second)
+ for (const auto& its_library : plugin.second)
EXPECT_EQ(std::string("libtestlibraryname.so." + std::to_string(VSOMEIP_APPLICATION_PLUGIN_VERSION)), its_library);
}
EXPECT_EQ(vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, its_plugin->get_plugin_type());
- EXPECT_EQ("vsomeip cfg plugin", its_plugin->get_plugin_name());
+ EXPECT_EQ("vsomeip-configuration-plugin", its_plugin->get_plugin_name());
EXPECT_EQ(1u, its_plugin->get_plugin_version());
@@ -511,100 +516,102 @@ void check_file(const std::string &_config_file,
// client is not the routing manager
EXPECT_TRUE(its_configuration->check_routing_credentials(0x7777, 0x888, 0x999));
- EXPECT_TRUE(its_configuration->is_security_enabled());
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1277, 0x1234, 0x5678));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1277, 0x1235, 0x5678));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1277, 0x1236, 0x5678));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1277, 0x1236, 0x5676));
-
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1277, 0x1236, 0x5679));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1277, 0x1234, 0x5679));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1277, 0x1233, 0x5679));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1266, 0x1233, 0x5679));
+ auto its_security = vsomeip::security_impl::get();
+ EXPECT_TRUE(its_security->is_enabled());
+ EXPECT_TRUE(its_security->is_offer_allowed(1000, 1000, 0x1277, 0x1234, 0x5678));
+ EXPECT_TRUE(its_security->is_offer_allowed(1000, 1000, 0x1277, 0x1235, 0x5678));
+ EXPECT_TRUE(its_security->is_offer_allowed(1000, 1000, 0x1277, 0x1236, 0x5678));
+ EXPECT_TRUE(its_security->is_offer_allowed(1000, 1000, 0x1277, 0x1236, 0x5676));
+
+ EXPECT_FALSE(its_security->is_offer_allowed(1000, 1000, 0x1277, 0x1236, 0x5679));
+ EXPECT_FALSE(its_security->is_offer_allowed(1000, 1000, 0x1277, 0x1234, 0x5679));
+ EXPECT_FALSE(its_security->is_offer_allowed(1000, 1000, 0x1277, 0x1233, 0x5679));
+ EXPECT_FALSE(its_security->is_offer_allowed(1001, 1001, 0x1266, 0x1233, 0x5679));
// explicitly denied offers
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1443, 0x1234, 0x5678));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1443, 0x1235, 0x5678));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1443, 0x1234, 0x5679));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1443, 0x1300, 0x1));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1443, 0x1300, 0x2));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1443, 0x1236, 0x5678));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1443, 0x1236, 0x5675));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1443, 0x1236, 0x5676));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1443, 0x1236, 0x5677));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1443, 0x1236, 0x5679));
+ EXPECT_FALSE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1234, 0x5678));
+ EXPECT_FALSE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1235, 0x5678));
+ EXPECT_TRUE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1234, 0x5679));
+ EXPECT_TRUE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1300, 0x1));
+ EXPECT_TRUE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1300, 0x2));
+ EXPECT_FALSE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1236, 0x5678));
+ EXPECT_FALSE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1236, 0x5675));
+ EXPECT_FALSE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1236, 0x5676));
+ EXPECT_FALSE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1236, 0x5677));
+ EXPECT_TRUE(its_security->is_offer_allowed(4000, 4000, 0x1443, 0x1236, 0x5679));
// explicitly allowed requests of methods / events
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5678, 0x0001));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5678, 0x8002));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1346, 0x1234, 0x5688, 0x8002));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5699, 0x8006));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5699, 0x8001));
-
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1347, 0x1234, 0x5678, 0xFFFF));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1342, 0x1234, 0x5678, 0xFFFF));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5677, 0xFFFF));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5700, 0x0001));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5699, 0x8007));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5700, 0xFFFF));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1230, 0x5678, 0x0001));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1230, 0x5678, 0xFFFF));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5678, 0x0002));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1446, 0x1234, 0x5678, 0xFFFF));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5679, 0x0003));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5679, 0xFFFF));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5699, 0x9001));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5699, 0x9006));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1442, 0x1234, 0x5678, 0xFFFF));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1447, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_TRUE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1234, 0x5678, 0x0001));
+ EXPECT_TRUE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1234, 0x5678, 0x8002));
+ EXPECT_TRUE(its_security->is_client_allowed(2000, 2000, 0x1346, 0x1234, 0x5688, 0x8002));
+ EXPECT_TRUE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1234, 0x5699, 0x8006));
+ EXPECT_TRUE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1234, 0x5699, 0x8001));
+
+ EXPECT_FALSE(its_security->is_client_allowed(2001, 2001, 0x1347, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(2001, 2001, 0x1342, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1234, 0x5677, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1234, 0x5700, 0x0001));
+ EXPECT_FALSE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1234, 0x5699, 0x8007));
+ EXPECT_FALSE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1234, 0x5700, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1230, 0x5678, 0x0001));
+ EXPECT_FALSE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1230, 0x5678, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(4000, 4000, 0x1443, 0x1234, 0x5678, 0x0002));
+ EXPECT_FALSE(its_security->is_client_allowed(4000, 4000, 0x1446, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_TRUE(its_security->is_client_allowed(4000, 4000, 0x1443, 0x1234, 0x5679, 0x0003));
+ EXPECT_FALSE(its_security->is_client_allowed(4000, 4000, 0x1443, 0x1234, 0x5679, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(4000, 4000, 0x1443, 0x1234, 0x5699, 0x9001));
+ EXPECT_FALSE(its_security->is_client_allowed(4000, 4000, 0x1443, 0x1234, 0x5699, 0x9006));
+ EXPECT_FALSE(its_security->is_client_allowed(4001, 4001, 0x1442, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(4001, 4001, 0x1447, 0x1234, 0x5678, 0xFFFF));
// check that any method ID is allowed
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1343, 0x1237, 0x5678, 0x0001));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1343, 0x1237, 0x5678, 0xFFFF));
+ EXPECT_TRUE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1237, 0x5678, 0x0001));
+ EXPECT_TRUE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1237, 0x5678, 0xFFFF));
// check that any instance ID is allowed but only one method ID
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1343, 0x1238, 0x0004, 0x0001));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1238, 0x0004, 0x0002));
+ EXPECT_TRUE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1238, 0x0004, 0x0001));
+ EXPECT_FALSE(its_security->is_client_allowed(2000, 2000, 0x1343, 0x1238, 0x0004, 0x0002));
// DENY NOTHING policy
// check that ANY_METHOD is allowed in a "deny nothing" policy
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1550, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_TRUE(its_security->is_client_allowed(5000, 5000, 0x1550, 0x1234, 0x5678, 0xFFFF));
// check that specific method ID is allowed in a "deny nothing" policy
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1550, 0x1234, 0x5678, 0x0001));
+ EXPECT_TRUE(its_security->is_client_allowed(5000, 5000, 0x1550, 0x1234, 0x5678, 0x0001));
// ALLOW NOTHING policy
// check that ANY_METHOD is denied in a "allow nothing" policy
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1660, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(6000, 6000, 0x1660, 0x1234, 0x5678, 0xFFFF));
// check that specific method ID is denied in a "allow nothing" policy
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1660, 0x1234, 0x5678, 0x0001));
+ EXPECT_FALSE(its_security->is_client_allowed(6000, 6000, 0x1660, 0x1234, 0x5678, 0x0001));
// DENY only one service instance and ANY_METHOD (0x01 - 0xFFFF) policy
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1770, 0x1234, 0x5678, 0xFFFF));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1770, 0x1234, 0x5678, 0x0001));
+ EXPECT_FALSE(its_security->is_client_allowed(7000, 7000, 0x1770, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_FALSE(its_security->is_client_allowed(7000, 7000, 0x1770, 0x1234, 0x5678, 0x0001));
// allow only one service instance and ANY_METHOD policy
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1880, 0x1234, 0x5678, 0xFFFF));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1880, 0x1234, 0x5678, 0x0001));
+ EXPECT_TRUE(its_security->is_client_allowed(8000, 8000, 0x1880, 0x1234, 0x5678, 0xFFFF));
+ EXPECT_TRUE(its_security->is_client_allowed(8000, 8000, 0x1880, 0x1234, 0x5678, 0x0001));
// check request service
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1550, 0x1234, 0x5678, 0x00, true));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1660, 0x1234, 0x5678, 0x00, true));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1770, 0x1234, 0x5678, 0x00, true));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1770, 0x2222, 0x5678, 0x00, true));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1880, 0x1234, 0x5678, 0x00, true));
+ EXPECT_TRUE(its_security->is_client_allowed(5000, 5000, 0x1550, 0x1234, 0x5678, 0x00, true));
+ EXPECT_FALSE(its_security->is_client_allowed(6000, 6000, 0x1660, 0x1234, 0x5678, 0x00, true));
+ EXPECT_FALSE(its_security->is_client_allowed(7000, 7000, 0x1770, 0x1234, 0x5678, 0x00, true));
+ EXPECT_TRUE(its_security->is_client_allowed(7000, 7000, 0x1770, 0x2222, 0x5678, 0x00, true));
+ EXPECT_TRUE(its_security->is_client_allowed(8000, 8000, 0x1880, 0x1234, 0x5678, 0x00, true));
- EXPECT_TRUE(its_configuration->check_credentials(0x1277, 1000, 1000));
- EXPECT_FALSE(its_configuration->check_credentials(0x1277, 1001, 1001));
- EXPECT_FALSE(its_configuration->check_credentials(0x1278, 1000, 1000));
+ EXPECT_TRUE(its_security->check_credentials(0x1277, 1000, 1000));
+ EXPECT_FALSE(its_security->check_credentials(0x1277, 1001, 1001));
+ EXPECT_TRUE(its_security->check_credentials(0x1278, 1000, 1000));
+ EXPECT_TRUE(its_security->check_credentials(0x1278, 9000, 9000));
// Security update / removal whitelist
- EXPECT_TRUE(its_configuration->is_policy_removal_allowed(1000));
- EXPECT_TRUE(its_configuration->is_policy_removal_allowed(1001));
- EXPECT_TRUE(its_configuration->is_policy_removal_allowed(1008));
- EXPECT_TRUE(its_configuration->is_policy_removal_allowed(2000));
- EXPECT_TRUE(its_configuration->is_policy_removal_allowed(3000));
+ EXPECT_TRUE(its_security->is_policy_removal_allowed(1000));
+ EXPECT_TRUE(its_security->is_policy_removal_allowed(1001));
+ EXPECT_TRUE(its_security->is_policy_removal_allowed(1008));
+ EXPECT_TRUE(its_security->is_policy_removal_allowed(2000));
+ EXPECT_TRUE(its_security->is_policy_removal_allowed(3000));
- EXPECT_FALSE(its_configuration->is_policy_removal_allowed(2001));
- EXPECT_FALSE(its_configuration->is_policy_removal_allowed(3001));
+ EXPECT_FALSE(its_security->is_policy_removal_allowed(2001));
+ EXPECT_FALSE(its_security->is_policy_removal_allowed(3001));
// create a valid policy object that is on whitelist and test is_policy_update_allowed method
std::shared_ptr<vsomeip::policy> _policy(std::make_shared<vsomeip::policy>());
@@ -637,22 +644,22 @@ void check_file(const std::string &_config_file,
_policy->services_.insert(
std::make_pair(its_service_id, its_instance_method_ranges));
- EXPECT_TRUE(its_configuration->is_policy_update_allowed(1000, _policy));
+ EXPECT_TRUE(its_security->is_policy_update_allowed(1000, _policy));
// test valid policy that holds a single service id which is whitelisted
its_service_id = 0x7800;
_policy->services_.insert(
std::make_pair(its_service_id, its_instance_method_ranges));
- EXPECT_TRUE(its_configuration->is_policy_update_allowed(1000, _policy));
+ EXPECT_TRUE(its_security->is_policy_update_allowed(1000, _policy));
// test invalid UID which is not whitelisted
- EXPECT_FALSE(its_configuration->is_policy_update_allowed(2002, _policy));
+ EXPECT_FALSE(its_security->is_policy_update_allowed(2002, _policy));
// test invalid policy that additionally holds a service id which is not whitelisted
its_service_id = 0x8888;
_policy->services_.insert(
std::make_pair(its_service_id, its_instance_method_ranges));
- EXPECT_FALSE(its_configuration->is_policy_update_allowed(1000, _policy));
+ EXPECT_FALSE(its_security->is_policy_update_allowed(1000, _policy));
// TCP connection setting:
// max TCP connect time / max allowed number of aborted TCP endpoint restarts until forced restart
@@ -665,8 +672,8 @@ void check_file(const std::string &_config_file,
uint16_t port = its_configuration->get_sd_port();
std::string multicast = its_configuration->get_sd_multicast();
- int32_t initial_delay_min = its_configuration->get_sd_initial_delay_min();
- int32_t initial_delay_max = its_configuration->get_sd_initial_delay_max();
+ uint32_t initial_delay_min = its_configuration->get_sd_initial_delay_min();
+ uint32_t initial_delay_max = its_configuration->get_sd_initial_delay_max();
int32_t repetitions_base_delay = its_configuration->get_sd_repetitions_base_delay();
uint8_t repetitions_max = its_configuration->get_sd_repetitions_max();
vsomeip::ttl_t ttl = its_configuration->get_sd_ttl();
@@ -678,16 +685,16 @@ void check_file(const std::string &_config_file,
EXPECT_TRUE(check<std::string>(multicast, _expected_multicast, "SD MULTICAST"));
EXPECT_TRUE(check<uint16_t>(port, _expected_port, "SD PORT"));
- EXPECT_TRUE(check<int32_t>(initial_delay_min, _expected_initial_delay_min, "SD INITIAL DELAY MIN"));
- EXPECT_TRUE(check<int32_t>(initial_delay_max, _expected_initial_delay_max, "SD INITIAL DELAY MAX"));
+ EXPECT_TRUE(check<uint32_t>(initial_delay_min, _expected_initial_delay_min, "SD INITIAL DELAY MIN"));
+ EXPECT_TRUE(check<uint32_t>(initial_delay_max, _expected_initial_delay_max, "SD INITIAL DELAY MAX"));
EXPECT_TRUE(check<int32_t>(repetitions_base_delay, _expected_repetitions_base_delay, "SD REPETITION BASE DELAY"));
EXPECT_TRUE(check<uint8_t>(repetitions_max,_expected_repetitions_max, "SD REPETITION MAX"));
EXPECT_TRUE(check<vsomeip::ttl_t>(ttl, _expected_ttl, "SD TTL"));
- EXPECT_TRUE(check<int32_t>(cyclic_offer_delay, _expected_cyclic_offer_delay, "SD CYCLIC OFFER DELAY"));
- EXPECT_TRUE(check<int32_t>(request_response_delay, _expected_request_response_delay, "SD RESPONSE REQUEST DELAY"));
+ EXPECT_TRUE(check<int32_t>(cyclic_offer_delay, static_cast<int32_t>(_expected_cyclic_offer_delay), "SD CYCLIC OFFER DELAY"));
+ EXPECT_TRUE(check<int32_t>(request_response_delay, static_cast<int32_t>(_expected_request_response_delay), "SD RESPONSE REQUEST DELAY"));
EXPECT_EQ(1000u, its_configuration->get_sd_offer_debounce_time());
- ASSERT_TRUE(vsomeip::plugin_manager::get()->unload_plugin(vsomeip::plugin_type_e::CONFIGURATION_PLUGIN));
+ ASSERT_TRUE(vsomeip::plugin_manager_impl::get()->unload_plugin(vsomeip::plugin_type_e::CONFIGURATION_PLUGIN));
}
TEST(configuration_test, check_config_file) {
diff --git a/test/configuration_tests/configuration-test.json b/test/configuration_tests/configuration-test.json
index d1ac335..70c34e3 100644
--- a/test/configuration_tests/configuration-test.json
+++ b/test/configuration_tests/configuration-test.json
@@ -24,9 +24,9 @@
"permissions-uds" : "0222"
},
"supports_selective_broadcasts" :
- {
- "address" : "160.160.160.160"
- },
+ [
+ "160.160.160.160"
+ ],
"tracing" :
{
"enable" : "true",
@@ -100,10 +100,12 @@
"plugins" :
[
{
- "application_plugin" : "testlibraryname"
+ "name" : "testlibraryname",
+ "type" : "application_plugin"
},
{
- "intentionally_wrong_plugin" : "wrong"
+ "name" : "wrongtestlibraryname",
+ "type" : "intentionally_wrong_plugin"
}
]
},
@@ -293,7 +295,6 @@
"policies" :
[
{
- "client" : "0x1277",
"credentials" : { "uid" : "1000", "gid" : "1000" },
"allow" :
{
@@ -315,7 +316,7 @@
}
},
{
- "client" : { "first" : "0x1343", "last" : "0x1346" },
+ "credentials" : { "uid" : "2000", "gid" : "2000" },
"allow" :
{
"requests":
@@ -351,7 +352,7 @@
}
},
{
- "client" : { "first" : "0x1443", "last" : "0x1446" },
+ "credentials" : { "uid" : "4000", "gid" : "4000" },
"deny" :
{
"requests":
@@ -384,19 +385,19 @@
}
},
{
- "client" : "0x1550",
+ "credentials" : { "uid" : "5000", "gid" : "5000" },
"deny" :
{
}
},
{
- "client" : "0x1660",
+ "credentials" : { "uid" : "6000", "gid" : "6000" },
"allow" :
{
}
},
{
- "client" : "0x1770",
+ "credentials" : { "uid" : "7000", "gid" : "7000" },
"deny" :
{
"requests":
@@ -414,7 +415,7 @@
}
},
{
- "client" : "0x1880",
+ "credentials" : { "uid" : "8000", "gid" : "8000" },
"allow" :
{
"requests":
@@ -430,6 +431,23 @@
}
]
}
+ },
+ {
+ "credentials" : {
+ "allow": [
+ {
+ "uid": [
+ "9000"
+ ],
+ "gid": [
+ "9000"
+ ]
+ }
+ ]
+ },
+ "deny" :
+ {
+ }
}
]
},
diff --git a/test/cpu_load_tests/conf/cpu_load_test_client_master.json.in b/test/cpu_load_tests/conf/cpu_load_test_client_master.json.in
index d623758..ec9dcd7 100644
--- a/test/cpu_load_tests/conf/cpu_load_test_client_master.json.in
+++ b/test/cpu_load_tests/conf/cpu_load_test_client_master.json.in
@@ -21,6 +21,12 @@
"id" : "0x2222"
}
],
+ "npdu-default-timings" : {
+ "debounce-time-request" : "0",
+ "debounce-time-response" : "0",
+ "max-retention-time-request" : "0",
+ "max-retention-time-response" : "0"
+ },
"routing" : "cpu_load_test_client",
"service-discovery" :
{
diff --git a/test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in b/test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in
index 36de379..4da82f4 100644
--- a/test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in
+++ b/test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in
@@ -21,6 +21,12 @@
"id" : "0x2222"
}
],
+ "npdu-default-timings" : {
+ "debounce-time-request" : "0",
+ "debounce-time-response" : "0",
+ "max-retention-time-request" : "0",
+ "max-retention-time-response" : "0"
+ },
"routing" : "cpu_load_test_client",
"service-discovery" :
{
diff --git a/test/cpu_load_tests/conf/cpu_load_test_service_master.json.in b/test/cpu_load_tests/conf/cpu_load_test_service_master.json.in
index d836650..da34e22 100644
--- a/test/cpu_load_tests/conf/cpu_load_test_service_master.json.in
+++ b/test/cpu_load_tests/conf/cpu_load_test_service_master.json.in
@@ -34,7 +34,12 @@
}
}
],
-
+ "npdu-default-timings" : {
+ "debounce-time-request" : "0",
+ "debounce-time-response" : "0",
+ "max-retention-time-request" : "0",
+ "max-retention-time-response" : "0"
+ },
"routing" : "cpu_load_test_service",
"service-discovery" :
{
diff --git a/test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in b/test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in
index 78e1909..389aea0 100644
--- a/test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in
+++ b/test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in
@@ -34,7 +34,12 @@
}
}
],
-
+ "npdu-default-timings" : {
+ "debounce-time-request" : "0",
+ "debounce-time-response" : "0",
+ "max-retention-time-request" : "0",
+ "max-retention-time-response" : "0"
+ },
"routing" : "cpu_load_test_service",
"service-discovery" :
{
diff --git a/test/cpu_load_tests/cpu_load_measurer.cpp b/test/cpu_load_tests/cpu_load_measurer.cpp
index 2261d22..d4360b3 100644
--- a/test/cpu_load_tests/cpu_load_measurer.cpp
+++ b/test/cpu_load_tests/cpu_load_measurer.cpp
@@ -113,7 +113,8 @@ std::uint64_t cpu_load_measurer::read_proc_pid_stat() {
exit(1);
}
std::fclose(f);
- return utime + stime + cutime + cstime;
+ return utime + stime + static_cast<std::uint64_t>(cutime) +
+ static_cast<std::uint64_t>(cstime);
}
std::uint64_t cpu_load_measurer::read_proc_stat(std::uint64_t* _idle) {
diff --git a/test/cpu_load_tests/cpu_load_test_client.cpp b/test/cpu_load_tests/cpu_load_test_client.cpp
index 94fd98b..6cc0571 100644
--- a/test/cpu_load_tests/cpu_load_test_client.cpp
+++ b/test/cpu_load_tests/cpu_load_test_client.cpp
@@ -17,7 +17,7 @@
#include <atomic>
#include "cpu_load_test_globals.hpp"
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "cpu_load_measurer.hpp"
// for getpid
@@ -212,14 +212,14 @@ private:
void send_messages_sync(std::unique_lock<std::mutex>& lk, std::uint32_t _messages_to_send) {
- cpu_load_measurer c(::getpid());
+ cpu_load_measurer c(static_cast<std::uint32_t>(::getpid()));
send_service_start_measuring(true);
c.start();
for (number_of_sent_messages_ = 0;
number_of_sent_messages_ < _messages_to_send;
number_of_sent_messages_++, number_of_sent_messages_total_++)
{
- app_->send(request_, true);
+ app_->send(request_);
// wait until the send messages has been acknowledged
while(wait_for_all_msg_acknowledged_) {
all_msg_acknowledged_cv_.wait(lk);
@@ -237,14 +237,14 @@ private:
}
void send_messages_async(std::unique_lock<std::mutex>& lk, std::uint32_t _messages_to_send) {
- cpu_load_measurer c(::getpid());
+ cpu_load_measurer c(static_cast<std::uint32_t>(::getpid()));
send_service_start_measuring(true);
c.start();
for (number_of_sent_messages_ = 0;
number_of_sent_messages_ < _messages_to_send;
number_of_sent_messages_++, number_of_sent_messages_total_++)
{
- app_->send(request_, true);
+ app_->send(request_);
if((number_of_sent_messages_+1) % sliding_window_size_ == 0)
{
// wait until all send messages have been acknowledged
diff --git a/test/cpu_load_tests/cpu_load_test_master_starter.sh b/test/cpu_load_tests/cpu_load_test_master_starter.sh
index 50bf007..d4c96be 100755
--- a/test/cpu_load_tests/cpu_load_test_master_starter.sh
+++ b/test/cpu_load_tests/cpu_load_test_master_starter.sh
@@ -19,9 +19,9 @@ sleep 1
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting cpu load 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/test; ./cpu_load_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; ./cpu_load_test_slave_starter.sh"' &
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name cltms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./cpu_load_test_slave_starter.sh" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./cpu_load_test_slave_starter.sh" &
else
cat <<End-of-message
*******************************************************************************
@@ -66,11 +66,6 @@ do
wait $job || FAIL=$(($FAIL+1))
done
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop cltms
- docker rm cltms
-fi
-
# Check if both exited successfully
if [ $FAIL -eq 0 ]
then
diff --git a/test/cpu_load_tests/cpu_load_test_service.cpp b/test/cpu_load_tests/cpu_load_test_service.cpp
index 6d21752..35e6c1e 100644
--- a/test/cpu_load_tests/cpu_load_test_service.cpp
+++ b/test/cpu_load_tests/cpu_load_test_service.cpp
@@ -15,7 +15,7 @@
#include <cmath> // for isfinite
#include "cpu_load_test_globals.hpp"
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "cpu_load_measurer.hpp"
// for getpid
@@ -31,7 +31,7 @@ public:
blocked_(false),
number_of_received_messages_(0),
number_of_received_messages_total_(0),
- load_measurer_(::getpid()),
+ load_measurer_(static_cast<std::uint32_t>(::getpid())),
offer_thread_(std::bind(&cpu_load_test_service::run, this))
{
}
@@ -118,7 +118,7 @@ public:
number_of_received_messages_++;
number_of_received_messages_total_++;
// send response
- app_->send(vsomeip::runtime::get()->create_response(_request), true);
+ app_->send(vsomeip::runtime::get()->create_response(_request));
}
void on_message_start_measuring(const std::shared_ptr<vsomeip::message>& _request)
diff --git a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_client.cpp b/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_client.cpp
deleted file mode 100644
index a3e6e5e..0000000
--- a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_client.cpp
+++ /dev/null
@@ -1,748 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <cstring>
-
-#include <gtest/gtest.h>
-
-#ifndef _WIN32
-#include <signal.h>
-#endif
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "../debug_diag_job_plugin_tests/debug_diag_job_plugin_test_globals.hpp"
-class debug_diag_job_plugin_test_client;
-static debug_diag_job_plugin_test_client* the_client;
-extern "C" void signal_handler(int _signum);
-
-
-enum class debug_diag_job_app_error_type_e : std::uint32_t {
- ET_UNKNOWN = 0,
- ET_OK = 256,
- ET_OUT_OF_RANGE = 257,
- ET_E_COMMUNICATION_ERROR = 576,
-};
-
-class debug_diag_job_plugin_test_client {
-public:
- debug_diag_job_plugin_test_client(
- std::array<debug_diag_job_plugin_test::service_info, 3> _service_infos_local,
- std::array<debug_diag_job_plugin_test::service_info, 3> _service_infos_remote) :
- service_infos_local_(_service_infos_local),
- service_infos_remote_(_service_infos_remote),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- wait_until_remote_services_available_(true),
- wait_until_debug_diag_job_service_available_(true),
- wait_until_local_services_available_(true),
- wait_until_local_services_unavailable_(true),
- wait_until_notifications_received_(true),
- wait_until_responses_received_(true),
- wait_until_debug_diag_job_response_received_(true),
- wait_for_stop_(true),
- last_response_(debug_diag_job_app_error_type_e::ET_UNKNOWN),
- stop_thread_(std::bind(&debug_diag_job_plugin_test_client::wait_for_stop, this)),
- run_thread_(std::bind(&debug_diag_job_plugin_test_client::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
-
- // register signal handler
- the_client = this;
- struct sigaction sa_new, sa_old;
- sa_new.sa_handler = signal_handler;
- sa_new.sa_flags = 0;
- sigemptyset(&sa_new.sa_mask);
- ::sigaction(SIGUSR1, &sa_new, &sa_old);
- ::sigaction(SIGINT, &sa_new, &sa_old);
- ::sigaction(SIGTERM, &sa_new, &sa_old);
- ::sigaction(SIGABRT, &sa_new, &sa_old);
-
- app_->register_state_handler(
- std::bind(&debug_diag_job_plugin_test_client::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&debug_diag_job_plugin_test_client::on_message, this,
- std::placeholders::_1));
-
- for (const auto& serviceinfos : {service_infos_remote_, service_infos_local_}) {
- for (const auto& serviceinfo : serviceinfos) {
- if (serviceinfo.service_id == 0xFFFF && serviceinfo.instance_id == 0xFFFF) {
- continue;
- }
- service_infos_.push_back(serviceinfo);
- }
- }
-
- // register availability for all other services and request their event.
- for (const auto& i : service_infos_) {
- app_->register_availability_handler(i.service_id, i.instance_id,
- std::bind(&debug_diag_job_plugin_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(i.service_id, i.instance_id);
-
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(i.eventgroup_id);
- app_->request_event(i.service_id, i.instance_id,
- static_cast<vsomeip::event_t>(i.event_id),
- its_eventgroups, true);
-
- other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
-
- app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id);
- other_services_received_notification_[std::make_pair(i.service_id, i.event_id)] = 0;
- other_services_received_response_[std::make_pair(i.service_id, i.instance_id)] = 0;
- }
-
- for (const auto& si : service_infos_local_) {
- if (si.service_id == 0xFFFF && si.instance_id == 0xFFFF) {
- continue;
- }
- other_local_services_available_[std::make_pair(si.service_id, si.instance_id)] = false;
- other_local_services_received_notification_[std::make_pair(si.service_id, si.event_id)] = 0;
- }
-
- for (const auto& si : service_infos_remote_) {
- if (si.service_id == 0xFFFF && si.instance_id == 0xFFFF) {
- continue;
- }
- other_remote_services_available_[std::make_pair(si.service_id, si.instance_id)] = false;
- other_remote_services_received_notification_[std::make_pair(si.service_id, si.event_id)] = 0;
- }
- app_->register_availability_handler(
- debug_diag_job_plugin_test::debug_diag_job_serviceinfo.service_id,
- debug_diag_job_plugin_test::debug_diag_job_serviceinfo.instance_id,
- std::bind(&debug_diag_job_plugin_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(
- debug_diag_job_plugin_test::debug_diag_job_serviceinfo.service_id,
- debug_diag_job_plugin_test::debug_diag_job_serviceinfo.instance_id,
- 0x1, vsomeip::ANY_MINOR);
-
- app_->start();
- }
-
- ~debug_diag_job_plugin_test_client() {
- run_thread_.join();
- stop_thread_.join();
-
- }
-
- void on_state(vsomeip::state_type_e _state) {
- VSOMEIP_INFO << "Application " << app_->get_name() << " is "
- << (_state == vsomeip::state_type_e::ST_REGISTERED ?
- "registered." : "deregistered.");
-
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- if(_is_available) {
- for (auto available_map : {&other_services_available_,
- &other_local_services_available_,
- &other_remote_services_available_}) {
- auto its_service = available_map->find(std::make_pair(_service, _instance));
- if (its_service != available_map->end()) {
- if (its_service->second != _is_available) {
- its_service->second = true;
- VSOMEIP_DEBUG << "Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is available.";
- }
- }
- }
-
- if (std::all_of(other_remote_services_available_.cbegin(),
- other_remote_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return v.second;})) {
- VSOMEIP_INFO << " all remote services are available.";
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_remote_services_available_ = false;
- condition_.notify_one();
- }
-
- if (_service == debug_diag_job_plugin_test::debug_diag_job_serviceinfo.service_id &&
- _instance == debug_diag_job_plugin_test::debug_diag_job_serviceinfo.instance_id) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_debug_diag_job_service_available_ = false;
- condition_.notify_one();
- }
-
- if (std::all_of(other_local_services_available_.cbegin(),
- other_local_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return v.second;})) {
- VSOMEIP_INFO << "all local services are available.";
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_local_services_available_ = false;
- condition_.notify_one();
- }
-
- if (std::all_of(other_services_available_.cbegin(),
- other_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return v.second;})) {
- VSOMEIP_INFO << "all local and remote services are available.";
- }
- } else {
- bool was_available_before(false);
- auto its_service = other_local_services_available_.find(std::make_pair(_service, _instance));
- if (its_service != other_local_services_available_.end()) {
- if (its_service->second) {
- its_service->second = false;
- VSOMEIP_DEBUG << "Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is not available anymore.";
- was_available_before = true;
- }
- }
- if (was_available_before) {
- if (std::all_of(other_local_services_available_.cbegin(),
- other_local_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return !v.second;})) {
- VSOMEIP_INFO << "all local services are not available anymore.";
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_local_services_unavailable_ = false;
- condition_.notify_one();
- }
- }
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- if (_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
-
- other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())]++;
-
- VSOMEIP_DEBUG
- << "Received a notification with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] (now have: "
- << std::dec << other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())] << ")";
-
- std::shared_ptr<vsomeip::payload> its_payload(_message->get_payload());
- EXPECT_EQ(2u, its_payload->get_length());
- EXPECT_EQ((_message->get_service() & 0xFF00 ) >> 8, its_payload->get_data()[0]);
- EXPECT_EQ((_message->get_service() & 0xFF), its_payload->get_data()[1]);
- bool notify = all_notifications_received();
-
- if(notify) {
- for (auto &os : other_local_services_received_notification_) {
- os.second = 0;
- }
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_notifications_received_ = false;
- condition_.notify_one();
- }
- } else if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE &&
- _message->get_service() != debug_diag_job_plugin_test::debug_diag_job_serviceinfo.service_id) {
- other_services_received_response_[std::make_pair(_message->get_service(),
- _message->get_instance())]++;
- VSOMEIP_INFO
- << "Received a response with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] (now have: "
- << std::dec << other_services_received_response_[std::make_pair(_message->get_service(),
- _message->get_instance())] << ")";
- if (std::all_of(other_services_received_response_.begin(),
- other_services_received_response_.end(),
- [&](const std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, std::uint32_t>::value_type& v) {
- return v.second > 0;
- })) {
- VSOMEIP_INFO << "received responses of all services!";
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_responses_received_ = false;
- condition_.notify_one();
- }
- } else if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE &&
- _message->get_service() == debug_diag_job_plugin_test::debug_diag_job_serviceinfo.service_id) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_debug_diag_job_response_received_ = false;
- last_response_ = debug_diag_job_app_error_type_e::ET_UNKNOWN;
- auto its_payload = _message->get_payload();
- if (its_payload && its_payload->get_length() > 3) {
-
- last_response_ = static_cast<debug_diag_job_app_error_type_e>(
- (its_payload->get_data()[0] << 24) |
- (its_payload->get_data()[1] << 16) |
- (its_payload->get_data()[2] << 8) |
- (its_payload->get_data()[3]));
- }
- condition_.notify_one();
- }
- }
-
- bool all_notifications_received() {
- return std::all_of(
- other_services_received_notification_.cbegin(),
- other_services_received_notification_.cend(),
- [&](const std::map<std::pair<vsomeip::service_t,
- vsomeip::method_t>, std::uint32_t>::value_type& v)
- {
- if (v.second == debug_diag_job_plugin_test::notifications_to_send) {
- return true;
- } else {
- if (v.second >= debug_diag_job_plugin_test::notifications_to_send) {
- VSOMEIP_WARNING
- << " Received multiple initial events from service/instance: "
- << std::setw(4) << std::setfill('0') << std::hex << v.first.first
- << "."
- << std::setw(4) << std::setfill('0') << std::hex << v.first.second
- << " number of received events: " << v.second
- << ". This is caused by StopSubscribe/Subscribe messages and/or"
- << " service offered via UDP and TCP";
- return false;
- } else {
- return false;
- }
- }
- }
- );
- }
-
- void handle_signal(int _signum) {
- VSOMEIP_DEBUG << "Catched signal, going down ("
- << std::dec <<_signum << ")";
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
-
- void wait_for_stop() {
- {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "going down";
- }
- for (const auto& i : service_infos_) {
- if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) {
- continue;
- }
- app_->unsubscribe(i.service_id, i.instance_id, i.eventgroup_id);
- app_->release_event(i.service_id, i.instance_id, i.event_id);
- app_->release_service(i.service_id, i.instance_id);
- }
- app_->clear_all_handler();
- app_->stop();
- }
-
- void call_debug_diag_job(bool _offer) {
- std::shared_ptr<vsomeip::message> its_request = vsomeip::runtime::get()->create_request();
- its_request->set_service(debug_diag_job_plugin_test::debug_diag_job_serviceinfo.service_id);
- its_request->set_instance(debug_diag_job_plugin_test::debug_diag_job_serviceinfo.instance_id);
- if (_offer) {
- its_request->set_method(debug_diag_job_plugin_test::debug_diag_job_serviceinfo.method_id);
- std::vector<vsomeip::byte_t> its_payload;
- for (int i =0; i<8; i++) { // handletype and size placeholder
- its_payload.push_back(0x0);
- }
- // insert valid entries
- for (const auto& si : service_infos_local_) {
- if (si.service_id == 0xFFFF && si.instance_id == 0xFFFF) {
- continue;
- }
- for (auto reliable : {false, true}) { // ensure to offer service reliable and unreliable
- // service
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.service_id >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.service_id & 0xFF));
- // instance
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.instance_id >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.instance_id & 0xFF));
- // port (use event id as port)
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.event_id >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.event_id & 0xFF));
- // reliable
- its_payload.push_back(reliable);
- // magic_cookies_enabled
- its_payload.push_back(reliable);
- }
- }
-
- std::size_t its_size = its_payload.size() - 8;
- its_payload[4] = vsomeip::byte_t(its_size >> 24 & 0xFF);
- its_payload[5] = vsomeip::byte_t(its_size >> 16 & 0xFF);
- its_payload[6] = vsomeip::byte_t(its_size >> 8 & 0xFF);
- its_payload[7] = vsomeip::byte_t(its_size & 0xFF);
-
- its_request->set_payload(vsomeip::runtime::get()->create_payload(its_payload));
- } else {
- its_request->set_method(debug_diag_job_plugin_test::debug_diag_job_serviceinfo_reset.method_id);
- }
- std::unique_lock<std::mutex> its_lock(mutex_);
- app_->send(its_request);
- while(wait_until_debug_diag_job_response_received_) {
- condition_.wait(its_lock);
- }
- EXPECT_EQ(debug_diag_job_app_error_type_e::ET_OK, last_response_);
- wait_until_debug_diag_job_response_received_ = true;
-
- }
-
- void call_debug_diag_job_wrong_message(bool _offer) {
- std::shared_ptr<vsomeip::message> its_request = vsomeip::runtime::get()->create_request();
- its_request->set_service(debug_diag_job_plugin_test::debug_diag_job_serviceinfo.service_id);
- its_request->set_instance(debug_diag_job_plugin_test::debug_diag_job_serviceinfo.instance_id);
- if (_offer) {
- its_request->set_method(debug_diag_job_plugin_test::debug_diag_job_serviceinfo.method_id);
- } else {
- its_request->set_method(debug_diag_job_plugin_test::debug_diag_job_serviceinfo_reset.method_id);
- }
- std::vector<vsomeip::byte_t> its_payload;
- for (int i =0; i<8; i++) { // handletype and size placeholder
- its_payload.push_back(0x0);
- }
- // insert valid entries
- for (const auto& si : service_infos_local_) {
- if (si.service_id == 0xFFFF && si.instance_id == 0xFFFF) {
- continue;
- }
- for (auto reliable : {false, true}) { // ensure to offer service reliable and unreliable
- // service
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.service_id >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.service_id & 0xFF));
- // instance
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.instance_id >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.instance_id & 0xFF));
- // port (use event id as port)
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.event_id >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(si.event_id & 0xFF));
- // reliable
- its_payload.push_back(reliable);
- // magic_cookies_enabled
- its_payload.push_back(reliable);
- }
- }
-
- // insert invalid entry
- // service
- its_payload.push_back(static_cast<vsomeip::byte_t>(0xAAAA >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(0xAAAA & 0xFF));
- // instance
- its_payload.push_back(static_cast<vsomeip::byte_t>(0xBBBB >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(0xBBBB & 0xFF));
- // port
- its_payload.push_back(static_cast<vsomeip::byte_t>(0xCCCC >> 8));
- its_payload.push_back(static_cast<vsomeip::byte_t>(0xCCCC & 0xFF));
- // reliable
- its_payload.push_back(0x1);
- // magic_cookies_enabled
- its_payload.push_back(0x1);
-
- for (int var = 0; var < 12; ++var) { // insert invalid data covered by size
- its_payload.push_back(0xdd);
- }
-
- std::size_t its_size = its_payload.size() - 8;
- its_payload[4] = vsomeip::byte_t(its_size >> 24 & 0xFF);
- its_payload[5] = vsomeip::byte_t(its_size >> 16 & 0xFF);
- its_payload[6] = vsomeip::byte_t(its_size >> 8 & 0xFF);
- its_payload[7] = vsomeip::byte_t(its_size & 0xFF);
- its_request->set_payload(vsomeip::runtime::get()->create_payload(its_payload));
-
- auto send_request_and_wait_for_reply = [&](
- const std::shared_ptr<vsomeip::message>& _request,
- debug_diag_job_app_error_type_e _expected_response) {
- std::unique_lock<std::mutex> its_lock(mutex_);
- app_->send(_request);
- while(wait_until_debug_diag_job_response_received_) {
- condition_.wait(its_lock);
- }
- EXPECT_EQ(_expected_response, last_response_);
- wait_until_debug_diag_job_response_received_ = true;
- };
-
- send_request_and_wait_for_reply(its_request, debug_diag_job_app_error_type_e::ET_OUT_OF_RANGE);
-
- // send a request w/o payload
- its_payload.clear();
- its_request->set_payload(vsomeip::runtime::get()->create_payload(its_payload));
- send_request_and_wait_for_reply(its_request, debug_diag_job_app_error_type_e::ET_OUT_OF_RANGE);
-
-
-
- // send a request with to few data and a too big size field
- its_payload.clear();
- its_payload.push_back(0x0); // handle
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0x11); // size
- its_payload.push_back(0x22);
- its_payload.push_back(0x33);
- its_payload.push_back(0x44);
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_request->set_payload(vsomeip::runtime::get()->create_payload(its_payload));
- send_request_and_wait_for_reply(its_request, debug_diag_job_app_error_type_e::ET_OUT_OF_RANGE);
-
-
- // send a request with to few data and a size of zero field
- its_payload.clear();
- its_payload.push_back(0x0); // handle
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0x0); // size
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_request->set_payload(vsomeip::runtime::get()->create_payload(its_payload));
- send_request_and_wait_for_reply(its_request, debug_diag_job_app_error_type_e::ET_OUT_OF_RANGE);
-
- // send a request with valid size and data but additional data at the end
- its_payload.clear();
- its_payload.push_back(0x0); // handle
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0x0); // size
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0x0);
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
- its_payload.push_back(0xDD); // data
-
- its_size = its_payload.size() - 8;
- its_payload[4] = vsomeip::byte_t(its_size >> 24 & 0xFF);
- its_payload[5] = vsomeip::byte_t(its_size >> 16 & 0xFF);
- its_payload[6] = vsomeip::byte_t(its_size >> 8 & 0xFF);
- its_payload[7] = vsomeip::byte_t(its_size & 0xFF);
-
- its_payload.push_back(0xDD); // data
- its_request->set_payload(vsomeip::runtime::get()->create_payload(its_payload));
- send_request_and_wait_for_reply(its_request, debug_diag_job_app_error_type_e::ET_OUT_OF_RANGE);
- }
-
- void call_shutdown_method() {
- std::shared_ptr<vsomeip::message> its_request = vsomeip::runtime::get()->create_request();
-
- auto send_request = [&](const debug_diag_job_plugin_test::service_info& _info) {
- if (_info.service_id == 0xFFFF && _info.instance_id == 0xFFFF) {
- return;
- }
- its_request->set_service(_info.service_id);
- its_request->set_instance(_info.instance_id);
- its_request->set_method(_info.method_id);
- app_->send(its_request);
- };
- // insert valid entries
- for (const auto& si : service_infos_local_) {
- send_request(si);
- }
- for (const auto& si : service_infos_remote_) {
- send_request(si);
- }
- }
-
- void run() {
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
- }
- // wait until remote services are available
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_remote_services_available_) {
- condition_.wait(its_lock);
- }
- wait_until_remote_services_available_ = true;
- VSOMEIP_WARNING << "Remote services available";
- }
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_debug_diag_job_service_available_) {
- condition_.wait(its_lock);
- }
- wait_until_debug_diag_job_service_available_ = true;
- VSOMEIP_WARNING << "debug diag job service available";
- }
- // trigger offering of local services
- call_debug_diag_job(true);
- call_debug_diag_job(true);
- VSOMEIP_WARNING << "Calling debug_diag_job_service (offer)";
- // wait until local services are available as well
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_local_services_available_) {
- condition_.wait(its_lock);
- }
- wait_until_local_services_available_ = true;
- VSOMEIP_WARNING << "local services available";
- }
-
- // check that from all services events were received
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_notifications_received_) {
- condition_.wait(its_lock);
- }
- wait_until_notifications_received_ = true;
- VSOMEIP_WARNING << "notifications received";
- }
-
- // tigger stop offering of local services
- call_debug_diag_job(false);
- VSOMEIP_WARNING << "Calling debug_diag_job_service (stop offer)";
- // wait until local services are unavailable
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_local_services_unavailable_) {
- condition_.wait(its_lock);
- }
- wait_until_local_services_unavailable_ = true;
- VSOMEIP_WARNING << "local services unavailable";
- }
-
- // trigger offering of local services
- VSOMEIP_WARNING << "Calling debug_diag_job_service (offer)";
- call_debug_diag_job_wrong_message(true);
- // wait until local services are available as well again
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_local_services_available_) {
- condition_.wait(its_lock);
- }
- wait_until_local_services_available_ = true;
- VSOMEIP_WARNING << "local services available";
- }
- VSOMEIP_WARNING << "Calling shutdown method";
- call_shutdown_method();
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_responses_received_) {
- if (std::cv_status::timeout ==
- condition_.wait_for(its_lock, std::chrono::seconds(10))) {
- ADD_FAILURE() << "Didn't receive shutdown responses within time";
- wait_until_responses_received_ = false;
- } else {
- VSOMEIP_WARNING << "received shutdown method responses";
- }
- }
- wait_until_responses_received_ = true;
- }
- {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
- }
-
-private:
- std::array<debug_diag_job_plugin_test::service_info, 3> service_infos_local_;
- std::array<debug_diag_job_plugin_test::service_info, 3> service_infos_remote_;
- std::vector<debug_diag_job_plugin_test::service_info> service_infos_;
- std::shared_ptr<vsomeip::application> app_;
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
- std::map<std::pair<vsomeip::service_t, vsomeip::event_t>, std::uint32_t> other_services_received_notification_;
-
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_remote_services_available_;
- std::map<std::pair<vsomeip::service_t, vsomeip::event_t>, std::uint32_t> other_remote_services_received_notification_;
-
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_local_services_available_;
- std::map<std::pair<vsomeip::service_t, vsomeip::event_t>, std::uint32_t> other_local_services_received_notification_;
-
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, std::uint32_t> other_services_received_response_;
-
- bool wait_until_registered_;
- bool wait_until_remote_services_available_;
- bool wait_until_debug_diag_job_service_available_;
- bool wait_until_local_services_available_;
- bool wait_until_local_services_unavailable_;
- bool wait_until_notifications_received_;
- bool wait_until_responses_received_;
- bool wait_until_debug_diag_job_response_received_;
- std::mutex mutex_;
- std::condition_variable condition_;
-
- bool wait_for_stop_;
-
- debug_diag_job_app_error_type_e last_response_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
- std::thread stop_thread_;
-
- std::thread run_thread_;
-};
-
-extern "C" void signal_handler(int signum) {
- the_client->handle_signal(signum);
-}
-
-TEST(someip_debug_diag_job_plugin_test, remotely_enable_offering_of_local_services)
-{
- debug_diag_job_plugin_test_client its_sample(
- debug_diag_job_plugin_test::service_infos_local,
- debug_diag_job_plugin_test::service_infos_remote);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_globals.hpp b/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_globals.hpp
deleted file mode 100644
index eff3aa0..0000000
--- a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_globals.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (C) 2014-2017 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 DEBUG_DIAG_JOB_PLUGIN_TEST_GLOBALS_HPP_
-#define DEBUG_DIAG_JOB_PLUGIN_TEST_GLOBALS_HPP_
-
-namespace debug_diag_job_plugin_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
-};
-
-static constexpr std::array<service_info, 3> service_infos_remote = {{
- // placeholder to be consistent w/ client ids, service ids, app names
- { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF },
- { 0x1010, 0x1, 0x1010, 0x8111, 0x1 },
- { 0x2020, 0x1, 0x2020, 0x8222, 0x2 }
-}};
-
-static constexpr std::array<service_info, 3> service_infos_local = {{
- // placeholder to be consistent w/ client ids, service ids, app names
- { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF },
- { 0x3030, 0x1, 0x3030, 0x8333, 0x1 },
- { 0x4040, 0x1, 0x4040, 0x8444, 0x2 }
-}};
-
-static constexpr service_info debug_diag_job_serviceinfo = { 0xfea3, 0x80, 0x1, 0x0, 0x0 };
-static constexpr service_info debug_diag_job_serviceinfo_reset = { 0xfea3, 0x80, 0x2, 0x0, 0x0 };
-
-static constexpr int notifications_to_send = 1;
-}
-
-#endif /* DEBUG_DIAG_JOB_PLUGIN_TEST_GLOBALS_HPP_ */
diff --git a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_master_starter.sh b/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_master_starter.sh
deleted file mode 100755
index 82963fb..0000000
--- a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_master_starter.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-export VSOMEIP_CONFIGURATION=debug_diag_job_plugin_test_master.json
-# start daemon
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(readlink -f ../plugins/mgu)
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-# Start the services
-# Array for service pids
-SERVICE_PIDS=()
-./debug_diag_job_plugin_test_service 1 &
-SERVICE_PIDS+=($!)
-./debug_diag_job_plugin_test_service 2 &
-SERVICE_PIDS+=($!)
-
-print_starter_message () {
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting initial event test on slave LXC with params $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS"
- 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/test; ./debug_diag_job_plugin_test_slave_starter.sh\"" &
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name ietms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./debug_diag_job_plugin_test_slave_starter.sh" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** debug_diag_job_plugin_test_slave_starter.sh
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** debug_diag_job_plugin_test_master.json and
-** debug_diag_job_plugin_test_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-}
-sleep 1
-print_starter_message
-
-FAIL=0
-# Wait until all clients are finished
-for job in ${SERVICE_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-kill $PID_VSOMEIPD
-
-echo ""
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop ietms
- docker rm ietms
-fi
-
-# Check if both exited successfully
-exit $FAIL
diff --git a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_service.cpp b/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_service.cpp
deleted file mode 100644
index ed4bb7a..0000000
--- a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_service.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "../debug_diag_job_plugin_tests/debug_diag_job_plugin_test_globals.hpp"
-
-static int service_number(0);
-
-class debug_diag_job_plugin_test_service {
-public:
- debug_diag_job_plugin_test_service(struct debug_diag_job_plugin_test::service_info _service_info_local,
- struct debug_diag_job_plugin_test::service_info _service_info_remote,
- std::uint32_t _events_to_offer) :
- service_info_local_(_service_info_local),
- service_info_remote_(_service_info_remote),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- events_to_offer_(_events_to_offer),
- offer_thread_(std::bind(&debug_diag_job_plugin_test_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&debug_diag_job_plugin_test_service::on_state, this,
- std::placeholders::_1));
- app_->register_message_handler(service_info_local_.service_id,
- service_info_local_.instance_id, service_info_local_.method_id,
- std::bind(&debug_diag_job_plugin_test_service::on_shutdown_method_called,
- this, std::placeholders::_1));
- app_->register_message_handler(service_info_remote_.service_id,
- service_info_remote_.instance_id, service_info_remote_.method_id,
- std::bind(&debug_diag_job_plugin_test_service::on_shutdown_method_called,
- this, std::placeholders::_1));
-
- for (auto si : {service_info_local_, service_info_remote_}) {
- // offer field
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(si.eventgroup_id);
- for (std::uint16_t i = 0; i < events_to_offer_; i++) {
- app_->offer_event(si.service_id, si.instance_id,
- static_cast<vsomeip::event_t>(si.event_id + i), its_eventgroups, true);
- }
-
- // set value to field
- std::shared_ptr<vsomeip::payload> its_payload =
- vsomeip::runtime::get()->create_payload();
- vsomeip::byte_t its_data[2] = {static_cast<vsomeip::byte_t>((si.service_id & 0xFF00) >> 8),
- static_cast<vsomeip::byte_t>((si.service_id & 0xFF))};
- its_payload->set_data(its_data, 2);
- for (std::uint16_t i = 0; i < events_to_offer_; i++) {
- app_->notify(si.service_id, si.instance_id,
- static_cast<vsomeip::event_t>(si.event_id + i), its_payload);
- }
- }
-
- if (service_number == 1) {
- // the debug mode service only needs to be offered one time
- // debug mode service and event
-
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(1);
- app_->offer_event(0xfc10, 0x80, 0x8001, its_eventgroups, true);
- std::shared_ptr<vsomeip::payload> its_payload =
- vsomeip::runtime::get()->create_payload();
- vsomeip::byte_t data[1] = {0x1};
- its_payload->set_data(data, 1);
- app_->notify(0xfc10, 0x80, 0x8001, its_payload);
- }
- app_->start();
- }
-
- ~debug_diag_job_plugin_test_service() {
- offer_thread_.join();
- }
-
- void offer() {
- if (service_number == 1) {
- // the debug mode service only needs to be offered one time
- app_->offer_service(0xfc10, 0x80, 1, vsomeip::ANY_MINOR);
- }
- for (auto si : {service_info_local_, service_info_remote_}) {
- app_->offer_service(si.service_id, si.instance_id);
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << si.service_id << "] Offering";
- }
- }
-
- void on_state(vsomeip::state_type_e _state) {
- VSOMEIP_INFO << "Application " << app_->get_name() << " is "
- << (_state == vsomeip::state_type_e::ST_REGISTERED ?
- "registered." : "deregistered.");
-
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message));
- static bool shutdown_called_local = false;
- static bool shutdown_called_remote = false;
- if (_message->get_method() == service_info_local_.method_id) {
- shutdown_called_local = true;
- } else if (_message->get_method() == service_info_remote_.method_id) {
- shutdown_called_remote = true;
- }
- if (shutdown_called_local && shutdown_called_remote) {
- VSOMEIP_WARNING << "Shutdown method called -> going down!";
- for (auto si : {service_info_local_, service_info_remote_}) {
- app_->stop_offer_service(si.service_id, si.instance_id);
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0')
- << std::hex << si.service_id << "] Stop Offering";
- }
- app_->clear_all_handler();
- app_->stop();
- }
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_local_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
- offer();
- }
-
-private:
- debug_diag_job_plugin_test::service_info service_info_local_;
- debug_diag_job_plugin_test::service_info service_info_remote_;
- std::shared_ptr<vsomeip::application> app_;
-
- bool wait_until_registered_;
- std::uint32_t events_to_offer_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-};
-
-static std::uint32_t offer_multiple_events;
-
-TEST(someip_debug_diag_job_plugin_test, offer_one_remote_and_one_local_service)
-{
- debug_diag_job_plugin_test_service its_sample(
- debug_diag_job_plugin_test::service_infos_local[service_number],
- debug_diag_job_plugin_test::service_infos_remote[service_number],
- offer_multiple_events);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a service number and subscription type, like: " << argv[0] << " 2 SAME_SERVICE_ID" << std::endl;
- std::cerr << "Valid service numbers are in the range of [1,2]" << std::endl;
- return 1;
- }
-
- service_number = std::stoi(std::string(argv[1]), nullptr);
-
- offer_multiple_events = 1;
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_slave_starter.sh b/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_slave_starter.sh
deleted file mode 100755
index 207ff64..0000000
--- a/test/debug_diag_job_plugin_tests/debug_diag_job_plugin_test_slave_starter.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=debug_diag_job_plugin_test_slave.json
-
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-
-# Start the services
-export VSOMEIP_APPLICATION_NAME=debug_diag_job_plugin_test_client
-./debug_diag_job_plugin_test_client &
-PID_CLIENT=$!
-
-wait $PID_CLIENT || FAIL=$(($FAIL+1))
-
-kill $PID_VSOMEIPD
-
-sleep 1
-echo ""
-
-# Check if both exited successfully
-exit $FAIL
diff --git a/test/e2e_tests/e2e_test_client.cpp b/test/e2e_tests/e2e_test_client.cpp
index ca136d9..dc04b56 100644
--- a/test/e2e_tests/e2e_test_client.cpp
+++ b/test/e2e_tests/e2e_test_client.cpp
@@ -78,12 +78,10 @@ void e2e_test_client::on_state(vsomeip::state_type_e _state) {
app_->request_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
static_cast<vsomeip::event_t>(0x8001),
- its_eventgroups, true);
+ its_eventgroups, vsomeip::event_type_e::ET_FIELD);
app_->request_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
static_cast<vsomeip::event_t>(0x8002),
- its_eventgroups_2, true);
- app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, 0x01);
- app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, 0x02);
+ its_eventgroups_2, vsomeip::event_type_e::ET_FIELD);
}
}
@@ -109,6 +107,10 @@ void e2e_test_client::on_availability(vsomeip::service_t _service,
}
else if(_is_available && !is_available_) {
is_available_ = true;
+ std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+ app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, 0x01);
+ app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, 0x02);
+ std::this_thread::sleep_for(std::chrono::milliseconds(1000));
condition_.notify_one();
}
}
@@ -206,13 +208,13 @@ void e2e_test_client::run() {
// protected answer holding a fixed payload (profile 01 CRC8)
// this call triggers also an event 0x8001 which holds a calculated payload
request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
- app_->send(request, true);
+ app_->send(request);
// send a request which is not e2e protected and expect an
// protected answer holding a fixed payload (custom profile CRC32)
// this call triggers also an event 0x8002 which holds a calculated payload
request->set_method(0x6543);
- app_->send(request, true);
+ app_->send(request);
std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
@@ -231,7 +233,7 @@ void e2e_test_client::shutdown_service() {
request->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
request->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
- app_->send(request,true);
+ app_->send(request);
std::this_thread::sleep_for(std::chrono::milliseconds(250));
// expect 10 x response messages for both method IDs and events for both Event IDs
diff --git a/test/e2e_tests/e2e_test_external_master_start.sh b/test/e2e_tests/e2e_test_external_master_start.sh
index c18f787..3e54d9b 100755
--- a/test/e2e_tests/e2e_test_external_master_start.sh
+++ b/test/e2e_tests/e2e_test_external_master_start.sh
@@ -31,7 +31,7 @@ PID_CLIENT=$!
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting external e2e 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/test; ./e2e_test_external_slave_start.sh $SERVICE_JSON_FILE\"" &
+ 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; ./e2e_test_external_slave_start.sh $SERVICE_JSON_FILE\"" &
elif [ ! -z "$USE_DOCKER" ]; then
docker run --name citms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./e2e_test_external_slave_start.sh $SERVICE_JSON_FILE" &
else
diff --git a/test/e2e_tests/e2e_test_service.cpp b/test/e2e_tests/e2e_test_service.cpp
index 886596e..9984cbc 100644
--- a/test/e2e_tests/e2e_test_service.cpp
+++ b/test/e2e_tests/e2e_test_service.cpp
@@ -59,7 +59,9 @@ bool e2e_test_service::init() {
// profile01 CRC8 Event ID: 0x8001
app_->offer_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- static_cast<vsomeip::event_t>(0x8001), its_eventgroups, true);
+ static_cast<vsomeip::event_t>(0x8001), its_eventgroups,
+ vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
// set value to field which gets filled by e2e protection with CRC on sending
// after e2e protection the payload for first event should look like:
@@ -74,7 +76,9 @@ bool e2e_test_service::init() {
// custom profile CRC32 Event ID: 0x8002
app_->offer_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- static_cast<vsomeip::event_t>(0x8002), its_eventgroups_2, true);
+ static_cast<vsomeip::event_t>(0x8002), its_eventgroups_2,
+ vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
// set value to field which gets filled by e2e protection with CRC on sending
// after e2e protection the payload for first event should look like:
@@ -154,7 +158,7 @@ void e2e_test_service::on_message(const std::shared_ptr<vsomeip::message>& _requ
if (_request->get_method() == vsomeip_test::TEST_SERVICE_METHOD_ID) {
its_vsomeip_payload->set_data(payloads_profile_01_[received_requests_counters_[vsomeip_test::TEST_SERVICE_METHOD_ID] % vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND]);
its_response->set_payload(its_vsomeip_payload);
- app_->send(its_response, true);
+ app_->send(its_response);
// set value to field which gets filled by e2e protection with CRC on sending
vsomeip::byte_t its_data[8] = {0x00, 0x00, (uint8_t)received_requests_counters_[vsomeip_test::TEST_SERVICE_METHOD_ID], 0xff, 0xff, 0xff, 0xff, 0xff};
@@ -166,7 +170,7 @@ void e2e_test_service::on_message(const std::shared_ptr<vsomeip::message>& _requ
//send fixed payload for custom profile CRC32
its_vsomeip_payload->set_data(payloads_custom_profile_[received_requests_counters_[0x6543] % vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND]);
its_response->set_payload(its_vsomeip_payload);
- app_->send(its_response, true);
+ app_->send(its_response);
// set value to field which gets filled by e2e protection with 4 byte CRC 32 on sending
vsomeip::byte_t its_data[8] = {0x00, 0x00, 0x00, 0x00, 0xff, 0xff, (uint8_t)received_requests_counters_[0x6543], 0x32};
diff --git a/test/event_tests/conf/event_test_master.json.in b/test/event_tests/conf/event_test_master.json.in
index 5190c87..b8db14f 100644
--- a/test/event_tests/conf/event_test_master.json.in
+++ b/test/event_tests/conf/event_test_master.json.in
@@ -19,7 +19,7 @@
"max_dispatch_time" : "1000"
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/event_tests/conf/event_test_slave_tcp.json.in b/test/event_tests/conf/event_test_slave_tcp.json.in
index 57eba12..d0bbed9 100644
--- a/test/event_tests/conf/event_test_slave_tcp.json.in
+++ b/test/event_tests/conf/event_test_slave_tcp.json.in
@@ -30,7 +30,7 @@
}
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/event_tests/conf/event_test_slave_udp.json.in b/test/event_tests/conf/event_test_slave_udp.json.in
index 8071e04..6bf693b 100644
--- a/test/event_tests/conf/event_test_slave_udp.json.in
+++ b/test/event_tests/conf/event_test_slave_udp.json.in
@@ -27,7 +27,7 @@
"unreliable":"30001"
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/event_tests/event_test_client.cpp b/test/event_tests/event_test_client.cpp
index fd65719..f415702 100644
--- a/test/event_tests/event_test_client.cpp
+++ b/test/event_tests/event_test_client.cpp
@@ -16,8 +16,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-#include "../../implementation/configuration/include/internal.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "event_test_globals.hpp"
@@ -64,7 +63,7 @@ public:
its_eventgroups.insert(service_info_.eventgroup_id);
app_->request_event(service_info_.service_id,
service_info_.instance_id, service_info_.event_id,
- its_eventgroups, false);
+ its_eventgroups, vsomeip::event_type_e::ET_EVENT);
app_->register_subscription_status_handler(service_info_.service_id,
service_info_.instance_id, service_info_.eventgroup_id,
service_info_.event_id,
@@ -73,8 +72,7 @@ public:
std::placeholders::_3, std::placeholders::_4,
std::placeholders::_5));
app_->subscribe(service_info_.service_id, service_info_.instance_id,
- service_info_.eventgroup_id, vsomeip::DEFAULT_MAJOR,
- vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE);
+ service_info_.eventgroup_id);
app_->start();
}
diff --git a/test/event_tests/event_test_master_starter.sh b/test/event_tests/event_test_master_starter.sh
index 6c39053..7c2aec0 100755
--- a/test/event_tests/event_test_master_starter.sh
+++ b/test/event_tests/event_test_master_starter.sh
@@ -18,7 +18,7 @@ TESTMODE=$1
COMMUNICATIONMODE=$2
export VSOMEIP_CONFIGURATION=event_test_master.json
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
./event_test_client $TESTMODE $COMMUNICATIONMODE &
@@ -28,7 +28,7 @@ sleep 1
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting offer test on slave LXC offer_test_external_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/test; ./event_test_slave_starter.sh $COMMUNICATIONMODE\"" &
+ 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; ./event_test_slave_starter.sh $COMMUNICATIONMODE\"" &
elif [ ! -z "$USE_DOCKER" ]; then
docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./event_test_slave_starter.sh $COMMUNICATIONMODE" &
else
diff --git a/test/event_tests/event_test_service.cpp b/test/event_tests/event_test_service.cpp
index 271aa49..f9cf28f 100644
--- a/test/event_tests/event_test_service.cpp
+++ b/test/event_tests/event_test_service.cpp
@@ -14,7 +14,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "event_test_globals.hpp"
@@ -41,7 +41,9 @@ public:
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(_service_info.eventgroup_id);
app_->offer_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, false);
+ service_info_.event_id, its_eventgroups,
+ vsomeip::event_type_e::ET_EVENT, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
app_->register_message_handler(service_info_.service_id,
service_info_.instance_id, service_info_.shutdown_method_id,
std::bind(&event_test_service::on_shutdown_method_called, this,
@@ -53,7 +55,8 @@ public:
app_->register_subscription_handler(service_info_.service_id,
service_info_.instance_id, service_info_.eventgroup_id,
std::bind(&event_test_service::subscription_handler,
- this, std::placeholders::_1, std::placeholders::_2));
+ this, std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, std::placeholders::_4));
app_->start();
}
@@ -147,7 +150,9 @@ public:
}
}
- bool subscription_handler(vsomeip::client_t _client, bool _subscribed) {
+ bool subscription_handler(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid, bool _subscribed) {
+ (void)_uid;
+ (void)_gid;
VSOMEIP_INFO << __func__ << ": client: 0x" << std::hex << _client
<< ((_subscribed) ? " subscribed" : "unsubscribed");
client_subscribed_ = _subscribed;
diff --git a/test/event_tests/event_test_slave_starter.sh b/test/event_tests/event_test_slave_starter.sh
index 9cc8e72..964175b 100755
--- a/test/event_tests/event_test_slave_starter.sh
+++ b/test/event_tests/event_test_slave_starter.sh
@@ -22,7 +22,7 @@ elif [ "$COMMUNICATIONMODE" = "UDP" ]; then
fi
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
./event_test_service &
diff --git a/test/header_factory_tests/header_factory_test_client.cpp b/test/header_factory_tests/header_factory_test_client.cpp
index 90cfef5..3ac4a06 100644
--- a/test/header_factory_tests/header_factory_test_client.cpp
+++ b/test/header_factory_tests/header_factory_test_client.cpp
@@ -8,7 +8,6 @@
header_factory_test_client::header_factory_test_client(bool _use_tcp) :
app_(vsomeip::runtime::get()->create_application()),
request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- running_(true),
blocked_(false),
is_available_(false),
number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND),
@@ -134,7 +133,7 @@ void header_factory_test_client::run()
for (uint32_t i = 0; i < number_of_messages_to_send_; i++)
{
- app_->send(request_, true);
+ app_->send(request_);
VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0')
<< std::hex << request_->get_client() << "/" << std::setw(4)
<< std::setfill('0') << std::hex << request_->get_session()
diff --git a/test/header_factory_tests/header_factory_test_client.hpp b/test/header_factory_tests/header_factory_test_client.hpp
index eb62191..8e9a4c2 100644
--- a/test/header_factory_tests/header_factory_test_client.hpp
+++ b/test/header_factory_tests/header_factory_test_client.hpp
@@ -35,10 +35,8 @@ public:
private:
std::shared_ptr<vsomeip::application> app_;
std::shared_ptr<vsomeip::message> request_;
- bool use_tcp_;
std::mutex mutex_;
std::condition_variable condition_;
- bool running_;
bool blocked_;
bool is_available_;
std::uint32_t number_of_messages_to_send_;
diff --git a/test/header_factory_tests/header_factory_test_service.cpp b/test/header_factory_tests/header_factory_test_service.cpp
index 12527ed..d60c743 100644
--- a/test/header_factory_tests/header_factory_test_service.cpp
+++ b/test/header_factory_tests/header_factory_test_service.cpp
@@ -120,7 +120,7 @@ void header_factory_test_service::on_message(const std::shared_ptr<vsomeip::mess
std::shared_ptr<vsomeip::message> its_response =
vsomeip::runtime::get()->create_response(_request);
- app_->send(its_response, true);
+ app_->send(its_response);
if(number_of_received_messages_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND)
{
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in
index 7cb35fb..a05d13f 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in
@@ -31,116 +31,29 @@
{
"service":"0x1111",
"instance":"0x0001",
- "unreliable":"30001",
"reliable":
{
"port":"40001",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1112",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1113",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1114",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1115",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x2222",
"instance":"0x0001",
- "unreliable":"30002",
"reliable":
{
"port":"40002",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2223",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2224",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2225",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2226",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x3333",
"instance":"0x0001",
- "unreliable":"30003",
"reliable":
{
"port":"40003",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3334",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3335",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3336",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3337",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x8888",
diff --git a/test/debug_diag_job_plugin_tests/conf/debug_diag_job_plugin_test_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_udp.json.in
index cb47d1e..8ce06f0 100644
--- a/test/debug_diag_job_plugin_tests/conf/debug_diag_job_plugin_test_master.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_udp.json.in
@@ -11,50 +11,49 @@
},
"dlt":"false"
},
- "diagnosis" : "0x63",
"applications":
[
{
- "name":"debug_diag_job_plugin_test_service_one",
- "id":"0x1010"
+ "name":"initial_event_test_service_one",
+ "id":"0x1111"
},
{
- "name":"debug_diag_job_plugin_test_service_two",
+ "name":"initial_event_test_service_two",
"id":"0x2222"
},
{
- "name":"vsomeipd",
- "plugins" :
- [
- {
- "application_plugin" : "vsomeip-debug-diagnosis-plugin-mgu"
- }
- ]
+ "name":"initial_event_test_service_three",
+ "id":"0x3333"
}
],
"services":
[
{
- "service":"0x1010",
+ "service":"0x1111",
"instance":"0x0001",
- "unreliable":"40001"
+ "unreliable":"30001"
},
{
- "service":"0x2020",
+ "service":"0x2222",
"instance":"0x0001",
- "unreliable":"40002"
+ "unreliable":"30002"
},
{
- "service":"0xfea3",
- "instance":"0x80",
- "unreliable":"50000"
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30003"
+ },
+ {
+ "service":"0x8888",
+ "instance":"0x0001",
+ "unreliable":"8888"
}
],
- "routing":"vsomeipd",
+ "routing":"initial_event_test_service_one",
"service-discovery":
{
"enable":"true",
- "multicast":"224.1.1.1",
+ "multicast":"224.0.0.1",
"port":"30490",
"protocol":"udp",
"initial_delay_min" : "10",
@@ -64,4 +63,4 @@
"cyclic_offer_delay" : "1000",
"ttl" : "3"
}
-} \ No newline at end of file
+}
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in
index 320e2a3..1fc97a4 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in
@@ -32,116 +32,29 @@
{
"service":"0x4444",
"instance":"0x0001",
- "unreliable":"30004",
"reliable":
{
"port":"40004",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4445",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4446",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4447",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4448",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x5555",
"instance":"0x0001",
- "unreliable":"30005",
"reliable":
{
"port":"40005",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5556",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5557",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5558",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5559",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x6666",
"instance":"0x0001",
- "unreliable":"30006",
"reliable":
{
"port":"40006",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6667",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6668",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6669",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x666a",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x9999",
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_udp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_udp.json.in
new file mode 100644
index 0000000..d303a4c
--- /dev/null
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_udp.json.in
@@ -0,0 +1,67 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "diagnosis" : "0x63",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"initial_event_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"initial_event_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"initial_event_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4444",
+ "instance":"0x0001",
+ "unreliable":"30004"
+ },
+ {
+ "service":"0x5555",
+ "instance":"0x0001",
+ "unreliable":"30005"
+ },
+ {
+ "service":"0x6666",
+ "instance":"0x0001",
+ "unreliable":"30006"
+ },
+ {
+ "service":"0x9999",
+ "instance":"0x0001",
+ "unreliable":"9999"
+ }
+ ],
+ "routing":"initial_event_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in
index 7336aa2..b065685 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in
@@ -31,116 +31,29 @@
{
"service":"0x1111",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1112",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1113",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1114",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1115",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x2222",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2223",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2224",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2225",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2226",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x3333",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3334",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3335",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3336",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3337",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x8888",
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_udp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_udp.json.in
new file mode 100644
index 0000000..ca77daf
--- /dev/null
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_udp.json.in
@@ -0,0 +1,66 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"initial_event_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"initial_event_test_service_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"initial_event_test_service_three",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1111",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x8888",
+ "instance":"0x0001",
+ "unreliable":"8888"
+ }
+ ],
+ "routing":"initial_event_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in
index f22ad4e..eaeab4a 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in
@@ -32,116 +32,29 @@
{
"service":"0x4444",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4445",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4446",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4447",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4448",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x5555",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5556",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5557",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5558",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5559",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x6666",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6667",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6668",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6669",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x666a",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x9999",
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_udp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_udp.json.in
new file mode 100644
index 0000000..5d978f0
--- /dev/null
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_udp.json.in
@@ -0,0 +1,67 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "diagnosis" : "0x63",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"initial_event_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"initial_event_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"initial_event_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4444",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x5555",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x6666",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x9999",
+ "instance":"0x0001",
+ "unreliable":"9999"
+ }
+ ],
+ "routing":"initial_event_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+} \ No newline at end of file
diff --git a/test/initial_event_tests/initial_event_test_availability_checker.cpp b/test/initial_event_tests/initial_event_test_availability_checker.cpp
index 719d6d3..6a2eab9 100644
--- a/test/initial_event_tests/initial_event_test_availability_checker.cpp
+++ b/test/initial_event_tests/initial_event_test_availability_checker.cpp
@@ -15,7 +15,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "initial_event_test_globals.hpp"
@@ -28,7 +28,6 @@ public:
service_infos_(_service_infos),
app_(vsomeip::runtime::get()->create_application()),
wait_until_registered_(true),
- wait_until_other_services_available_(true),
wait_for_stop_(true),
stop_thread_(std::bind(&initial_event_test_availability_checker::wait_for_stop, this)) {
if (!app_->init()) {
@@ -117,7 +116,6 @@ private:
std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
bool wait_until_registered_;
- bool wait_until_other_services_available_;
std::mutex mutex_;
std::condition_variable condition_;
diff --git a/test/initial_event_tests/initial_event_test_client.cpp b/test/initial_event_tests/initial_event_test_client.cpp
index 20f1f94..a26e7b0 100644
--- a/test/initial_event_tests/initial_event_test_client.cpp
+++ b/test/initial_event_tests/initial_event_test_client.cpp
@@ -20,7 +20,7 @@
#endif
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "initial_event_test_globals.hpp"
@@ -31,17 +31,16 @@ extern "C" void signal_handler(int _signum);
class initial_event_test_client {
public:
initial_event_test_client(int _client_number,
- vsomeip::subscription_type_e _subscription_type,
+ bool _service_offered_tcp_and_udp,
std::array<initial_event_test::service_info, 7> _service_infos,
bool _subscribe_on_available, std::uint32_t _events_to_subscribe,
bool _initial_event_strict_checking,
bool _dont_exit, bool _subscribe_only_one) :
client_number_(_client_number),
service_infos_(_service_infos),
- subscription_type_(_subscription_type),
+ service_offered_tcp_and_udp_(_service_offered_tcp_and_udp),
app_(vsomeip::runtime::get()->create_application()),
wait_until_registered_(true),
- wait_until_other_services_available_(true),
wait_for_stop_(true),
subscribe_on_available_(_subscribe_on_available),
events_to_subscribe_(_events_to_subscribe),
@@ -81,7 +80,7 @@ public:
for (std::uint32_t j = 0; j < events_to_subscribe_; j++ ) {
app_->request_event(i.service_id, i.instance_id,
static_cast<vsomeip::event_t>(i.event_id + j),
- its_eventgroups, true);
+ its_eventgroups, vsomeip::event_type_e::ET_FIELD);
}
other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
@@ -89,19 +88,19 @@ public:
if (!subscribe_on_available_) {
if (events_to_subscribe_ == 1) {
app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_);
+ vsomeip::DEFAULT_MAJOR);
other_services_received_notification_[std::make_pair(i.service_id, i.event_id)] = 0;
} else if (events_to_subscribe_ > 1) {
if (!subscribe_only_one_) {
for (std::uint32_t j = 0; j < events_to_subscribe_; j++ ) {
app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_,
+ vsomeip::DEFAULT_MAJOR,
static_cast<vsomeip::event_t>(i.event_id + j));
other_services_received_notification_[std::make_pair(i.service_id, i.event_id + j)] = 0;
}
} else {
app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_,
+ vsomeip::DEFAULT_MAJOR,
static_cast<vsomeip::event_t>(i.event_id));
other_services_received_notification_[std::make_pair(i.service_id, i.event_id)] = 0;
}
@@ -177,11 +176,11 @@ public:
}
if (events_to_subscribe_ == 1 ) {
app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_);
+ vsomeip::DEFAULT_MAJOR);
} else if (events_to_subscribe_ > 1) {
for (std::uint32_t j = 0; j < events_to_subscribe_; j++ ) {
app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_,
+ vsomeip::DEFAULT_MAJOR,
static_cast<vsomeip::event_t>(i.event_id + j));
}
}
@@ -214,20 +213,14 @@ public:
EXPECT_EQ((_message->get_service() & 0xFF00 ) >> 8, its_payload->get_data()[0]);
EXPECT_EQ((_message->get_service() & 0xFF), its_payload->get_data()[1]);
bool notify(false);
- switch(subscription_type_) {
- case vsomeip::subscription_type_e::SU_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_RELIABLE:
- if (all_notifications_received()) {
- notify = true;
- }
- break;
- case vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE:
- if (all_notifications_received_tcp_and_udp()) {
- notify = true;
- }
- break;
+ if (!service_offered_tcp_and_udp_) {
+ if (all_notifications_received()) {
+ notify = true;
+ }
+ } else {
+ if (all_notifications_received_tcp_and_udp()) {
+ notify = true;
+ }
}
if (notify && !dont_exit_) {
@@ -245,8 +238,9 @@ public:
[&](const std::map<std::pair<vsomeip::service_t,
vsomeip::method_t>, std::uint32_t>::value_type& v)
{
+ bool result;
if (v.second == initial_event_test::notifications_to_send) {
- return true;
+ result = true;
} else {
if (v.second >= initial_event_test::notifications_to_send) {
VSOMEIP_WARNING
@@ -268,12 +262,14 @@ public:
<< std::setw(4) << std::setfill('0') << std::hex << v.first.second
<< " number of received events: " << v.second;
}
- return initial_event_strict_checking_ ? false : true;
+ result = initial_event_strict_checking_ ? false : true;
} else {
- return false;
+ result = false;
}
}
+
+ return result;
}
);
}
@@ -315,7 +311,7 @@ public:
// routing manager stub receives the notification
// - twice from external nodes
// - and normal from all internal nodes
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ VSOMEIP_ERROR << "[" << std::setw(4) << std::setfill('0') << std::hex
<< client_number_ << "] "
<< "Received notifications:"
<< " Normal: " << received_normal
@@ -377,12 +373,15 @@ public:
}
void wait_for_stop() {
+ static int its_call_number(0);
+ its_call_number++;
+
{
std::unique_lock<std::mutex> its_lock(stop_mutex_);
while (wait_for_stop_) {
stop_condition_.wait_for(its_lock, std::chrono::milliseconds(100));
}
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
+ VSOMEIP_ERROR << "(" << std::dec << its_call_number << ") [" << std::setw(4) << std::setfill('0') << std::hex
<< client_number_
<< "] Received notifications from all services, going down";
}
@@ -399,13 +398,12 @@ public:
private:
int client_number_;
std::array<initial_event_test::service_info, 7> service_infos_;
- vsomeip::subscription_type_e subscription_type_;
+ bool service_offered_tcp_and_udp_;
std::shared_ptr<vsomeip::application> app_;
std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_notification_;
bool wait_until_registered_;
- bool wait_until_other_services_available_;
std::mutex mutex_;
std::condition_variable condition_;
@@ -427,7 +425,7 @@ private:
};
static int client_number;
-static vsomeip::subscription_type_e subscription_type;
+static bool service_offered_tcp_and_udp;
static bool use_same_service_id;
static bool subscribe_on_available;
static std::uint32_t subscribe_multiple_events;
@@ -443,12 +441,13 @@ TEST(someip_initial_event_test, wait_for_initial_events_of_all_services)
{
if(use_same_service_id) {
initial_event_test_client its_sample(client_number,
- subscription_type,
- initial_event_test::service_infos_same_service_id, subscribe_on_available,
- subscribe_multiple_events, initial_event_strict_checking, dont_exit,
+ service_offered_tcp_and_udp,
+ initial_event_test::service_infos_same_service_id,
+ subscribe_on_available, subscribe_multiple_events,
+ initial_event_strict_checking, dont_exit,
subscribe_only_one);
} else {
- initial_event_test_client its_sample(client_number, subscription_type,
+ initial_event_test_client its_sample(client_number, service_offered_tcp_and_udp,
initial_event_test::service_infos, subscribe_on_available,
subscribe_multiple_events, initial_event_strict_checking, dont_exit,
subscribe_only_one);
@@ -464,12 +463,11 @@ int main(int argc, char** argv)
pthread_sigmask(SIG_BLOCK, &mask, NULL);
::testing::InitGoogleTest(&argc, argv);
- if(argc < 3) {
- std::cerr << "Please specify a client number and subscription type, like: " << argv[0] << " 2 UDP SUBSCRIBE_BEFORE_START SAME_SERVICE_ID" << std::endl;
+ if(argc < 2) {
+ std::cerr << "Please specify a client number, like: " << argv[0] << " 2 SUBSCRIBE_BEFORE_START SAME_SERVICE_ID" << std::endl;
std::cerr << "Valid client numbers are from 0 to 0xFFFF" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- std::cerr << "After client number and subscription types one/multiple of these flags can be specified:";
+ std::cerr << "After client number one/multiple of these flags can be specified:";
+ std::cerr << " - SERVICE_OFFERED_TCP_AND_UDP flag. Set this if the service is offered via TCP and UDP" << std::endl;
std::cerr << " - Time of subscription, valid values: [SUBSCRIBE_ON_AVAILABILITY, SUBSCRIBE_BEFORE_START], default SUBSCRIBE_BEFORE_START" << std::endl;
std::cerr << " - SAME_SERVICE_ID flag. If set the test is run w/ multiple instances of the same service, default false" << std::endl;
std::cerr << " - MULTIPLE_EVENTS flag. If set the test will subscribe to multiple events in the eventgroup, default false" << std::endl;
@@ -481,31 +479,15 @@ int main(int argc, char** argv)
client_number = std::stoi(std::string(argv[1]), nullptr);
- if(std::string("TCP_AND_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE;
- } else if(std::string("PREFER_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE;
- } else if(std::string("PREFER_TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_RELIABLE;
- } else if(std::string("UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_UNRELIABLE;
- } else if(std::string("TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE;
- } else {
- std::cerr << "Wrong subscription type passed, exiting" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- return 1;
- }
-
subscribe_on_available = false;
initial_event_strict_checking = false;
+ service_offered_tcp_and_udp = false;
use_same_service_id = false;
subscribe_multiple_events = 1;
dont_exit = false;
subscribe_only_one = false;
- if (argc > 3) {
- for (int i = 3; i < argc; i++) {
+ if (argc > 2) {
+ for (int i = 2; i < argc; i++) {
if (std::string("SUBSCRIBE_ON_AVAILABILITY") == std::string(argv[i])) {
subscribe_on_available = true;
} else if (std::string("SUBSCRIBE_BEFORE_START") == std::string(argv[i])) {
diff --git a/test/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_master_udp.json b/test/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_master_udp.json
new file mode 100644
index 0000000..a5bdb5f
--- /dev/null
+++ b/test/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_master_udp.json
@@ -0,0 +1,66 @@
+{
+ "unicast":"10.0.3.1",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"initial_event_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"initial_event_test_service_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"initial_event_test_service_three",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1111",
+ "instance":"0x0001",
+ "unreliable":"30001"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0001",
+ "unreliable":"30002"
+ },
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30003"
+ },
+ {
+ "service":"0x8888",
+ "instance":"0x0001",
+ "unreliable":"8888"
+ }
+ ],
+ "routing":"initial_event_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_slave_udp.json b/test/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_slave_udp.json
new file mode 100644
index 0000000..caf4e12
--- /dev/null
+++ b/test/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_slave_udp.json
@@ -0,0 +1,67 @@
+{
+ "unicast":"10.0.3.2",
+ "diagnosis" : "0x63",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"initial_event_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"initial_event_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"initial_event_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4444",
+ "instance":"0x0001",
+ "unreliable":"30004"
+ },
+ {
+ "service":"0x5555",
+ "instance":"0x0001",
+ "unreliable":"30005"
+ },
+ {
+ "service":"0x6666",
+ "instance":"0x0001",
+ "unreliable":"30006"
+ },
+ {
+ "service":"0x9999",
+ "instance":"0x0001",
+ "unreliable":"9999"
+ }
+ ],
+ "routing":"initial_event_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/initial_event_tests/initial_event_test_diff_client_ids_same_ports_master_udp.json b/test/initial_event_tests/initial_event_test_diff_client_ids_same_ports_master_udp.json
new file mode 100644
index 0000000..5d15fbf
--- /dev/null
+++ b/test/initial_event_tests/initial_event_test_diff_client_ids_same_ports_master_udp.json
@@ -0,0 +1,66 @@
+{
+ "unicast":"10.0.3.1",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"initial_event_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"initial_event_test_service_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"initial_event_test_service_three",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1111",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x8888",
+ "instance":"0x0001",
+ "unreliable":"8888"
+ }
+ ],
+ "routing":"initial_event_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/initial_event_tests/initial_event_test_diff_client_ids_same_ports_slave_udp.json b/test/initial_event_tests/initial_event_test_diff_client_ids_same_ports_slave_udp.json
new file mode 100644
index 0000000..3c6a682
--- /dev/null
+++ b/test/initial_event_tests/initial_event_test_diff_client_ids_same_ports_slave_udp.json
@@ -0,0 +1,67 @@
+{
+ "unicast":"10.0.3.2",
+ "diagnosis" : "0x63",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"initial_event_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"initial_event_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"initial_event_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4444",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x5555",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x6666",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x9999",
+ "instance":"0x0001",
+ "unreliable":"9999"
+ }
+ ],
+ "routing":"initial_event_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/initial_event_tests/initial_event_test_master_starter.sh b/test/initial_event_tests/initial_event_test_master_starter.sh
index b083c53..c78d3e8 100755
--- a/test/initial_event_tests/initial_event_test_master_starter.sh
+++ b/test/initial_event_tests/initial_event_test_master_starter.sh
@@ -10,57 +10,33 @@
# the testcase simply executes this script. This script then runs the services
# and checks that all exit successfully.
-if [ $# -lt 2 ]
+if [ $# -lt 1 ]
then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP initial_event_test_diff_client_ids_diff_ports_master.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
echo "Please pass a json file to this script."
- echo "For example: $0 UDP initial_event_test_diff_client_ids_diff_ports_master.json"
+ echo "For example: $0 initial_event_test_diff_client_ids_diff_ports_master.json"
echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter"
echo "To ensure the first client only subscribes to one event pass SUBSCRIBE_ONLY_ONE as third/fourth parameter"
exit 1
fi
-PASSED_SUBSCRIPTION_TYPE=$1
-PASSED_JSON_FILE=$2
+PASSED_JSON_FILE=$1
# Remove processed options from $@
-shift 2
+shift 1
REMAINING_OPTIONS="$@"
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $PASSED_SUBSCRIPTION_TYPE ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
print_starter_message () {
if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting initial event test on slave LXC with params $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS"
- 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/test; ./initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS\"" &
+ echo "starting initial event test on slave LXC with params $CLIENT_JSON_FILE $REMAINING_OPTIONS"
+ 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; ./initial_event_test_slave_starter.sh $CLIENT_JSON_FILE $REMAINING_OPTIONS\"" &
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name ietms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./initial_event_test_slave_starter.sh $CLIENT_JSON_FILE $REMAINING_OPTIONS" &
else
cat <<End-of-message
*******************************************************************************
*******************************************************************************
** Please now run:
-** initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS
+** initial_event_test_slave_starter.sh $CLIENT_JSON_FILE $REMAINING_OPTIONS
** from an external host to successfully complete this test.
**
** You probably will need to adapt the 'unicast' settings in
@@ -100,7 +76,7 @@ unset VSOMEIP_APPLICATION_NAME
CLIENT_PIDS=()
# Start first client which subscribes remotely
-./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE DONT_EXIT $REMAINING_OPTIONS &
+./initial_event_test_client 9000 DONT_EXIT $REMAINING_OPTIONS &
FIRST_PID=$!
# Start availability checker in order to wait until the services on the remote
@@ -125,7 +101,7 @@ sleep 2
for client_number in $(seq 9001 9011)
do
- ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE STRICT_CHECKING $REMAINING_OPTIONS &
+ ./initial_event_test_client $client_number STRICT_CHECKING $REMAINING_OPTIONS &
CLIENT_PIDS+=($!)
done
@@ -153,11 +129,6 @@ kill $PID_SERVICE_ONE
sleep 1
echo ""
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop ietms
- docker rm ietms
-fi
-
# Check if both exited successfully
if [ $FAIL -eq 0 ]
then
diff --git a/test/initial_event_tests/initial_event_test_service.cpp b/test/initial_event_tests/initial_event_test_service.cpp
index 037149e..3b96174 100644
--- a/test/initial_event_tests/initial_event_test_service.cpp
+++ b/test/initial_event_tests/initial_event_test_service.cpp
@@ -15,7 +15,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "initial_event_test_globals.hpp"
@@ -42,7 +42,10 @@ public:
its_eventgroups.insert(service_info_.eventgroup_id);
for (std::uint16_t i = 0; i < events_to_offer_; i++) {
app_->offer_event(service_info_.service_id, service_info_.instance_id,
- static_cast<vsomeip::event_t>(service_info_.event_id + i), its_eventgroups, true);
+ static_cast<vsomeip::event_t>(service_info_.event_id + i),
+ its_eventgroups, vsomeip::event_type_e::ET_FIELD,
+ std::chrono::milliseconds::zero(), false, true, nullptr,
+ vsomeip::reliability_type_e::RT_UNKNOWN);
}
// set value to field
@@ -103,7 +106,7 @@ private:
std::thread offer_thread_;
};
-static int service_number;
+static unsigned long service_number;
static bool use_same_service_id;
static std::uint32_t offer_multiple_events;
@@ -131,7 +134,7 @@ int main(int argc, char** argv)
return 1;
}
- service_number = std::stoi(std::string(argv[1]), nullptr);
+ service_number = std::stoul(std::string(argv[1]), nullptr);
offer_multiple_events = 1;
use_same_service_id = false;
diff --git a/test/initial_event_tests/initial_event_test_slave_starter.sh b/test/initial_event_tests/initial_event_test_slave_starter.sh
index 59fdd5b..083119f 100755
--- a/test/initial_event_tests/initial_event_test_slave_starter.sh
+++ b/test/initial_event_tests/initial_event_test_slave_starter.sh
@@ -10,12 +10,8 @@
# the testcase simply executes this script. This script then runs the services
# and checks that all exit successfully.
-if [ $# -lt 2 ]
+if [ $# -lt 1 ]
then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP initial_event_test_diff_client_ids_diff_ports_slave.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
echo "Please pass a json file to this script."
echo "For example: $0 UDP initial_event_test_diff_client_ids_diff_ports_slave.json"
echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter"
@@ -23,32 +19,11 @@ then
exit 1
fi
-PASSED_SUBSCRIPTION_TYPE=$1
-PASSED_JSON_FILE=$2
+PASSED_JSON_FILE=$1
# Remove processed options from $@
-shift 2
+shift 1
REMAINING_OPTIONS=$@
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $PASSED_SUBSCRIPTION_TYPE ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
-
FAIL=0
export VSOMEIP_CONFIGURATION=$PASSED_JSON_FILE
@@ -72,7 +47,7 @@ unset VSOMEIP_APPLICATION_NAME
CLIENT_PIDS=()
# Start first client which subscribes remotely
-./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE DONT_EXIT $REMAINING_OPTIONS &
+./initial_event_test_client 9000 DONT_EXIT $REMAINING_OPTIONS &
FIRST_PID=$!
# remove SUBSCRIBE_ONLY_ONCE parameter from $REMAINING_OPTIONS to ensure the
@@ -90,7 +65,7 @@ wait $PID_AVAILABILITY_CHECKER
sleep 2;
for client_number in $(seq 9001 9011)
do
- ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE STRICT_CHECKING $REMAINING_OPTIONS &
+ ./initial_event_test_client $client_number STRICT_CHECKING $REMAINING_OPTIONS &
CLIENT_PIDS+=($!)
done
diff --git a/test/initial_event_tests/initial_event_test_stop_service.cpp b/test/initial_event_tests/initial_event_test_stop_service.cpp
index 8f32fbc..83cd34c 100644
--- a/test/initial_event_tests/initial_event_test_stop_service.cpp
+++ b/test/initial_event_tests/initial_event_test_stop_service.cpp
@@ -16,7 +16,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "initial_event_test_globals.hpp"
@@ -146,15 +146,18 @@ public:
<< std::setw(4) << std::setfill('0') << std::hex
<< _message->get_session() << "] shutdown method called";
+
+ VSOMEIP_ERROR << "stop_service::" << __func__
+ << ": (1)";
std::lock_guard<std::mutex> its_lock(stop_mutex_);
+ VSOMEIP_ERROR << "stop_service::" << __func__
+ << ": (2)";
wait_for_stop_ = false;
stop_condition_.notify_one();
}
}
void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
{
std::unique_lock<std::mutex> its_lock(mutex_);
while (wait_until_registered_) {
@@ -198,11 +201,14 @@ public:
}
void wait_for_stop() {
+ static int its_call_number(0);
+ its_call_number++;
+
std::unique_lock<std::mutex> its_lock(stop_mutex_);
while (wait_for_stop_) {
stop_condition_.wait(its_lock);
}
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
+ VSOMEIP_INFO << "(" << std::dec << its_call_number << ") [" << std::setw(4) << std::setfill('0') << std::hex
<< service_info_.service_id
<< "] shutdown method was called, going down";
while(!called_other_node_) {
diff --git a/test/magic_cookies_tests/magic_cookies_test_client.cpp b/test/magic_cookies_tests/magic_cookies_test_client.cpp
index 4be0889..dc02309 100644
--- a/test/magic_cookies_tests/magic_cookies_test_client.cpp
+++ b/test/magic_cookies_tests/magic_cookies_test_client.cpp
@@ -21,7 +21,6 @@ class magic_cookies_test_client {
public:
magic_cookies_test_client()
: app_(new vsomeip::application_impl("")),
- is_available_(false),
is_blocked_(false),
sent_messages_good_(8),
sent_messages_bad_(7),
@@ -53,7 +52,8 @@ public:
app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
std::bind(&magic_cookies_test_client::on_availability,
this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
+ vsomeip::DEFAULT_MAJOR, vsomeip::DEFAULT_MINOR);
}
void start() {
@@ -72,8 +72,7 @@ public:
VSOMEIP_INFO << "Client registration done.";
app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR,
- false);
+ vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR);
}
}
@@ -162,49 +161,49 @@ public:
// Test sequence
its_good_payload_data[11] = 0x01;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x02;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x03;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x04;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x05;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x06;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x07;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x08;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x09;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x0A;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x0B;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x0C;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x0D;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x0E;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x0F;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true);
while (wait_for_replies_) {
if(std::cv_status::timeout ==
@@ -222,7 +221,6 @@ private:
std::shared_ptr< vsomeip::application_impl > app_;
std::mutex mutex_;
std::condition_variable condition_;
- bool is_available_;
bool is_blocked_;
const std::uint32_t sent_messages_good_;
const std::uint32_t sent_messages_bad_;
diff --git a/test/magic_cookies_tests/magic_cookies_test_service.cpp b/test/magic_cookies_tests/magic_cookies_test_service.cpp
index 7cd4376..d8ac4d7 100644
--- a/test/magic_cookies_tests/magic_cookies_test_service.cpp
+++ b/test/magic_cookies_tests/magic_cookies_test_service.cpp
@@ -92,11 +92,11 @@ public:
->create_payload();
std::vector<vsomeip::byte_t> its_payload_data;
for (std::size_t i = 0; i < 120; ++i)
- its_payload_data.push_back(i % 256);
+ its_payload_data.push_back(static_cast<vsomeip::byte_t>(i % 256));
its_payload->set_data(its_payload_data);
its_response->set_payload(its_payload);
- app_->send(its_response, true);
+ app_->send(its_response);
if(_request->get_session() == 0x0F) {
std::lock_guard<std::mutex> its_lock(mutex_);
blocked_ = true;
diff --git a/test/magic_cookies_tests/magic_cookies_test_starter.sh b/test/magic_cookies_tests/magic_cookies_test_starter.sh
index 631eef7..c5342fc 100755
--- a/test/magic_cookies_tests/magic_cookies_test_starter.sh
+++ b/test/magic_cookies_tests/magic_cookies_test_starter.sh
@@ -17,9 +17,9 @@ FAIL=0
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting magic cookies 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/test; ./magic_cookies_test_client_start.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; ./magic_cookies_test_client_start.sh\"" &
elif [ ! -z "$USE_DOCKER" ]; then
- docker run $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./magic_cookies_test_client_start.sh" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./magic_cookies_test_client_start.sh" &
else
cat <<End-of-message
*******************************************************************************
diff --git a/test/malicious_data_tests/conf/malicious_data_test_master.json.in b/test/malicious_data_tests/conf/malicious_data_test_master.json.in
index 066989b..5c2e511 100644
--- a/test/malicious_data_tests/conf/malicious_data_test_master.json.in
+++ b/test/malicious_data_tests/conf/malicious_data_test_master.json.in
@@ -32,7 +32,7 @@
}
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in b/test/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in
index 5072632..87bb0d4 100755
--- a/test/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in
+++ b/test/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in
@@ -24,7 +24,7 @@ TESTMODE=$1
export VSOMEIP_CONFIGURATION=malicious_data_test_master.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the services
./malicious_data_test_service $TESTMODE &
@@ -36,10 +36,12 @@ if [ ! -z "$USE_LXC_TEST" ]; then
echo "Waiting for 5s"
sleep 5
echo "starting offer test on slave LXC offer_test_external_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/test; ./malicious_data_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE\"" &
+ 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; ./malicious_data_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE\"" &
echo "remote ssh pid: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./malicious_data_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE" &
+ echo "Waiting for 5s"
+ sleep 5
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && sleep 10; ./malicious_data_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE" &
else
cat <<End-of-message
*******************************************************************************
@@ -67,10 +69,5 @@ done
kill $PID_VSOMEIPD
sleep 1
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otems
- docker rm otems
-fi
-
# Check if everything went well
exit $FAIL
diff --git a/test/malicious_data_tests/malicious_data_test_msg_sender.cpp b/test/malicious_data_tests/malicious_data_test_msg_sender.cpp
index 84d09bf..bd9b305 100644
--- a/test/malicious_data_tests/malicious_data_test_msg_sender.cpp
+++ b/test/malicious_data_tests/malicious_data_test_msg_sender.cpp
@@ -92,7 +92,7 @@ TEST_F(malicious_data, send_malicious_events)
vsomeip::sd::message_impl sd_msg;
EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
EXPECT_EQ(1u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
+ for (const auto& e : sd_msg.get_entries()) {
if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP) {
EXPECT_TRUE(e->is_eventgroup_entry());
EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP, e->get_type());
@@ -321,7 +321,7 @@ TEST_F(malicious_data, send_wrong_protocol_version)
vsomeip::sd::message_impl sd_msg;
EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
EXPECT_EQ(1u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
+ for (const auto& e : sd_msg.get_entries()) {
if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP && !client_subscribed) {
EXPECT_TRUE(e->is_eventgroup_entry());
EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP, e->get_type());
@@ -543,6 +543,13 @@ TEST_F(malicious_data, send_wrong_protocol_version)
std::size_t bytes_transferred = tcp_socket2.receive(
boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (!error) {
+ #if 0
+ std::stringstream str;
+ for (size_t i = 0; i < bytes_transferred; i++) {
+ str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
+ }
+ std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
+ #endif
vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
std::shared_ptr<vsomeip::message> its_message(its_deserializer.deserialize_message());
EXPECT_EQ(0x3345, its_message->get_service());
@@ -701,7 +708,7 @@ TEST_F(malicious_data, send_wrong_message_type)
vsomeip::sd::message_impl sd_msg;
EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
EXPECT_EQ(1u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
+ for (const auto& e : sd_msg.get_entries()) {
if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP && !client_subscribed) {
EXPECT_TRUE(e->is_eventgroup_entry());
EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP, e->get_type());
@@ -1000,7 +1007,7 @@ TEST_F(malicious_data, send_wrong_return_code)
vsomeip::sd::message_impl sd_msg;
EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
EXPECT_EQ(1u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
+ for (const auto& e : sd_msg.get_entries()) {
if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP && !client_subscribed) {
EXPECT_TRUE(e->is_eventgroup_entry());
EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP, e->get_type());
@@ -1304,7 +1311,7 @@ TEST_F(malicious_data, wrong_header_fields_udp)
vsomeip::sd::message_impl sd_msg;
EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
EXPECT_EQ(1u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
+ for (const auto& e : sd_msg.get_entries()) {
if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP && !client_subscribed) {
EXPECT_TRUE(e->is_eventgroup_entry());
EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP, e->get_type());
@@ -1345,7 +1352,7 @@ TEST_F(malicious_data, wrong_header_fields_udp)
std::static_pointer_cast<vsomeip::sd::serviceentry_impl>(e);
EXPECT_EQ(0u, its_casted_entry->get_minor_version());
}
- for (const auto op : sd_msg.get_options()) {
+ for (const auto& op : sd_msg.get_options()) {
EXPECT_EQ(op->get_type(), vsomeip::sd::option_type_e::IP4_ENDPOINT);
EXPECT_EQ(op->get_length(), 9u);
if (op->get_type() == vsomeip::sd::option_type_e::IP4_ENDPOINT) {
diff --git a/test/malicious_data_tests/malicious_data_test_service.cpp b/test/malicious_data_tests/malicious_data_test_service.cpp
index cc4999e..408ecb3 100644
--- a/test/malicious_data_tests/malicious_data_test_service.cpp
+++ b/test/malicious_data_tests/malicious_data_test_service.cpp
@@ -17,7 +17,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "malicious_data_test_globals.hpp"
@@ -43,7 +43,7 @@ public:
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(_service_info.eventgroup_id);
app_->request_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, false);
+ service_info_.event_id, its_eventgroups, vsomeip::event_type_e::ET_EVENT);
app_->register_message_handler(vsomeip::ANY_SERVICE,
vsomeip::ANY_INSTANCE, service_info_.shutdown_method_id,
std::bind(&malicious_data_test_service::on_shutdown_method_called, this,
@@ -62,9 +62,6 @@ public:
app_->request_service(service_info_.service_id, service_info_.instance_id);
app_->subscribe(service_info_.service_id, service_info_.instance_id,
service_info_.eventgroup_id, 0,
- (testmode_ == malicious_data_test::test_mode_e::WRONG_HEADER_FIELDS_UDP) ?
- vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE :
- vsomeip::subscription_type_e::SU_RELIABLE,
service_info_.event_id);
app_->start();
diff --git a/test/npdu_tests/conf/npdu_test_client_no_npdu.json.in b/test/npdu_tests/conf/npdu_test_client_no_npdu.json.in
new file mode 100644
index 0000000..07cfe08
--- /dev/null
+++ b/test/npdu_tests/conf/npdu_test_client_no_npdu.json.in
@@ -0,0 +1,39 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"npdu_test_routing_manager_daemon_client_side",
+ "id":"0x6666"
+ },
+ {
+ "name":"npdu_test_client_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"npdu_test_client_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"npdu_test_client_three",
+ "id":"0x3333"
+ },
+ {
+ "name":"npdu_test_client_four",
+ "id":"0x4444"
+ }
+ ],
+ "routing":"npdu_test_routing_manager_daemon_client_side",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/npdu_tests/conf/npdu_test_client_npdu.json.in b/test/npdu_tests/conf/npdu_test_client_npdu.json.in
new file mode 100644
index 0000000..dc35023
--- /dev/null
+++ b/test/npdu_tests/conf/npdu_test_client_npdu.json.in
@@ -0,0 +1,167 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"npdu_test_routing_manager_daemon_client_side",
+ "id":"0x6666"
+ },
+ {
+ "name":"npdu_test_client_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"npdu_test_client_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"npdu_test_client_three",
+ "id":"0x3333"
+ },
+ {
+ "name":"npdu_test_client_four",
+ "id":"0x4444"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unicast":"@TEST_IP_MASTER@",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times":
+ {
+ "requests" : {
+ "0x1001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x1002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x1003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x1004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0002",
+ "unicast":"@TEST_IP_MASTER@",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times" : {
+ "requests" : {
+ "0x2001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x2002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x2003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x2004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x3000",
+ "instance":"0x0003",
+ "unicast":"@TEST_IP_MASTER@",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times" : {
+ "requests" : {
+ "0x3001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x3002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x3003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x3004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0004",
+ "unicast":"@TEST_IP_MASTER@",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times": {
+ "requests" : {
+ "0x4001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x4002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x4003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x4004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ }
+ ],
+ "routing":"npdu_test_routing_manager_daemon_client_side",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/npdu_tests/conf/npdu_test_service_no_npdu.json.in b/test/npdu_tests/conf/npdu_test_service_no_npdu.json.in
new file mode 100644
index 0000000..b4c8eaa
--- /dev/null
+++ b/test/npdu_tests/conf/npdu_test_service_no_npdu.json.in
@@ -0,0 +1,87 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"npdu_test_routing_manager_daemon_service_side",
+ "id":"0x6667"
+ },
+ {
+ "name":"npdu_test_service_one",
+ "id":"0x1000"
+ },
+ {
+ "name":"npdu_test_service_two",
+ "id":"0x2000"
+ },
+ {
+ "name":"npdu_test_service_three",
+ "id":"0x3000"
+ },
+ {
+ "name":"npdu_test_service_four",
+ "id":"0x4000"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x6667",
+ "instance":"0x6666",
+ "unreliable":"60666"
+ },
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0002",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x3000",
+ "instance":"0x0003",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0004",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"npdu_test_routing_manager_daemon_service_side",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/npdu_tests/conf/npdu_test_service_npdu.json.in b/test/npdu_tests/conf/npdu_test_service_npdu.json.in
new file mode 100644
index 0000000..0de75cf
--- /dev/null
+++ b/test/npdu_tests/conf/npdu_test_service_npdu.json.in
@@ -0,0 +1,168 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"npdu_test_routing_manager_daemon_service_side",
+ "id":"0x6667"
+ },
+ {
+ "name":"npdu_test_service_one",
+ "id":"0x1000"
+ },
+ {
+ "name":"npdu_test_service_two",
+ "id":"0x2000"
+ },
+ {
+ "name":"npdu_test_service_three",
+ "id":"0x3000"
+ },
+ {
+ "name":"npdu_test_service_four",
+ "id":"0x4000"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x6667",
+ "instance":"0x6666",
+ "unreliable":"60666"
+ },
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times":
+ {
+ "responses" : {
+ "0x1001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x1002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x1003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x1004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0002",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times" : {
+ "responses" : {
+ "0x2001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x2002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x2003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x2004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x3000",
+ "instance":"0x0003",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times" : {
+ "responses" : {
+ "0x3001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x3002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x3003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x3004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0004",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times": {
+ "responses" : {
+ "0x4001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x4002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x4003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x4004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ }
+ ],
+ "routing":"npdu_test_routing_manager_daemon_service_side",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/npdu_tests/npdu_test_client.cpp b/test/npdu_tests/npdu_test_client.cpp
new file mode 100644
index 0000000..ca29aa6
--- /dev/null
+++ b/test/npdu_tests/npdu_test_client.cpp
@@ -0,0 +1,599 @@
+// Copyright (C) 2015-2019 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 "../npdu_tests/npdu_test_client.hpp"
+
+#include <vsomeip/internal/logger.hpp>
+#include "../../implementation/configuration/include/configuration.hpp"
+#include "../../implementation/configuration/include/configuration_impl.hpp"
+#include "../../implementation/configuration/include/configuration_plugin.hpp"
+#include "../../implementation/plugin/include/plugin_manager_impl.hpp"
+
+enum class payloadsize
+ : std::uint8_t
+ {
+ UDS, TCP, UDP
+};
+
+// this variables are changed via cmdline parameters
+static bool use_tcp = false;
+static bool call_service_sync = true;
+static bool wait_for_replies = true;
+static std::uint32_t sliding_window_size = vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND;
+static payloadsize max_payload_size = payloadsize::UDS;
+static bool shutdown_service_at_end = true;
+
+npdu_test_client::npdu_test_client(
+ bool _use_tcp,
+ bool _call_service_sync,
+ std::uint32_t _sliding_window_size,
+ bool _wait_for_replies,
+ std::array<std::array<std::chrono::milliseconds, 4>, 4> _applicative_debounce) :
+ app_(vsomeip::runtime::get()->create_application()),
+ request_(vsomeip::runtime::get()->create_request(_use_tcp)),
+ call_service_sync_(_call_service_sync),
+ wait_for_replies_(_wait_for_replies),
+ sliding_window_size_(_sliding_window_size),
+ blocked_({false}),
+ is_available_({false}), // will set first element to false, rest to 0
+ number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND),
+ number_of_sent_messages_{0,0,0,0},
+ number_of_acknowledged_messages_{{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ current_payload_size_({0}),
+ all_msg_acknowledged_({false, false, false, false}),
+ acknowledgements_{0,0,0,0},
+ applicative_debounce_(_applicative_debounce),
+ finished_waiter_(&npdu_test_client::wait_for_all_senders, this)
+{
+ senders_[0] = std::thread(&npdu_test_client::run<0>, this);
+ senders_[1] = std::thread(&npdu_test_client::run<1>, this);
+ senders_[2] = std::thread(&npdu_test_client::run<2>, this);
+ senders_[3] = std::thread(&npdu_test_client::run<3>, this);
+}
+
+npdu_test_client::~npdu_test_client() {
+ finished_waiter_.join();
+}
+
+void npdu_test_client::init()
+{
+ app_->init();
+
+ app_->register_state_handler(
+ std::bind(&npdu_test_client::on_state, this,
+ std::placeholders::_1));
+
+ register_availability_handler<0>();
+ register_availability_handler<1>();
+ register_availability_handler<2>();
+ register_availability_handler<3>();
+
+ register_message_handler_for_all_service_methods<0>();
+ register_message_handler_for_all_service_methods<1>();
+ register_message_handler_for_all_service_methods<2>();
+ register_message_handler_for_all_service_methods<3>();
+
+ request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
+ request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+ if(!wait_for_replies_)
+ request_->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
+}
+
+template<int service_idx>
+void npdu_test_client::register_availability_handler() {
+ app_->register_availability_handler(npdu_test::service_ids[service_idx],
+ npdu_test::instance_ids[service_idx],
+ std::bind(
+ &npdu_test_client::on_availability<service_idx>,
+ this, std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3));
+}
+
+template<int service_idx>
+void npdu_test_client::register_message_handler_for_all_service_methods() {
+ register_message_handler<service_idx, 0>();
+ register_message_handler<service_idx, 1>();
+ register_message_handler<service_idx, 2>();
+ register_message_handler<service_idx, 3>();
+}
+
+template<int service_idx, int method_idx>
+void npdu_test_client::register_message_handler() {
+ app_->register_message_handler(npdu_test::service_ids[service_idx],
+ npdu_test::instance_ids[service_idx],
+ npdu_test::method_ids[service_idx][method_idx],
+ std::bind(
+ &npdu_test_client::on_message<service_idx, method_idx>,
+ this, std::placeholders::_1));
+}
+
+void npdu_test_client::start()
+{
+ VSOMEIP_INFO << "Starting...";
+ app_->start();
+}
+
+void npdu_test_client::stop()
+{
+ VSOMEIP_INFO << "Stopping...";
+
+ app_->unregister_state_handler();
+
+ for (unsigned int i = 0; i< npdu_test::service_ids.size(); i++) {
+ app_->unregister_availability_handler(npdu_test::service_ids[i],
+ npdu_test::instance_ids[i]);
+
+ for(unsigned int j = 0; j < npdu_test::method_ids[i].size(); j++) {
+ app_->unregister_message_handler(npdu_test::service_ids[i],
+ npdu_test::instance_ids[i],
+ npdu_test::method_ids[i][j]);
+ }
+ }
+
+ if(shutdown_service_at_end) {
+ // notify the routing manager daemon that were finished
+ request_->set_service(npdu_test::RMD_SERVICE_ID_CLIENT_SIDE);
+ request_->set_instance(npdu_test::RMD_INSTANCE_ID);
+ request_->set_method(npdu_test::RMD_SHUTDOWN_METHOD_ID);
+ request_->set_payload(vsomeip::runtime::get()->create_payload());
+ request_->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
+ app_->send(request_);
+ // sleep otherwise the app will shutdown before the message reaches the rmd
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ }
+ app_->stop();
+}
+
+void npdu_test_client::join_sender_thread() {
+ for (auto& t : senders_) {
+ t.join();
+ }
+}
+
+void npdu_test_client::on_state(vsomeip::state_type_e _state)
+{
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
+ {
+ for (unsigned int i = 0; i< npdu_test::service_ids.size(); i++) {
+ app_->request_service(npdu_test::service_ids[i],
+ npdu_test::instance_ids[i]);
+ }
+ }
+}
+
+template<int service_idx>
+void npdu_test_client::on_availability(vsomeip::service_t _service,
+ vsomeip::instance_t _instance, bool _is_available)
+{
+ VSOMEIP_INFO<< "Service [" << std::setw(4) << std::setfill('0') << std::hex
+ << _service << "." << std::setw(4) << std::setfill('0') << _instance << "] is "
+ << (_is_available ? "available." : "NOT available.");
+ if(npdu_test::service_ids[service_idx] == _service
+ && npdu_test::instance_ids[service_idx] == _instance) {
+ if(is_available_[service_idx] && !_is_available)
+ {
+ is_available_[service_idx] = false;
+ }
+ else if(_is_available && !is_available_[service_idx])
+ {
+ is_available_[service_idx] = true;
+ send<service_idx>();
+ }
+ }
+}
+
+template<int service_idx, int method_idx>
+void npdu_test_client::on_message(const std::shared_ptr<vsomeip::message>& _response) {
+ (void)_response;
+ //TODO make sure the replies were sent within demanded debounce times
+ VSOMEIP_DEBUG << "Received reply from:" << std::setw(4) << std::setfill('0')
+ << std::hex << npdu_test::service_ids[service_idx] << ":"
+ << std::setw(4) << std::setfill('0') << std::hex
+ << npdu_test::instance_ids[service_idx] << ":" << std::setw(4)
+ << std::setfill('0') << std::hex
+ << npdu_test::method_ids[service_idx][method_idx];
+
+ if(call_service_sync_)
+ {
+ // We notify the sender thread every time a message was acknowledged
+ std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutexes_[service_idx][method_idx]);
+ all_msg_acknowledged_[service_idx][method_idx] = true;
+ all_msg_acknowledged_cvs_[service_idx][method_idx].notify_one();
+ }
+ else
+ {
+
+ std::lock_guard<std::mutex> its_lock(number_of_acknowledged_messages_mutexes_[service_idx][method_idx]);
+ number_of_acknowledged_messages_[service_idx][method_idx]++;
+
+ // We notify the sender thread only if all sent messages have been acknowledged
+ if(number_of_acknowledged_messages_[service_idx][method_idx] == number_of_messages_to_send_)
+ {
+ std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutexes_[service_idx][method_idx]);
+ // reset
+ number_of_acknowledged_messages_[service_idx][method_idx] = 0;
+ all_msg_acknowledged_[service_idx][method_idx] = true;
+ all_msg_acknowledged_cvs_[service_idx][method_idx].notify_one();
+ } else if(number_of_acknowledged_messages_[service_idx][method_idx] % sliding_window_size == 0)
+ {
+ std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutexes_[service_idx][method_idx]);
+ all_msg_acknowledged_[service_idx][method_idx] = true;
+ all_msg_acknowledged_cvs_[service_idx][method_idx].notify_one();
+ }
+ }
+}
+
+template<int service_idx>
+void npdu_test_client::send()
+{
+ std::lock_guard<std::mutex> its_lock(mutexes_[service_idx]);
+ blocked_[service_idx] = true;
+ conditions_[service_idx].notify_one();
+}
+
+template<int service_idx>
+void npdu_test_client::run()
+{
+ std::unique_lock<std::mutex> its_lock(mutexes_[service_idx]);
+ while (!blocked_[service_idx])
+ {
+ conditions_[service_idx].wait(its_lock);
+ }
+ current_payload_size_[service_idx] = 1;
+
+ std::uint32_t max_allowed_payload = get_max_allowed_payload();
+
+ for (int var = 0; var < 4; ++var) {
+ payloads_[service_idx][var] = vsomeip::runtime::get()->create_payload();
+ payload_data_[service_idx][var] = std::vector<vsomeip::byte_t>();
+ }
+
+ bool lastrun = false;
+ while (current_payload_size_[service_idx] <= max_allowed_payload)
+ {
+ // prepare the payloads w/ current payloadsize
+ for (int var = 0; var < 4; ++var) {
+ // assign 0x11 to first, 0x22 to second...
+ payload_data_[service_idx][var].assign(
+ current_payload_size_[service_idx], static_cast<vsomeip::byte_t>(0x11 * (var + 1)));
+ payloads_[service_idx][var]->set_data(payload_data_[service_idx][var]);
+ }
+
+ // send the payloads to the service's methods
+ if(wait_for_replies_) {
+ call_service_sync_ ? send_messages_sync<service_idx>() : send_messages_async<service_idx>();
+ } else {
+ send_messages_and_dont_wait_for_reply<service_idx>();
+ }
+
+ // Increase array size for next iteration
+ current_payload_size_[service_idx] *= 2;
+
+ //special case to test the biggest payload possible as last test
+ // 16 Bytes are reserved for the SOME/IP header
+ if(current_payload_size_[service_idx] > max_allowed_payload - 16 && !lastrun)
+ {
+ current_payload_size_[service_idx] = max_allowed_payload - 16;
+ lastrun = true;
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ blocked_[service_idx] = false;
+
+ {
+ std::lock_guard<std::mutex> its_lock(finished_mutex_);
+ finished_[service_idx] = true;
+ }
+}
+
+
+std::uint32_t npdu_test_client::get_max_allowed_payload()
+{
+ std::uint32_t payload;
+ switch (max_payload_size)
+ {
+ case payloadsize::UDS:
+ payload = VSOMEIP_MAX_LOCAL_MESSAGE_SIZE;
+ break;
+ case payloadsize::TCP:
+ payload = 4095;
+ break;
+ case payloadsize::UDP:
+ payload = VSOMEIP_MAX_UDP_MESSAGE_SIZE;
+ break;
+ default:
+ payload = VSOMEIP_MAX_LOCAL_MESSAGE_SIZE;
+ break;
+ }
+ return payload;
+}
+
+template<int service_idx>
+void npdu_test_client::send_messages_sync()
+{
+ std::thread t0 = start_send_thread_sync<service_idx, 0>();
+ std::thread t1 = start_send_thread_sync<service_idx, 1>();
+ std::thread t2 = start_send_thread_sync<service_idx, 2>();
+ std::thread t3 = start_send_thread_sync<service_idx, 3>();
+ t0.join();
+ t1.join();
+ t2.join();
+ t3.join();
+}
+
+template<int service_idx, int method_idx>
+std::thread npdu_test_client::start_send_thread_sync() {
+ return std::thread([&]() {
+ all_msg_acknowledged_unique_locks_[service_idx][method_idx] =
+ std::unique_lock<std::mutex>
+ (all_msg_acknowledged_mutexes_[service_idx][method_idx]);
+
+ std::shared_ptr<vsomeip::message> request = vsomeip::runtime::get()->create_request(use_tcp);
+ request->set_service(npdu_test::service_ids[service_idx]);
+ request->set_instance(npdu_test::instance_ids[service_idx]);
+ request->set_method(npdu_test::method_ids[service_idx][method_idx]);
+ request->set_payload(payloads_[service_idx][method_idx]);
+ for (std::uint32_t i = 0; i < number_of_messages_to_send_; i++)
+ {
+ all_msg_acknowledged_[service_idx][method_idx] = false;
+ app_->send(request);
+
+ std::chrono::high_resolution_clock::time_point sent =
+ std::chrono::high_resolution_clock::now();
+
+ while(!all_msg_acknowledged_[service_idx][method_idx]) {
+ all_msg_acknowledged_cvs_[service_idx][method_idx].wait(
+ all_msg_acknowledged_unique_locks_[service_idx][method_idx]);
+ }
+
+ std::chrono::nanoseconds waited_for_response =
+ std::chrono::high_resolution_clock::now() - sent;
+ if(waited_for_response < applicative_debounce_[service_idx][method_idx]) {
+ // make sure we don't send faster than debounce time + max retention time
+ std::this_thread::sleep_for(
+ applicative_debounce_[service_idx][method_idx]
+ - waited_for_response);
+ }
+ }
+ all_msg_acknowledged_unique_locks_[service_idx][method_idx].unlock();
+ });
+}
+
+template<int service_idx>
+void npdu_test_client::send_messages_async()
+{
+ std::thread t0 = start_send_thread_async<service_idx, 0>();
+ std::thread t1 = start_send_thread_async<service_idx, 1>();
+ std::thread t2 = start_send_thread_async<service_idx, 2>();
+ std::thread t3 = start_send_thread_async<service_idx, 3>();
+ t0.join();
+ t1.join();
+ t2.join();
+ t3.join();
+}
+
+template<int service_idx, int method_idx>
+std::thread npdu_test_client::start_send_thread_async() {
+ return std::thread([&]() {
+ all_msg_acknowledged_unique_locks_[service_idx][method_idx] =
+ std::unique_lock<std::mutex>
+ (all_msg_acknowledged_mutexes_[service_idx][method_idx]);
+ std::shared_ptr<vsomeip::message> request = vsomeip::runtime::get()->create_request(use_tcp);
+ request->set_service(npdu_test::service_ids[service_idx]);
+ request->set_instance(npdu_test::instance_ids[service_idx]);
+ request->set_method(npdu_test::method_ids[service_idx][method_idx]);
+ request->set_payload(payloads_[service_idx][method_idx]);
+ for (std::uint32_t i = 0; i < number_of_messages_to_send_; i++)
+ {
+ app_->send(request);
+
+ if((i+1) == number_of_messages_to_send_ || (i+1) % sliding_window_size == 0) {
+ // wait until all send messages have been acknowledged
+ // as long we wait lk is released; after wait returns lk is reacquired
+ while(!all_msg_acknowledged_[service_idx][method_idx]) {
+ all_msg_acknowledged_cvs_[service_idx][method_idx].wait(
+ all_msg_acknowledged_unique_locks_[service_idx][method_idx]);
+ }
+ // Reset condition variable
+ all_msg_acknowledged_[service_idx][method_idx] = false;
+ }
+ // make sure we don't send faster than debounce time + max retention time
+ std::this_thread::sleep_for(applicative_debounce_[service_idx][method_idx]);
+ }
+ all_msg_acknowledged_unique_locks_[service_idx][method_idx].unlock();
+ });
+}
+
+template<int service_idx>
+void npdu_test_client::send_messages_and_dont_wait_for_reply()
+{
+ std::thread t0 = start_send_thread<service_idx, 0>();
+ std::thread t1 = start_send_thread<service_idx, 1>();
+ std::thread t2 = start_send_thread<service_idx, 2>();
+ std::thread t3 = start_send_thread<service_idx, 3>();
+ t0.join();
+ t1.join();
+ t2.join();
+ t3.join();
+}
+
+template<int service_idx, int method_idx>
+std::thread npdu_test_client::start_send_thread() {
+ return std::thread([&]() {
+ std::shared_ptr<vsomeip::message> request = vsomeip::runtime::get()->create_request(use_tcp);
+ request->set_service(npdu_test::service_ids[service_idx]);
+ request->set_instance(npdu_test::instance_ids[service_idx]);
+ request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
+ request->set_method(npdu_test::method_ids[service_idx][method_idx]);
+ request->set_payload(payloads_[service_idx][method_idx]);
+ for (std::uint32_t i = 0; i < number_of_messages_to_send_; i++)
+ {
+ app_->send(request);
+ // make sure we don't send faster than debounce time + max retention time
+ std::this_thread::sleep_for(applicative_debounce_[service_idx][method_idx]);
+ }
+ });
+}
+
+void npdu_test_client::wait_for_all_senders() {
+ bool all_finished(false);
+ while (!all_finished) {
+ {
+ std::lock_guard<std::mutex> its_lock(finished_mutex_);
+ if (std::all_of(finished_.begin(), finished_.end(), [](bool i) { return i; })) {
+ all_finished = true;
+ }
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ join_sender_thread();
+
+ if (!wait_for_replies_ || !call_service_sync_) {
+ // sleep longer here as sending is asynchronously and it's necessary
+ // to wait until all messages have left the application
+ VSOMEIP_INFO << "Sleeping for 180sec since the client is running "
+ "in --dont-wait-for-replies or --async mode. "
+ "Otherwise it might be possible that not all messages leave the "
+ "application.";
+ for(int i = 0; i < 180; i++) {
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ std::cout << ".";
+ std::cout.flush();
+ }
+ } else {
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ }
+ stop();
+}
+
+TEST(someip_npdu_test, send_different_payloads)
+{
+ // get the configuration
+ std::shared_ptr<vsomeip::configuration> its_configuration;
+ auto its_plugin = vsomeip::plugin_manager::get()->get_plugin(
+ vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY);
+ if (its_plugin) {
+ auto its_config_plugin = std::dynamic_pointer_cast<vsomeip::configuration_plugin>(its_plugin);
+ if (its_config_plugin) {
+ its_configuration = its_config_plugin->get_configuration("");
+ }
+ }
+ if (!its_configuration) {
+ ADD_FAILURE() << "No configuration object. "
+ "Either memory overflow or loading error detected!";
+ return;
+ }
+
+ // used to store the debounce times
+ std::array<std::array<std::chrono::milliseconds, 4>, 4> applicative_debounce;
+
+ // query the debouncetimes from the configuration. We want to know the
+ // debounce times which the _clients_ of this service have to comply with
+ // when they send requests to this service.
+ // This is necessary as we must ensure a applicative debouncing greater than
+ // debounce time + maximum retention time. Therefore the send threads sleep
+ // for this amount of time after sending a message.
+ for(int service_id = 0; service_id < 4; service_id++) {
+ for(int method_id = 0; method_id < 4; method_id++) {
+ std::chrono::nanoseconds debounce(0), retention(0);
+ its_configuration->get_configured_timing_requests(
+ npdu_test::service_ids[service_id],
+ its_configuration->get_unicast_address(npdu_test::service_ids[service_id],
+ npdu_test::instance_ids[service_id]),
+ its_configuration->get_unreliable_port(
+ npdu_test::service_ids[service_id],
+ npdu_test::instance_ids[service_id]),
+ npdu_test::method_ids[service_id][method_id],
+ &debounce, &retention);
+ if (debounce == std::chrono::nanoseconds(VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO) &&
+ retention == std::chrono::nanoseconds(VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO)) {
+ // no timings specified don't don't sleep after sending...
+ applicative_debounce[service_id][method_id] =
+ std::chrono::milliseconds(0);
+ } else {
+ // we add 1 milliseconds to sleep a little bit longer
+ applicative_debounce[service_id][method_id] = std::chrono::duration_cast<
+ std::chrono::milliseconds>(debounce + retention)
+ + std::chrono::milliseconds(1);
+
+ }
+
+ }
+ }
+
+ npdu_test_client test_client_(use_tcp, call_service_sync,
+ sliding_window_size, wait_for_replies,
+ applicative_debounce);
+ test_client_.init();
+ test_client_.start();
+}
+
+
+#ifndef _WIN32
+int main(int argc, char** argv)
+{
+ std::string tcp_enable("--TCP");
+ std::string udp_enable("--UDP");
+ std::string sync_enable("--sync");
+ std::string async_enable("--async");
+ std::string no_reply_enable("--dont-wait-for-replies");
+ std::string sliding_window_size_param("--sliding-window-size");
+ std::string max_payload_size_param("--max-payload-size");
+ std::string shutdown_service_disable_param("--dont-shutdown-service");
+ std::string help("--help");
+
+ int i = 1;
+ while (i < argc)
+ {
+ if (tcp_enable == argv[i]) {
+ use_tcp = true;
+ } else if (udp_enable == argv[i]) {
+ use_tcp = false;
+ } else if (sync_enable == argv[i]) {
+ call_service_sync = true;
+ } else if (async_enable == argv[i]) {
+ call_service_sync = false;
+ } else if (no_reply_enable == argv[i]) {
+ wait_for_replies = false;
+ } else if (sliding_window_size_param == argv[i] && i + 1 < argc) {
+ i++;
+ std::stringstream converter(argv[i]);
+ converter >> sliding_window_size;
+ } else if (max_payload_size_param == argv[i] && i + 1 < argc) {
+ i++;
+ if (std::string("UDS") == argv[i]) {
+ max_payload_size = payloadsize::UDS;
+ } else if (std::string("TCP") == argv[i]) {
+ max_payload_size = payloadsize::TCP;
+ } else if (std::string("UDP") == argv[i]) {
+ max_payload_size = payloadsize::UDP;
+ }
+ } else if (shutdown_service_disable_param == argv[i]) {
+ shutdown_service_at_end = false;
+ } else if (help == argv[i]) {
+ VSOMEIP_INFO << "Parameters:\n"
+ << "--TCP: Send messages via TCP\n"
+ << "--UDP: Send messages via UDP (default)\n"
+ << "--sync: Wait for acknowledge before sending next message (default)\n"
+ << "--async: Send multiple messages w/o waiting for"
+ " acknowledge of service\n"
+ << "--dont-wait-for-replies: Just send out the messages w/o waiting for "
+ "a reply by the service (use REQUEST_NO_RETURN message type)\n"
+ << "--sliding-window-size: Number of messages to send before waiting "
+ "for acknowledge of service. Default: " << sliding_window_size << "\n"
+ << "--max-payload-size: limit the maximum payloadsize of send requests. One of {"
+ "UDS (=" << VSOMEIP_MAX_LOCAL_MESSAGE_SIZE << "byte), "
+ "UDP (=" << VSOMEIP_MAX_UDP_MESSAGE_SIZE << "byte), "
+ "TCP (=" << VSOMEIP_MAX_TCP_MESSAGE_SIZE << "byte)}, default: UDS\n"
+ << "--dont-shutdown-service: Don't shutdown the service upon "
+ "finishing of the payload test\n"
+ << "--help: print this help";
+ }
+ i++;
+ }
+
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/npdu_tests/npdu_test_client.hpp b/test/npdu_tests/npdu_test_client.hpp
new file mode 100644
index 0000000..980c16a
--- /dev/null
+++ b/test/npdu_tests/npdu_test_client.hpp
@@ -0,0 +1,103 @@
+// Copyright (C) 2015-2019 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 PAYLOADTESTCLIENT_HPP_
+#define NPDUTESTCLIENT_HPP_
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include <thread>
+#include <mutex>
+#include <condition_variable>
+#include <functional>
+#include <map>
+
+#include "../npdu_tests/npdu_test_globals.hpp"
+#include "../someip_test_globals.hpp"
+
+class npdu_test_client
+{
+public:
+ npdu_test_client(bool _use_tcp, bool _call_service_sync,
+ std::uint32_t _sliding_window_size,
+ bool _wait_for_replies,
+ std::array<std::array<std::chrono::milliseconds, 4>, 4> _applicative_debounce);
+ ~npdu_test_client();
+ void init();
+ void start();
+ void stop();
+ void join_sender_thread();
+ void on_state(vsomeip::state_type_e _state);
+ template<int service_idx> void on_availability(vsomeip::service_t _service,
+ vsomeip::instance_t _instance,
+ bool _is_available);
+ template<int service_idx, int method_idx> void on_message(
+ const std::shared_ptr<vsomeip::message> &_response);
+ template<int service_idx> void send();
+ template<int service_idx> void run();
+
+private:
+ template<int service_idx> void send_messages_sync();
+ template<int service_idx, int method_idx> std::thread start_send_thread_sync();
+ template<int service_idx> void send_messages_async();
+ template<int service_idx, int method_idx> std::thread start_send_thread_async();
+ template<int service_idx> void send_messages_and_dont_wait_for_reply();
+ std::uint32_t get_max_allowed_payload();
+ template<int service_idx> void register_availability_handler();
+ template<int service_idx> void register_message_handler_for_all_service_methods();
+ template<int service_idx, int method_idx> void register_message_handler();
+ template<int service_idx, int method_idx>
+ std::thread start_send_thread();
+ void wait_for_all_senders();
+
+private:
+ std::shared_ptr<vsomeip::application> app_;
+ std::shared_ptr<vsomeip::message> request_;
+ bool call_service_sync_;
+ bool wait_for_replies_;
+ std::uint32_t sliding_window_size_;
+
+ std::array<std::mutex, npdu_test::service_ids.size()> mutexes_;
+ std::array<std::condition_variable, npdu_test::service_ids.size()> conditions_;
+ std::array<bool, npdu_test::service_ids.size()> blocked_;
+ std::array<bool, npdu_test::service_ids.size()> is_available_;
+ const std::uint32_t number_of_messages_to_send_;
+ std::uint32_t number_of_sent_messages_[npdu_test::service_ids.size()];
+ std::array<std::array<std::uint32_t, npdu_test::method_ids[0].size()>,
+ npdu_test::service_ids.size()> number_of_acknowledged_messages_;
+ std::array<std::array<std::mutex, npdu_test::method_ids[0].size()>,
+ npdu_test::service_ids.size()> number_of_acknowledged_messages_mutexes_;
+
+ std::array<std::uint32_t, npdu_test::service_ids.size()> current_payload_size_;
+
+ std::array<std::array<bool, npdu_test::method_ids[0].size()>,
+ npdu_test::service_ids.size()> all_msg_acknowledged_;
+ std::array<std::array<std::mutex, npdu_test::method_ids[0].size()>,
+ npdu_test::service_ids.size()> all_msg_acknowledged_mutexes_;
+ std::array<std::array<std::unique_lock<std::mutex>, npdu_test::method_ids[0].size()>,
+ npdu_test::service_ids.size()> all_msg_acknowledged_unique_locks_;
+ std::array<
+ std::array<std::condition_variable,
+ npdu_test::method_ids[0].size()>,
+ npdu_test::service_ids.size()> all_msg_acknowledged_cvs_;
+ std::array<std::uint32_t, 4> acknowledgements_;
+ std::array<std::array<std::chrono::milliseconds, 4>, 4> applicative_debounce_;
+ std::array<
+ std::array<std::shared_ptr<vsomeip::payload>,
+ npdu_test::method_ids[0].size()>,
+ npdu_test::service_ids.size()> payloads_;
+ std::array<
+ std::array<std::vector<vsomeip::byte_t>,
+ npdu_test::method_ids[0].size()>,
+ npdu_test::service_ids.size()> payload_data_;
+ std::array<std::thread, npdu_test::service_ids.size()> senders_;
+ std::mutex finished_mutex_;
+ std::array<bool, npdu_test::service_ids.size()> finished_;
+ std::thread finished_waiter_;
+};
+
+#endif /* NPDUTESTCLIENT_HPP_ */
diff --git a/test/npdu_tests/npdu_test_client_no_npdu.json b/test/npdu_tests/npdu_test_client_no_npdu.json
new file mode 100644
index 0000000..6fb942f
--- /dev/null
+++ b/test/npdu_tests/npdu_test_client_no_npdu.json
@@ -0,0 +1,39 @@
+{
+ "unicast":"10.0.3.2",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"npdu_test_routing_manager_daemon_client_side",
+ "id":"0x6666"
+ },
+ {
+ "name":"npdu_test_client_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"npdu_test_client_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"npdu_test_client_three",
+ "id":"0x3333"
+ },
+ {
+ "name":"npdu_test_client_four",
+ "id":"0x4444"
+ }
+ ],
+ "routing":"npdu_test_routing_manager_daemon_client_side",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/npdu_tests/npdu_test_client_no_npdu_start.sh b/test/npdu_tests/npdu_test_client_no_npdu_start.sh
new file mode 100755
index 0000000..bc84421
--- /dev/null
+++ b/test/npdu_tests/npdu_test_client_no_npdu_start.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+# Copyright (C) 2015 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 routing manager daemon and the
+# clients 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 routing
+# manager daemon and the clients and checks if all of them exit successfully.
+
+FAIL=0
+
+if [ $# -lt 2 ]; then
+ echo "Error: Please pass a protocol and communication mode to this script."
+ echo "Valid protocols are [UDP,TCP]."
+ echo "Valid communication modes are [sync, async]."
+ echo "For example $> $0 UDP sync"
+ exit 1;
+fi
+
+FAIL=0
+PROTOCOL=$1
+COMMUNICATION_MODE=$2
+
+start_clients(){
+ export VSOMEIP_CONFIGURATION=npdu_test_client_no_npdu.json
+
+ # Start the routing manager daemon
+ export VSOMEIP_APPLICATION_NAME=npdu_test_routing_manager_daemon_client_side
+ ./npdu_test_rmd_client_side &
+
+ # sleep 1 second to let the RMD startup.
+ sleep 1
+ # Start client 1
+ export VSOMEIP_APPLICATION_NAME=npdu_test_client_one
+ ./npdu_test_client_1 $* &
+
+ # Start client 2
+ export VSOMEIP_APPLICATION_NAME=npdu_test_client_two
+ ./npdu_test_client_2 $* &
+
+ # Start client 3
+ export VSOMEIP_APPLICATION_NAME=npdu_test_client_three
+ ./npdu_test_client_3 $* &
+
+ # Start client 4
+ export VSOMEIP_APPLICATION_NAME=npdu_test_client_four
+ ./npdu_test_client_4 $* &
+}
+
+wait_for_bg_processes(){
+ # Wait until client and service are finished
+ for job in $(jobs -p)
+ do
+ # Fail gets incremented if one of the jobs exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+ done
+
+ # Check if everything exited successfully
+ if [ $FAIL -eq 0 ]
+ then
+ echo "All clients exited successfully"
+ else
+ echo "Something went wrong"
+ exit 1
+ fi
+}
+
+if [ $# -eq 0 ]
+then
+ echo "Error: Please pass a mode to this script: UDP or TCP."
+ echo "For example $> $0 UDP"
+fi
+
+echo "Contacting services via $PROTOCOL"
+start_clients --$PROTOCOL --max-payload-size $PROTOCOL --$COMMUNICATION_MODE
+wait_for_bg_processes
+
+exit 0
diff --git a/test/npdu_tests/npdu_test_client_npdu.json b/test/npdu_tests/npdu_test_client_npdu.json
new file mode 100644
index 0000000..569d426
--- /dev/null
+++ b/test/npdu_tests/npdu_test_client_npdu.json
@@ -0,0 +1,167 @@
+{
+ "unicast":"10.0.3.2",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"npdu_test_routing_manager_daemon_client_side",
+ "id":"0x6666"
+ },
+ {
+ "name":"npdu_test_client_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"npdu_test_client_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"npdu_test_client_three",
+ "id":"0x3333"
+ },
+ {
+ "name":"npdu_test_client_four",
+ "id":"0x4444"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unicast":"10.0.3.1",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times":
+ {
+ "requests" : {
+ "0x1001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x1002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x1003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x1004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0002",
+ "unicast":"10.0.3.1",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times" : {
+ "requests" : {
+ "0x2001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x2002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x2003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x2004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x3000",
+ "instance":"0x0003",
+ "unicast":"10.0.3.1",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times" : {
+ "requests" : {
+ "0x3001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x3002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x3003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x3004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0004",
+ "unicast":"10.0.3.1",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times": {
+ "requests" : {
+ "0x4001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x4002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x4003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x4004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ }
+ ],
+ "routing":"npdu_test_routing_manager_daemon_client_side",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/npdu_tests/npdu_test_client_npdu_start.sh b/test/npdu_tests/npdu_test_client_npdu_start.sh
new file mode 100755
index 0000000..70b6c53
--- /dev/null
+++ b/test/npdu_tests/npdu_test_client_npdu_start.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# Copyright (C) 2015-2019 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 routing manager daemon and the
+# clients 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 routing
+# manager daemon and the clients and checks if all of them exit successfully.
+
+if [ $# -lt 2 ]; then
+ echo "Error: Please pass a protocol and communication mode to this script."
+ echo "Valid protocols are [UDP,TCP]."
+ echo "Valid communication modes are [sync, async]."
+ echo "For example $> $0 UDP sync"
+ exit 1;
+fi
+
+FAIL=0
+PROTOCOL=$1
+COMMUNICATION_MODE=$2
+
+start_clients(){
+ export VSOMEIP_CONFIGURATION=npdu_test_client_npdu.json
+
+ # Start the routing manager daemon
+ export VSOMEIP_APPLICATION_NAME=npdu_test_routing_manager_daemon_client_side
+ ./npdu_test_rmd_client_side &
+
+ # sleep 1 second to let the RMD startup.
+ sleep 1
+ # Start client 1
+ export VSOMEIP_APPLICATION_NAME=npdu_test_client_one
+ ./npdu_test_client_1 $* &
+
+ # Start client 2
+ export VSOMEIP_APPLICATION_NAME=npdu_test_client_two
+ ./npdu_test_client_2 $* &
+
+ # Start client 3
+ export VSOMEIP_APPLICATION_NAME=npdu_test_client_three
+ ./npdu_test_client_3 $* &
+
+ # Start client 4
+ export VSOMEIP_APPLICATION_NAME=npdu_test_client_four
+ ./npdu_test_client_4 $* &
+}
+
+wait_for_bg_processes(){
+ # Wait until client and service are finished
+ for job in $(jobs -p)
+ do
+ # Fail gets incremented if one of the jobs exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+ done
+
+ # Check if everything exited successfully
+ if [ $FAIL -eq 0 ]
+ then
+ echo "All clients exited successfully"
+ else
+ echo "Something went wrong"
+ exit 1
+ fi
+}
+
+
+echo "Contacting services via $PROTOCOL"
+start_clients --$PROTOCOL --max-payload-size $PROTOCOL --$COMMUNICATION_MODE
+wait_for_bg_processes
+
+exit 0
diff --git a/test/npdu_tests/npdu_test_globals.hpp b/test/npdu_tests/npdu_test_globals.hpp
new file mode 100644
index 0000000..8cee3ee
--- /dev/null
+++ b/test/npdu_tests/npdu_test_globals.hpp
@@ -0,0 +1,45 @@
+// Copyright (C) 2015-2019 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 NPDU_TESTS_NPDU_TEST_GLOBALS_HPP_
+#define NPDU_TESTS_NPDU_TEST_GLOBALS_HPP_
+
+namespace npdu_test {
+
+// Routing manager daemon
+constexpr vsomeip::client_t RMD_CLIENT_ID_CLIENT_SIDE = 0x6666;
+constexpr vsomeip::service_t RMD_SERVICE_ID_CLIENT_SIDE = 0x6666;
+
+constexpr vsomeip::client_t RMD_CLIENT_ID_SERVICE_SIDE = 0x6667;
+constexpr vsomeip::service_t RMD_SERVICE_ID_SERVICE_SIDE = 0x6667;
+
+constexpr vsomeip::instance_t RMD_INSTANCE_ID = 0x6666;
+constexpr vsomeip::method_t RMD_SHUTDOWN_METHOD_ID = 0x6666;
+
+
+
+constexpr vsomeip::method_t NPDU_SERVICE_SHUTDOWNMETHOD_ID = 0x7777;
+
+constexpr std::array<vsomeip::service_t, 4> service_ids =
+ { 0x1000, 0x2000, 0x3000, 0x4000 };
+constexpr std::array<vsomeip::instance_t, 4> instance_ids =
+ { service_ids[0] >> 12,
+ service_ids[1] >> 12,
+ service_ids[2] >> 12,
+ service_ids[3] >> 12 };
+constexpr std::array<std::array<vsomeip::method_t, 4>, 4> method_ids = {{
+ { service_ids[0]+1, service_ids[0]+2 ,service_ids[0]+3 ,service_ids[0]+4 },
+ { service_ids[1]+1, service_ids[1]+2 ,service_ids[1]+3 ,service_ids[1]+4 },
+ { service_ids[2]+1, service_ids[2]+2 ,service_ids[2]+3 ,service_ids[2]+4 },
+ { service_ids[3]+1, service_ids[3]+2 ,service_ids[3]+3 ,service_ids[3]+4 }
+}};
+
+constexpr std::array<vsomeip::client_t, 4> client_ids_clients =
+ { 0x1111, 0x2222, 0x3333, 0x4444 };
+
+constexpr std::array<vsomeip::client_t, 4> client_ids_services = service_ids;
+
+}
+#endif /* NPDU_TESTS_NPDU_TEST_GLOBALS_HPP_ */
diff --git a/test/npdu_tests/npdu_test_rmd.cpp b/test/npdu_tests/npdu_test_rmd.cpp
new file mode 100644
index 0000000..1174a91
--- /dev/null
+++ b/test/npdu_tests/npdu_test_rmd.cpp
@@ -0,0 +1,160 @@
+// Copyright (C) 2015-2019 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 <atomic>
+
+#include "../npdu_tests/npdu_test_rmd.hpp"
+
+#include <vsomeip/internal/logger.hpp>
+#include "npdu_test_globals.hpp"
+
+#include "../npdu_tests/npdu_test_globals.hpp"
+
+npdu_test_rmd::npdu_test_rmd() :
+ app_(vsomeip::runtime::get()->create_application()),
+ is_registered_(false),
+ blocked_(false),
+ offer_thread_(std::bind(&npdu_test_rmd::run, this))
+{
+ // TODO Auto-generated constructor stub
+}
+
+void npdu_test_rmd::init() {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+
+ app_->init();
+
+#ifdef RMD_CLIENT_SIDE
+ app_->register_message_handler(npdu_test::RMD_SERVICE_ID_CLIENT_SIDE,
+#elif defined (RMD_SERVICE_SIDE)
+ app_->register_message_handler(npdu_test::RMD_SERVICE_ID_SERVICE_SIDE,
+#endif
+ npdu_test::RMD_INSTANCE_ID, npdu_test::RMD_SHUTDOWN_METHOD_ID,
+ std::bind(&npdu_test_rmd::on_message_shutdown,
+ this, std::placeholders::_1));
+
+ app_->register_state_handler(
+ std::bind(&npdu_test_rmd::on_state, this,
+ std::placeholders::_1));
+}
+
+void npdu_test_rmd::start() {
+ VSOMEIP_INFO << "Starting...";
+ app_->start();
+}
+
+void npdu_test_rmd::stop() {
+ VSOMEIP_INFO << "Stopping...";
+
+ app_->unregister_message_handler(npdu_test::RMD_SERVICE_ID_CLIENT_SIDE,
+ npdu_test::RMD_INSTANCE_ID, npdu_test::RMD_SHUTDOWN_METHOD_ID);
+ app_->unregister_state_handler();
+ offer_thread_.join();
+ app_->stop();
+}
+
+void npdu_test_rmd::on_state(
+ vsomeip::state_type_e _state) {
+ VSOMEIP_INFO << "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_)
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ is_registered_ = true;
+ blocked_ = true;
+ // "start" the run method thread
+ condition_.notify_one();
+ }
+ }
+ else
+ {
+ is_registered_ = false;
+ }
+}
+
+void npdu_test_rmd::on_message_shutdown(
+ const std::shared_ptr<vsomeip::message>& _request) {
+ (void)_request;
+ std::shared_ptr<vsomeip::message> request = vsomeip::runtime::get()->create_request(false);
+#ifdef RMD_CLIENT_SIDE
+ static int counter = 0;
+ counter++;
+ VSOMEIP_INFO << counter << " of " << npdu_test::client_ids_clients.size()
+ << " clients are finished.";
+
+ if (counter == npdu_test::client_ids_clients.size()) {
+ VSOMEIP_INFO << "All clients are finished, notify routing manager daemon on service side.";
+ // notify the RMD_SERVICE_SIDE that he can shutdown as well
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ request->set_service(npdu_test::RMD_SERVICE_ID_SERVICE_SIDE);
+ request->set_instance(npdu_test::RMD_INSTANCE_ID);
+ request->set_method(npdu_test::RMD_SHUTDOWN_METHOD_ID);
+ request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
+ app_->send(request);
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ stop();
+ }
+#elif defined RMD_SERVICE_SIDE
+ VSOMEIP_INFO << "All clients are finished shutting down services";
+ // shutdown all services
+ for(unsigned int i = 0; i < npdu_test::service_ids.size(); i++) {
+ request->set_service(npdu_test::service_ids[i]);
+ request->set_instance(npdu_test::instance_ids[i]);
+ request->set_method(npdu_test::NPDU_SERVICE_SHUTDOWNMETHOD_ID);
+ request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
+ app_->send(request);
+ }
+ app_->stop_offer_service(npdu_test::RMD_SERVICE_ID_SERVICE_SIDE, npdu_test::RMD_INSTANCE_ID);
+
+ VSOMEIP_INFO << "Wait a few seconds until all services are shutdown.";
+ std::atomic<bool> finished(false);
+ for (int i = 0; !finished && i < 20; i++) {
+ app_->get_offered_services_async(
+ vsomeip::offer_type_e::OT_REMOTE,
+ [&](const std::vector<std::pair<vsomeip::service_t,
+ vsomeip::instance_t>> &_services){
+ if (_services.empty()) {
+ finished = true;
+ }
+ });
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ }
+ stop();
+#endif
+}
+
+void npdu_test_rmd::join_shutdown_thread() {
+ shutdown_thread_.join();
+}
+
+void npdu_test_rmd::run() {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (!blocked_)
+ condition_.wait(its_lock);
+#ifdef RMD_CLIENT_SIDE
+ app_->offer_service(npdu_test::RMD_SERVICE_ID_CLIENT_SIDE, npdu_test::RMD_INSTANCE_ID);
+#elif defined (RMD_SERVICE_SIDE)
+ app_->offer_service(npdu_test::RMD_SERVICE_ID_SERVICE_SIDE, npdu_test::RMD_INSTANCE_ID);
+#endif
+}
+
+TEST(someip_npdu_test, offer_routing_manager_functionality)
+{
+ npdu_test_rmd daemon;
+ daemon.init();
+ daemon.start();
+}
+
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
+
diff --git a/test/security_config_plugin_tests/security_config_plugin_test_service.hpp b/test/npdu_tests/npdu_test_rmd.hpp
index eb43957..0b1e28d 100644
--- a/test/security_config_plugin_tests/security_config_plugin_test_service.hpp
+++ b/test/npdu_tests/npdu_test_rmd.hpp
@@ -1,34 +1,30 @@
-// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2015-2019 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 SECURITY_CONFIG_PLUGIN_TEST_SERVICE_HPP
-#define SECURITY_CONFIG_PLUGIN_TEST_SERVICE_HPP
+#ifndef NPDU_TESTS_NPDUTESTROUTINGMANAGERDAEMON_HPP_
+#define NPDU_TESTS_NPDUTESTROUTINGMANAGERDAEMON_HPP_
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../someip_test_globals.hpp"
-
#include <thread>
#include <mutex>
#include <condition_variable>
+#include <functional>
+
+class npdu_test_rmd {
-class security_config_plugin_test_service {
public:
- security_config_plugin_test_service();
- bool init();
+ npdu_test_rmd();
+ void 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<vsomeip::message> &_request);
void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request);
- void on_message_try_offer(const std::shared_ptr<vsomeip::message> &_request);
+ void join_shutdown_thread();
void run();
private:
@@ -36,10 +32,14 @@ private:
bool is_registered_;
std::mutex mutex_;
+ std::mutex mutex2_;
std::condition_variable condition_;
+ std::condition_variable condition2_;
bool blocked_;
- std::uint32_t number_of_received_messages_;
+ bool blocked2_;
std::thread offer_thread_;
+ std::thread shutdown_thread_;
+
};
-#endif // SECURITY_CONFIG_PLUGIN_TEST_SERVICE_HPP
+#endif /* NPDU_TESTS_NPDUTESTROUTINGMANAGERDAEMON_HPP_ */
diff --git a/test/npdu_tests/npdu_test_service.cpp b/test/npdu_tests/npdu_test_service.cpp
new file mode 100644
index 0000000..901084b
--- /dev/null
+++ b/test/npdu_tests/npdu_test_service.cpp
@@ -0,0 +1,306 @@
+// Copyright (C) 2015-2019 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 "../npdu_tests/npdu_test_service.hpp"
+#include "../npdu_tests/npdu_test_globals.hpp"
+
+#include <vsomeip/internal/logger.hpp>
+#include "../../implementation/configuration/include/configuration.hpp"
+#include "../../implementation/configuration/include/configuration_impl.hpp"
+#include "../../implementation/configuration/include/configuration_plugin.hpp"
+#include "../../implementation/plugin/include/plugin_manager_impl.hpp"
+
+
+
+// this variable is set during compile time to create 4 service binaries of
+// which each of them offers a service.
+// Based on this number the service id, instance id and method ids are
+// selected from the arrays defined in npdu_test_globals.hpp
+#ifndef SERVICE_NUMBER
+#define SERVICE_NUMBER 0
+#endif
+
+npdu_test_service::npdu_test_service(vsomeip::service_t _service_id,
+ vsomeip::instance_t _instance_id,
+ std::array<vsomeip::method_t, 4> _method_ids,
+ std::array<std::chrono::nanoseconds, 4> _debounce_times,
+ std::array<std::chrono::nanoseconds, 4> _max_retention_times) :
+ app_(vsomeip::runtime::get()->create_application()),
+ is_registered_(false),
+ method_ids_(_method_ids),
+ debounce_times_(_debounce_times),
+ max_retention_times_(_max_retention_times),
+ service_id_(_service_id),
+ instance_id_(_instance_id),
+ blocked_(false),
+ allowed_to_shutdown_(false),
+ number_of_received_messages_(0),
+ offer_thread_(std::bind(&npdu_test_service::run, this)),
+ shutdown_thread_(std::bind(&npdu_test_service::stop, this))
+{
+ // init timepoints of last received message to one hour before now.
+ // needed that the first message which arrives isn't registered as undershot
+ // debounce time
+ for(auto &tp : timepoint_last_received_message_) {
+ tp = std::chrono::steady_clock::now() - std::chrono::hours(1);
+ }
+}
+
+void npdu_test_service::init()
+{
+ std::lock_guard<std::mutex> its_lock(mutex_);
+
+ app_->init();
+
+ register_message_handler<0>();
+ register_message_handler<1>();
+ register_message_handler<2>();
+ register_message_handler<3>();
+
+ app_->register_message_handler(service_id_, instance_id_,
+ npdu_test::NPDU_SERVICE_SHUTDOWNMETHOD_ID,
+ std::bind(&npdu_test_service::on_message_shutdown, this,
+ std::placeholders::_1));
+
+ app_->register_state_handler(
+ std::bind(&npdu_test_service::on_state, this,
+ std::placeholders::_1));
+}
+
+template <int method_idx>
+void npdu_test_service::register_message_handler() {
+ app_->register_message_handler(service_id_, instance_id_, method_ids_[method_idx],
+ std::bind(&npdu_test_service::on_message<method_idx>, this,
+ std::placeholders::_1));
+}
+
+void npdu_test_service::start()
+{
+ VSOMEIP_INFO << "Starting...";
+ app_->start();
+}
+
+void npdu_test_service::stop()
+{
+ std::unique_lock<std::mutex> its_lock(shutdown_mutex_);
+ while (!allowed_to_shutdown_) {
+ shutdown_condition_.wait(its_lock);
+ }
+
+ VSOMEIP_INFO << "Stopping...";
+ if (!undershot_debounce_times_.empty()) {
+ std::chrono::microseconds sum(0);
+ for (const auto t : undershot_debounce_times_) {
+ sum += t;
+ }
+ double average = static_cast<double>(sum.count())/static_cast<double>(undershot_debounce_times_.size());
+ VSOMEIP_INFO << "["
+ << std::setw(4) << std::setfill('0') << std::hex << service_id_ << "."
+ << std::setw(4) << std::setfill('0') << std::hex << instance_id_ << "]: "
+ << " Debounce time was undershot " << std::dec << undershot_debounce_times_.size() << "/" << number_of_received_messages_
+ << "(" << std::setprecision(2) << (static_cast<double>(undershot_debounce_times_.size()) / static_cast<double>(number_of_received_messages_)) * 100.00
+ << "%) on average: " << std::setprecision(4) << average << "µs";
+ }
+ app_->unregister_message_handler(service_id_, instance_id_, method_ids_[0]);
+ app_->unregister_message_handler(service_id_, instance_id_, method_ids_[1]);
+ app_->unregister_message_handler(service_id_, instance_id_, method_ids_[2]);
+ app_->unregister_message_handler(service_id_, instance_id_, method_ids_[3]);
+ app_->unregister_message_handler(service_id_,
+ instance_id_, npdu_test::NPDU_SERVICE_SHUTDOWNMETHOD_ID);
+ app_->unregister_state_handler();
+ offer_thread_.join();
+ stop_offer();
+ app_->stop();
+}
+
+void npdu_test_service::offer()
+{
+ app_->offer_service(service_id_, instance_id_);
+}
+
+void npdu_test_service::stop_offer()
+{
+ app_->stop_offer_service(service_id_, instance_id_);
+}
+
+void npdu_test_service::join_shutdown_thread() {
+ shutdown_thread_.join();
+}
+
+void npdu_test_service::on_state(vsomeip::state_type_e _state)
+{
+ VSOMEIP_INFO << "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_)
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ is_registered_ = true;
+ blocked_ = true;
+ // "start" the run method thread
+ condition_.notify_one();
+ }
+ }
+ else
+ {
+ is_registered_ = false;
+ }
+}
+
+template<int method_idx>
+void npdu_test_service::check_times() {
+ std::lock_guard<std::mutex> its_lock(timepoint_mutexes_[method_idx]);
+ // what time is it?
+ std::chrono::steady_clock::time_point now =
+ std::chrono::steady_clock::now();
+ // how long is it since we received the last message?
+ std::chrono::nanoseconds time_since_last_message =
+ std::chrono::duration_cast<std::chrono::nanoseconds>(
+ now - timepoint_last_received_message_[method_idx]);
+ // store the current time
+ timepoint_last_received_message_[method_idx] = now;
+
+ // check if the debounce time was undershot
+ if (time_since_last_message < debounce_times_[method_idx]) {
+ const auto time_undershot = std::chrono::duration_cast<
+ std::chrono::microseconds>(debounce_times_[method_idx] - time_since_last_message);
+ undershot_debounce_times_.push_back(time_undershot);
+ }
+ // check if maximum retention time was exceeded
+ // Disabled as it can't be guaranteed that exact every max retention time a
+ // message leaves the client endpoint.
+#if 0
+ if(time_since_last_message > max_retention_times_[method_idx]) {
+ VSOMEIP_ERROR << std::setw(4) << std::setfill('0') << std::hex
+ << service_id_ << ":" << std::setw(4) << std::setfill('0')
+ << std::hex << instance_id_ << ":" << std::setw(4) << std::setfill('0')
+ << std::hex << npdu_test::method_ids[SERVICE_NUMBER][method_idx]
+ << ": max_retention_time exceeded by: " << std::dec
+ << std::chrono::duration_cast<std::chrono::milliseconds>(
+ time_since_last_message - max_retention_times_[method_idx]).count()
+ << "ms";
+ GTEST_FATAL_FAILURE_("Max retention time was exceeded");
+ }
+#endif
+}
+
+template<int method_idx>
+void npdu_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request)
+{
+ number_of_received_messages_++;
+ check_times<method_idx>();
+ VSOMEIP_DEBUG << __func__ << " 0x" << std::setw(4) << std::setfill('0') << std::hex
+ << method_ids_[method_idx] << " payload size: "
+ << std::dec << _request->get_payload()->get_length();
+ if(_request->get_message_type() != vsomeip::message_type_e::MT_REQUEST_NO_RETURN) {
+ std::shared_ptr<vsomeip::message> its_response =
+ vsomeip::runtime::get()->create_response(_request);
+ app_->send(its_response);
+ }
+}
+
+void npdu_test_service::on_message_shutdown(
+ const std::shared_ptr<vsomeip::message>& _request)
+{
+ (void)_request;
+ VSOMEIP_DEBUG << "Number of received messages: " << number_of_received_messages_;
+ VSOMEIP_INFO << "Shutdown method was called, going down now.";
+
+ std::lock_guard<std::mutex> its_lock(shutdown_mutex_);
+ allowed_to_shutdown_ = true;
+ shutdown_condition_.notify_one();
+}
+
+void npdu_test_service::run()
+{
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (!blocked_)
+ condition_.wait(its_lock);
+
+ offer();
+}
+
+TEST(someip_npdu_test, offer_service_and_check_debounce_times)
+{
+ // get the configuration
+ std::shared_ptr<vsomeip::configuration> its_configuration;
+ auto its_plugin = vsomeip::plugin_manager::get()->get_plugin(
+ vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY);
+ if (its_plugin) {
+ auto its_config_plugin = std::dynamic_pointer_cast<vsomeip::configuration_plugin>(its_plugin);
+ if (its_config_plugin) {
+ its_configuration = its_config_plugin->get_configuration("");
+ }
+ }
+ if (!its_configuration) {
+ ADD_FAILURE() << "No configuration object. "
+ "Either memory overflow or loading error detected!";
+ return;
+ }
+
+ // used to store the debounce times
+ std::array<std::chrono::nanoseconds, 4> debounce_times;
+ std::array<std::chrono::nanoseconds, 4> max_retention_times;
+
+
+ // query the debouncetimes from the configuration. We want to know the
+ // debounce times which the _clients_ of this service have to comply with
+ // when they send requests to this service. This is necessary as we want to
+ // check on the service side if they adhere to them.
+ // client one will only query method one, client two will only query method
+ // two and so on.
+ for(int i = 0; i < 4; i++) {
+ std::chrono::nanoseconds debounce(0), retention(0);
+ its_configuration->get_configured_timing_requests(
+ npdu_test::service_ids[SERVICE_NUMBER],
+ its_configuration->get_unicast_address().to_string(),
+ its_configuration->get_unreliable_port(
+ npdu_test::service_ids[SERVICE_NUMBER],
+ npdu_test::instance_ids[SERVICE_NUMBER]),
+ npdu_test::method_ids[SERVICE_NUMBER][i],
+ &debounce_times[i],
+ &max_retention_times[i]);
+ if (debounce == std::chrono::nanoseconds(VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO) &&
+ retention == std::chrono::nanoseconds(VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO)) {
+ // no timings specified - checks in check_times() should never
+ // report an error in this case.
+ // set debounce time to 0 this can't be undershot
+ debounce_times[i] = std::chrono::nanoseconds(0);
+ // set max retention time its max, this won't be exceeded
+ max_retention_times[i] = std::chrono::nanoseconds::max();
+ }
+ }
+
+ npdu_test_service test_service(
+ npdu_test::service_ids[SERVICE_NUMBER],
+ npdu_test::instance_ids[SERVICE_NUMBER],
+ npdu_test::method_ids[SERVICE_NUMBER],
+ debounce_times, max_retention_times);
+ test_service.init();
+ test_service.start();
+ test_service.join_shutdown_thread();
+}
+
+#ifndef _WIN32
+int main(int argc, char** argv)
+{
+ int i = 1;
+ while (i < argc)
+ {
+ if(std::string("--help") == argv[i])
+ {
+ VSOMEIP_INFO << "Parameters:\n"
+ << "--help: print this help";
+ }
+ i++;
+ }
+
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/npdu_tests/npdu_test_service.hpp b/test/npdu_tests/npdu_test_service.hpp
new file mode 100644
index 0000000..bef0680
--- /dev/null
+++ b/test/npdu_tests/npdu_test_service.hpp
@@ -0,0 +1,64 @@
+// Copyright (C) 2015-2019 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 NPDUTESTSERVICE_HPP_
+#define NPDUTESTSERVICE_HPP_
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include <thread>
+#include <mutex>
+#include <condition_variable>
+#include <functional>
+#include <chrono>
+#include <deque>
+
+class npdu_test_service
+{
+public:
+ npdu_test_service(vsomeip::service_t _service_id,
+ vsomeip::instance_t _instance_id,
+ std::array<vsomeip::method_t, 4> _method_ids,
+ std::array<std::chrono::nanoseconds, 4> _debounce_times,
+ std::array<std::chrono::nanoseconds, 4> _max_retention_times);
+ void init();
+ void start();
+ void stop();
+ void offer();
+ void stop_offer();
+ void join_shutdown_thread();
+ void on_state(vsomeip::state_type_e _state);
+ template<int method_idx> void on_message(const std::shared_ptr<vsomeip::message> &_request);
+ void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request);
+ void run();
+
+private:
+ template<int method_idx> void check_times();
+ template <int method_idx> void register_message_handler();
+
+private:
+ std::shared_ptr<vsomeip::application> app_;
+ bool is_registered_;
+ std::array<vsomeip::method_t, 4> method_ids_;
+ std::array<std::chrono::nanoseconds, 4> debounce_times_;
+ std::array<std::chrono::nanoseconds, 4> max_retention_times_;
+ std::array<std::chrono::steady_clock::time_point, 4> timepoint_last_received_message_;
+ std::array<std::mutex, 4> timepoint_mutexes_;
+ std::deque<std::chrono::microseconds> undershot_debounce_times_;
+ vsomeip::service_t service_id_;
+ vsomeip::instance_t instance_id_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ bool blocked_;
+ std::mutex shutdown_mutex_;
+ std::condition_variable shutdown_condition_;
+ bool allowed_to_shutdown_;
+ std::uint32_t number_of_received_messages_;
+ std::thread offer_thread_;
+ std::thread shutdown_thread_;
+};
+
+#endif /* NPDUTESTSERVICE_HPP_ */
diff --git a/test/npdu_tests/npdu_test_service_no_npdu.json b/test/npdu_tests/npdu_test_service_no_npdu.json
new file mode 100644
index 0000000..642db48
--- /dev/null
+++ b/test/npdu_tests/npdu_test_service_no_npdu.json
@@ -0,0 +1,87 @@
+{
+ "unicast":"10.0.3.1",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"npdu_test_routing_manager_daemon_service_side",
+ "id":"0x6667"
+ },
+ {
+ "name":"npdu_test_service_one",
+ "id":"0x1000"
+ },
+ {
+ "name":"npdu_test_service_two",
+ "id":"0x2000"
+ },
+ {
+ "name":"npdu_test_service_three",
+ "id":"0x3000"
+ },
+ {
+ "name":"npdu_test_service_four",
+ "id":"0x4000"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x6667",
+ "instance":"0x6666",
+ "unreliable":"60666"
+ },
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0002",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x3000",
+ "instance":"0x0003",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0004",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"npdu_test_routing_manager_daemon_service_side",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/npdu_tests/npdu_test_service_no_npdu_start.sh b/test/npdu_tests/npdu_test_service_no_npdu_start.sh
new file mode 100755
index 0000000..cf05aaa
--- /dev/null
+++ b/test/npdu_tests/npdu_test_service_no_npdu_start.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+# Copyright (C) 2015-2019 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 routing manager daemon and 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 routing
+# manager daemon and the services and checks if all of them exit successfully.
+
+FAIL=0
+
+start_services(){
+ export VSOMEIP_CONFIGURATION=npdu_test_service_no_npdu.json
+
+ # Start the routing manager daemon
+ export VSOMEIP_APPLICATION_NAME=npdu_test_routing_manager_daemon_service_side
+ ./npdu_test_rmd_service_side &
+
+ # sleep 1 second to let the RMD startup.
+ sleep 1
+
+ # Start service 1
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_one
+ ./npdu_test_service_1 $* &
+
+ # Start service 2
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_two
+ ./npdu_test_service_2 $* &
+
+ # Start service 3
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_three
+ ./npdu_test_service_3 $* &
+
+ # Start service 4
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_four
+ ./npdu_test_service_4 $* &
+}
+
+wait_for_bg_processes(){
+ # Wait until client and service are finished
+ for job in $(jobs -p)
+ do
+ # Fail gets incremented if one of the jobs exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+ done
+
+ # Check if everything exited successfully
+ if [ $FAIL -eq 0 ]
+ then
+ echo "All services exited successfully"
+ else
+ echo "Something went wrong"
+ exit 1
+ fi
+}
+
+start_services
+wait_for_bg_processes
+
+exit 0
diff --git a/test/npdu_tests/npdu_test_service_npdu.json b/test/npdu_tests/npdu_test_service_npdu.json
new file mode 100644
index 0000000..5dc905e
--- /dev/null
+++ b/test/npdu_tests/npdu_test_service_npdu.json
@@ -0,0 +1,168 @@
+{
+ "unicast":"10.0.3.1",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"npdu_test_routing_manager_daemon_service_side",
+ "id":"0x6667"
+ },
+ {
+ "name":"npdu_test_service_one",
+ "id":"0x1000"
+ },
+ {
+ "name":"npdu_test_service_two",
+ "id":"0x2000"
+ },
+ {
+ "name":"npdu_test_service_three",
+ "id":"0x3000"
+ },
+ {
+ "name":"npdu_test_service_four",
+ "id":"0x4000"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x6667",
+ "instance":"0x6666",
+ "unreliable":"60666"
+ },
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times":
+ {
+ "responses" : {
+ "0x1001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x1002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x1003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x1004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0002",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times" : {
+ "responses" : {
+ "0x2001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x2002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x2003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x2004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x3000",
+ "instance":"0x0003",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times" : {
+ "responses" : {
+ "0x3001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x3002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x3003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x3004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0004",
+ "unreliable":"30509",
+ "reliable":
+ {
+ "port":"30510",
+ "enable-magic-cookies":"false"
+ },
+ "debounce-times": {
+ "responses" : {
+ "0x4001" : {
+ "debounce-time" : "10",
+ "maximum-retention-time" : "100"
+ },
+ "0x4002" : {
+ "debounce-time" : "20",
+ "maximum-retention-time" : "200"
+ },
+ "0x4003" : {
+ "debounce-time" : "30",
+ "maximum-retention-time" : "300"
+ },
+ "0x4004" : {
+ "debounce-time" : "40",
+ "maximum-retention-time" : "400"
+ }
+ }
+ }
+ }
+ ],
+ "routing":"npdu_test_routing_manager_daemon_service_side",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/npdu_tests/npdu_test_service_npdu_start.sh b/test/npdu_tests/npdu_test_service_npdu_start.sh
new file mode 100755
index 0000000..0ca238b
--- /dev/null
+++ b/test/npdu_tests/npdu_test_service_npdu_start.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+# Copyright (C) 2015-2019 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 routing manager daemon and 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 routing
+# manager daemon and the services and checks if all of them exit successfully.
+
+FAIL=0
+
+start_services(){
+ export VSOMEIP_CONFIGURATION=npdu_test_service_npdu.json
+
+ # Start the routing manager daemon
+ export VSOMEIP_APPLICATION_NAME=npdu_test_routing_manager_daemon_service_side
+ ./npdu_test_rmd_service_side &
+
+ # sleep 1 second to let the RMD startup.
+ sleep 1
+
+ # Start service 1
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_one
+ ./npdu_test_service_1 $* &
+
+ # Start service 2
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_two
+ ./npdu_test_service_2 $* &
+
+ # Start service 3
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_three
+ ./npdu_test_service_3 $* &
+
+ # Start service 4
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_four
+ ./npdu_test_service_4 $* &
+}
+
+wait_for_bg_processes(){
+ # Wait until client and service are finished
+ for job in $(jobs -p)
+ do
+ # Fail gets incremented if one of the jobs exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+ done
+
+ # Check if everything exited successfully
+ if [ $FAIL -eq 0 ]
+ then
+ echo "All services exited successfully"
+ else
+ echo "Something went wrong"
+ exit 1
+ fi
+}
+
+start_services
+wait_for_bg_processes
+
+exit 0
diff --git a/test/npdu_tests/npdu_test_starter.sh b/test/npdu_tests/npdu_test_starter.sh
new file mode 100755
index 0000000..2e88be6
--- /dev/null
+++ b/test/npdu_tests/npdu_test_starter.sh
@@ -0,0 +1,96 @@
+#!/bin/bash
+# Copyright (C) 2015-2019 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 routing manager daemon and 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 routing
+# manager daemon and the services and checks if all of them exit successfully.
+
+FAIL=0
+
+if [ $# -lt 2 ]; then
+ echo "Error: Please pass a protocol and communication mode to this script."
+ echo "Valid protocols are [UDP,TCP]."
+ echo "Valid communication modes are [sync, async]."
+ echo "For example $> $0 UDP sync"
+ exit 1;
+fi
+
+start_services(){
+ export VSOMEIP_CONFIGURATION=npdu_test_service_npdu.json
+
+ # Start the routing manager daemon
+ export VSOMEIP_APPLICATION_NAME=npdu_test_routing_manager_daemon_service_side
+ ./npdu_test_rmd_service_side &
+
+ # sleep 1 second to let the RMD startup.
+ sleep 1
+
+ # Start service 1
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_one
+ ./npdu_test_service_1 $* &
+
+ # Start service 2
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_two
+ ./npdu_test_service_2 $* &
+
+ # Start service 3
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_three
+ ./npdu_test_service_3 $* &
+
+ # Start service 4
+ export VSOMEIP_APPLICATION_NAME=npdu_test_service_four
+ ./npdu_test_service_4 $* &
+}
+
+wait_for_bg_processes(){
+ # Wait until client and service are finished
+ for job in $(jobs -p)
+ do
+ # Fail gets incremented if one of the jobs exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+ done
+
+ # Check if everything exited successfully
+ if [ $FAIL -eq 0 ]
+ then
+ echo "All services exited successfully"
+ else
+ echo "Something went wrong"
+ exit 1
+ fi
+}
+
+
+start_services
+
+if [ ! -z "$USE_LXC_TEST" ]; then
+ echo "starting magic cookies 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; ./npdu_test_client_npdu_start.sh $*\"" &
+elif [ ! -z "$USE_DOCKER" ]; then
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./npdu_test_client_npdu_start.sh $*" &
+else
+sleep 1
+cat <<End-of-message
+*******************************************************************************
+*******************************************************************************
+** Please now run:
+** npdu_test_client_npdu_start.sh $*
+** from an external host to successfully complete this test.
+**
+** You probably will need to adapt the 'unicast' settings in
+** npdu_test_client_npdu.json and
+** npdu_test_service_npdu.json to your personal setup.
+*******************************************************************************
+*******************************************************************************
+End-of-message
+fi
+
+wait_for_bg_processes
+
+exit 0
diff --git a/test/offer_tests/conf/offer_test_big_sd_msg_master.json.in b/test/offer_tests/conf/offer_test_big_sd_msg_master.json.in
index 17158c1..06609f6 100644
--- a/test/offer_tests/conf/offer_test_big_sd_msg_master.json.in
+++ b/test/offer_tests/conf/offer_test_big_sd_msg_master.json.in
@@ -18,7 +18,7 @@
"id" : "0x6666"
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in b/test/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in
index 2547673..07d4079 100755
--- a/test/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in
+++ b/test/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in
@@ -14,7 +14,7 @@ FAIL=0
export VSOMEIP_CONFIGURATION=offer_test_big_sd_msg_master.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
./offer_test_big_sd_msg_client &
@@ -27,10 +27,12 @@ if [ ! -z "$USE_LXC_TEST" ]; then
echo "Waiting for 5s"
sleep 5
echo "starting offer test on slave LXC offer_test_big_sd_msg_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/test; ./offer_test_big_sd_msg_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; ./offer_test_big_sd_msg_slave_starter.sh\"" &
echo "remote ssh pid: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./offer_test_big_sd_msg_slave_starter.sh" &
+ echo "Waiting for 5s"
+ sleep 5
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && sleep 10; ./offer_test_big_sd_msg_slave_starter.sh" &
else
cat <<End-of-message
*******************************************************************************
@@ -59,11 +61,6 @@ done
kill $PID_VSOMEIPD
sleep 1
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otems
- docker rm otems
-fi
-
# wait for slave to finish
for job in $(jobs -p)
do
diff --git a/test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in b/test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in
index cd5056a..0c8427d 100644
--- a/test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in
+++ b/test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in
@@ -321,7 +321,7 @@
{"service":"0x12B","instance":"0x1","unreliable":"30299","reliable":{"port":"30299","enable-magic-cookies":"false"}},
{"service":"0x12C","instance":"0x1","unreliable":"30300","reliable":{"port":"30300","enable-magic-cookies":"false"}}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/offer_tests/conf/offer_test_external_master.json.in b/test/offer_tests/conf/offer_test_external_master.json.in
index b16a258..c54d9ac 100644
--- a/test/offer_tests/conf/offer_test_external_master.json.in
+++ b/test/offer_tests/conf/offer_test_external_master.json.in
@@ -24,7 +24,7 @@
}
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/offer_tests/conf/offer_test_external_master_starter.sh.in b/test/offer_tests/conf/offer_test_external_master_starter.sh.in
index 0f8f104..272689a 100755
--- a/test/offer_tests/conf/offer_test_external_master_starter.sh.in
+++ b/test/offer_tests/conf/offer_test_external_master_starter.sh.in
@@ -23,7 +23,7 @@ FAIL=0
CLIENT_PIDS=()
export VSOMEIP_CONFIGURATION=offer_test_external_master.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the services
./offer_test_service 2 &
@@ -40,10 +40,12 @@ if [ ! -z "$USE_LXC_TEST" ]; then
echo "Waiting for 5s"
sleep 5
echo "starting offer test on slave LXC offer_test_external_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/test; ./offer_test_external_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; ./offer_test_external_slave_starter.sh\"" &
echo "remote ssh pid: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./offer_test_external_slave_starter.sh" &
+ echo "Waiting for 5s"
+ sleep 5
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && sleep 10; ./offer_test_external_slave_starter.sh" &
else
cat <<End-of-message
*******************************************************************************
@@ -72,11 +74,6 @@ done
kill $PID_VSOMEIPD
sleep 1
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otems
- docker rm otems
-fi
-
# wait for slave to finish
for job in $(jobs -p)
do
@@ -95,7 +92,7 @@ done
CLIENT_PIDS=()
export VSOMEIP_CONFIGURATION=offer_test_external_master.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the services
./offer_test_service 2 &
@@ -111,10 +108,12 @@ if [ ! -z "$USE_LXC_TEST" ]; then
echo "Waiting for 5s"
sleep 5
echo "starting offer test on slave LXC offer_test_external_sd_msg_sender"
- 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/test; ./offer_test_external_sd_msg_sender $LXC_TEST_MASTER_IP\"" &
+ 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; ./offer_test_external_sd_msg_sender $LXC_TEST_MASTER_IP\"" &
echo "remote ssh job id: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otesms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./offer_test_external_sd_msg_sender $DOCKER_IP" &
+ echo "Waiting for 5s"
+ sleep 5
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && sleep 10; ./offer_test_external_sd_msg_sender $DOCKER_IP" &
else
cat <<End-of-message
*******************************************************************************
@@ -141,11 +140,6 @@ done
kill $PID_VSOMEIPD
sleep 1
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otesms
- docker rm otesms
-fi
-
# wait for slave to finish
for job in $(jobs -p)
do
diff --git a/test/offer_tests/conf/offer_test_external_slave.json.in b/test/offer_tests/conf/offer_test_external_slave.json.in
index 47a3e9d..73a0e58 100644
--- a/test/offer_tests/conf/offer_test_external_slave.json.in
+++ b/test/offer_tests/conf/offer_test_external_slave.json.in
@@ -24,7 +24,7 @@
}
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/offer_tests/offer_test_big_sd_msg_client.cpp b/test/offer_tests/offer_test_big_sd_msg_client.cpp
index cf00de7..3ef1f61 100644
--- a/test/offer_tests/offer_test_big_sd_msg_client.cpp
+++ b/test/offer_tests/offer_test_big_sd_msg_client.cpp
@@ -16,8 +16,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-#include "../../implementation/configuration/include/internal.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "offer_test_globals.hpp"
@@ -26,7 +25,6 @@ public:
offer_test_big_sd_msg_client(struct offer_test::service_info _service_info) :
service_info_(_service_info),
app_(vsomeip::runtime::get()->create_application("offer_test_big_sd_msg_client")),
- service_available_(false),
wait_until_registered_(true),
wait_until_service_available_(true),
wait_until_subscribed_(true),
@@ -55,13 +53,12 @@ public:
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(offer_test::big_msg_eventgroup_id);
for (std::uint16_t s = 1; s <= offer_test::big_msg_number_services; s++) {
- app_->request_service(s,0x1,0x1,0x1,false);
+ app_->request_service(s,0x1,0x1,0x1);
app_->request_event(s,0x1, offer_test::big_msg_event_id,
- its_eventgroups, false);
+ its_eventgroups, vsomeip::event_type_e::ET_EVENT);
app_->subscribe(s, 0x1,offer_test::big_msg_eventgroup_id, 0x1,
- vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
offer_test::big_msg_event_id);
- services_available_subribed_[s] = std::make_pair(false,false);
+ services_available_subribed_[s] = std::make_pair(false,0);
app_->register_subscription_status_handler(s,0x1,
offer_test::big_msg_eventgroup_id,
offer_test::big_msg_event_id,
@@ -132,11 +129,17 @@ public:
std::lock_guard<std::mutex> its_lock(mutex_);
auto found_service = services_available_subribed_.find(_service);
if (found_service != services_available_subribed_.end()) {
- found_service->second.second = true;
+ found_service->second.second++;
+ if (found_service->second.second > 1) {
+ ADD_FAILURE() << "Registered subscription status handler was "
+ "called " << std::dec << found_service->second.second
+ << " times for service: " << std::hex
+ << found_service->first;
+ }
if (std::all_of(services_available_subribed_.cbegin(),
services_available_subribed_.cend(),
[](const services_available_subribed_t::value_type& v) {
- return v.second.second;
+ return v.second.second == 1;
}
)) {
VSOMEIP_WARNING << "************************************************************";
@@ -203,7 +206,6 @@ public:
private:
struct offer_test::service_info service_info_;
std::shared_ptr<vsomeip::application> app_;
- bool service_available_;
bool wait_until_registered_;
bool wait_until_service_available_;
@@ -215,7 +217,7 @@ private:
std::mutex stop_mutex_;
std::condition_variable stop_condition_;
- typedef std::map<vsomeip::service_t,std::pair<bool, bool>> services_available_subribed_t;
+ typedef std::map<vsomeip::service_t,std::pair<bool, std::uint32_t>> services_available_subribed_t;
services_available_subribed_t services_available_subribed_;
std::thread stop_thread_;
std::thread send_thread_;
diff --git a/test/offer_tests/offer_test_big_sd_msg_service.cpp b/test/offer_tests/offer_test_big_sd_msg_service.cpp
index d5666c8..5424be3 100644
--- a/test/offer_tests/offer_test_big_sd_msg_service.cpp
+++ b/test/offer_tests/offer_test_big_sd_msg_service.cpp
@@ -12,11 +12,12 @@
#include <map>
#include <algorithm>
#include <atomic>
+#include <algorithm>
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "offer_test_globals.hpp"
@@ -24,12 +25,12 @@ class offer_test_big_sd_msg_service {
public:
offer_test_big_sd_msg_service(struct offer_test::service_info _service_info) :
service_info_(_service_info),
- // service with number 1 uses "vsomeipd" as application name
+ // service with number 1 uses "routingmanagerd" as application name
// this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
+ // including the ones with routingmanagerd
app_(vsomeip::runtime::get()->create_application("offer_test_big_sd_msg_service")),
- counter_(0),
wait_until_registered_(true),
+ wait_until_client_subscribed_to_all_services_(true),
shutdown_method_called_(false),
offer_thread_(std::bind(&offer_test_big_sd_msg_service::run, this)) {
if (!app_->init()) {
@@ -45,13 +46,22 @@ public:
its_eventgroups.insert(offer_test::big_msg_eventgroup_id);
for (std::uint16_t s = 1; s <= offer_test::big_msg_number_services; s++) {
app_->offer_event(s, 0x1,
- offer_test::big_msg_event_id, its_eventgroups, false);
+ offer_test::big_msg_event_id, its_eventgroups,
+ vsomeip::event_type_e::ET_EVENT, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
+ app_->register_subscription_handler(s, 0x1, offer_test::big_msg_eventgroup_id,
+ std::bind(&offer_test_big_sd_msg_service::on_subscription,
+ this, std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, std::placeholders::_4, s));
+ subscriptions_[s] = 0;
}
app_->register_message_handler(vsomeip::ANY_SERVICE,
vsomeip::ANY_INSTANCE, service_info_.shutdown_method_id,
std::bind(&offer_test_big_sd_msg_service::on_shutdown_method_called, this,
std::placeholders::_1));
+
+
app_->start();
}
@@ -77,6 +87,31 @@ public:
}
}
+ bool on_subscription(vsomeip::client_t _client,
+ std::uint32_t _uid, std::uint32_t _gid,
+ bool _subscribed,
+ vsomeip::service_t _service) {
+ (void)_client;
+ (void)_uid;
+ (void)_gid;
+ if (_subscribed) {
+ subscriptions_[_service]++;
+ EXPECT_EQ(1u, subscriptions_[_service]);
+ if (std::all_of(subscriptions_.begin(), subscriptions_.end(), [&](const subscriptions_t::value_type& v){
+ return v.second == 1;
+ })) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_client_subscribed_to_all_services_ = false;
+ VSOMEIP_WARNING << "************************************************************";
+ VSOMEIP_WARNING << "Client subscribed to all services!";
+ VSOMEIP_WARNING << "************************************************************";
+ condition_.notify_one();
+ }
+ }
+
+ return true;
+ }
+
void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
app_->send(vsomeip::runtime::get()->create_response(_message));
std::this_thread::sleep_for(std::chrono::seconds(1));
@@ -102,17 +137,23 @@ public:
VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
<< service_info_.service_id << "] Offering";
offer();
+
+ while (wait_until_client_subscribed_to_all_services_) {
+ condition_.wait(its_lock);
+ }
}
private:
struct offer_test::service_info service_info_;
std::shared_ptr<vsomeip::application> app_;
- std::uint32_t counter_;
bool wait_until_registered_;
+ bool wait_until_client_subscribed_to_all_services_;
std::mutex mutex_;
std::condition_variable condition_;
std::atomic<bool> shutdown_method_called_;
+ typedef std::map<vsomeip::service_t, std::uint32_t> subscriptions_t;
+ subscriptions_t subscriptions_;
std::thread offer_thread_;
};
diff --git a/test/offer_tests/offer_test_big_sd_msg_slave_starter.sh b/test/offer_tests/offer_test_big_sd_msg_slave_starter.sh
index d83139f..32379ed 100755
--- a/test/offer_tests/offer_test_big_sd_msg_slave_starter.sh
+++ b/test/offer_tests/offer_test_big_sd_msg_slave_starter.sh
@@ -15,7 +15,7 @@ FAIL=0
export VSOMEIP_CONFIGURATION=offer_test_big_sd_msg_slave.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
sleep 1
# Start the services
diff --git a/test/offer_tests/offer_test_client.cpp b/test/offer_tests/offer_test_client.cpp
index b337199..11446fb 100644
--- a/test/offer_tests/offer_test_client.cpp
+++ b/test/offer_tests/offer_test_client.cpp
@@ -16,8 +16,13 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-#include "../../implementation/configuration/include/internal.hpp"
+#include <vsomeip/internal/logger.hpp>
+
+#ifdef ANDROID
+#include "../../configuration/include/internal_android.hpp"
+#else
+#include "../../configuration/include/internal.hpp"
+#endif // ANDROID
#include "offer_test_globals.hpp"
@@ -32,7 +37,6 @@ public:
service_info_(_service_info),
operation_mode_(_mode),
app_(vsomeip::runtime::get()->create_application("offer_test_client")),
- service_available_(false),
wait_until_registered_(true),
wait_until_service_available_(true),
wait_for_stop_(true),
@@ -68,11 +72,10 @@ public:
its_eventgroups.insert(service_info_.eventgroup_id);
app_->request_event(service_info_.service_id,
service_info_.instance_id, service_info_.event_id,
- its_eventgroups, false);
+ its_eventgroups, vsomeip::event_type_e::ET_EVENT);
app_->subscribe(service_info_.service_id, service_info_.instance_id,
- service_info_.eventgroup_id, vsomeip::DEFAULT_MAJOR,
- vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE);
+ service_info_.eventgroup_id, vsomeip::DEFAULT_MAJOR);
}
app_->start();
@@ -124,10 +127,10 @@ public:
vsomeip::byte_t *d = its_payload->get_data();
static std::uint32_t number_received_notifications(0);
std::uint32_t counter(0);
- counter |= d[0] << 24;
- counter |= d[1] << 16;
- counter |= d[2] << 8;
- counter |= d[3];
+ counter |= static_cast<std::uint32_t>(d[0] << 24);
+ counter |= static_cast<std::uint32_t>(d[0] << 16);
+ counter = counter | static_cast<std::uint32_t>((d[2] << 8));
+ counter = counter | static_cast<std::uint32_t>(d[3]);
VSOMEIP_DEBUG
<< "Received a notification with Client/Session [" << std::setw(4)
@@ -227,7 +230,6 @@ private:
struct offer_test::service_info service_info_;
operation_mode_e operation_mode_;
std::shared_ptr<vsomeip::application> app_;
- bool service_available_;
bool wait_until_registered_;
bool wait_until_service_available_;
diff --git a/test/offer_tests/offer_test_external_slave_starter.sh b/test/offer_tests/offer_test_external_slave_starter.sh
index d7f08fb..5c30e87 100755
--- a/test/offer_tests/offer_test_external_slave_starter.sh
+++ b/test/offer_tests/offer_test_external_slave_starter.sh
@@ -15,7 +15,7 @@ FAIL=0
export VSOMEIP_CONFIGURATION=offer_test_external_slave.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
sleep 1
# Start the services
diff --git a/test/offer_tests/offer_test_local.json b/test/offer_tests/offer_test_local.json
index a54049c..be8aa09 100644
--- a/test/offer_tests/offer_test_local.json
+++ b/test/offer_tests/offer_test_local.json
@@ -11,7 +11,7 @@
},
"dlt":"false"
},
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"false"
diff --git a/test/offer_tests/offer_test_local_starter.sh b/test/offer_tests/offer_test_local_starter.sh
index 38efbb6..6e5af18 100755
--- a/test/offer_tests/offer_test_local_starter.sh
+++ b/test/offer_tests/offer_test_local_starter.sh
@@ -76,7 +76,7 @@ End-of-message
CLIENT_PIDS=()
export VSOMEIP_CONFIGURATION=offer_test_local.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the services
@@ -128,7 +128,7 @@ End-of-message
CLIENT_PIDS=()
export VSOMEIP_CONFIGURATION=offer_test_local.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the service
./offer_test_service 2 &
@@ -186,7 +186,7 @@ End-of-message
CLIENT_PIDS=()
export VSOMEIP_CONFIGURATION=offer_test_local.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the service
./offer_test_service 2 &
@@ -247,7 +247,7 @@ End-of-message
CLIENT_PIDS=()
export VSOMEIP_CONFIGURATION=offer_test_local.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the service
./offer_test_service 2 &
diff --git a/test/offer_tests/offer_test_service.cpp b/test/offer_tests/offer_test_service.cpp
index 13c193f..c56d005 100644
--- a/test/offer_tests/offer_test_service.cpp
+++ b/test/offer_tests/offer_test_service.cpp
@@ -16,7 +16,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "offer_test_globals.hpp"
@@ -26,11 +26,11 @@ class offer_test_service {
public:
offer_test_service(struct offer_test::service_info _service_info) :
service_info_(_service_info),
- // service with number 1 uses "vsomeipd" as application name
+ // service with number 1 uses "routingmanagerd" as application name
// this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
+ // including the ones with routingmanagerd
app_(vsomeip::runtime::get()->create_application(
- (service_number == "1") ? "vsomeipd" :
+ (service_number == "1") ? "routingmanagerd" :
"offer_test_service" + service_number)),
counter_(0),
wait_until_registered_(true),
@@ -48,7 +48,9 @@ public:
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(service_info_.eventgroup_id);
app_->offer_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, false);
+ service_info_.event_id, its_eventgroups,
+ vsomeip::event_type_e::ET_EVENT, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
inc_counter_and_notify();
diff --git a/test/offer_tests/offer_test_service_external.cpp b/test/offer_tests/offer_test_service_external.cpp
index 694a678..5948f74 100644
--- a/test/offer_tests/offer_test_service_external.cpp
+++ b/test/offer_tests/offer_test_service_external.cpp
@@ -15,7 +15,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "offer_test_globals.hpp"
@@ -25,11 +25,11 @@ class offer_test_service {
public:
offer_test_service(struct offer_test::service_info _service_info) :
service_info_(_service_info),
- // service with number 1 uses "vsomeipd" as application name
+ // service with number 1 uses "routingmanagerd" as application name
// this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
+ // including the ones with routingmanagerd
app_(vsomeip::runtime::get()->create_application(
- (service_number == "1") ? "vsomeipd" :
+ (service_number == "1") ? "routingmanagerd" :
"offer_test_service" + service_number)),
wait_until_registered_(true),
wait_until_service_available_(true),
diff --git a/test/offered_services_info_test/offered_services_info_test_client.cpp b/test/offered_services_info_test/offered_services_info_test_client.cpp
index 1aa0802..202d0a6 100644
--- a/test/offered_services_info_test/offered_services_info_test_client.cpp
+++ b/test/offered_services_info_test/offered_services_info_test_client.cpp
@@ -17,8 +17,13 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-#include "../../implementation/configuration/include/internal.hpp"
+#include <vsomeip/internal/logger.hpp>
+
+#ifdef ANDROID
+#include "../../configuration/include/internal_android.hpp"
+#else
+#include "../../configuration/include/internal.hpp"
+#endif
#include "offered_services_info_test_globals.hpp"
@@ -38,11 +43,9 @@ public:
remote_service_info_(_remote_service_info),
operation_mode_(_mode),
app_(vsomeip::runtime::get()->create_application("offered_services_info_test_client")),
- service_available_(false),
wait_until_registered_(true),
wait_until_service_available_(true),
wait_for_stop_(true),
- last_received_counter_(0),
last_received_response_(std::chrono::steady_clock::now()),
number_received_responses_(0),
stop_thread_(std::bind(&offered_services_info_test_client::wait_for_stop, this)),
@@ -273,7 +276,6 @@ private:
struct offer_test::service_info remote_service_info_;
operation_mode_e operation_mode_;
std::shared_ptr<vsomeip::application> app_;
- bool service_available_;
bool wait_until_registered_;
bool wait_until_service_available_;
@@ -284,7 +286,6 @@ private:
std::mutex stop_mutex_;
std::condition_variable stop_condition_;
- std::uint32_t last_received_counter_;
std::chrono::steady_clock::time_point last_received_response_;
std::atomic<std::uint32_t> number_received_responses_;
std::promise<void> all_callbacks_received_;
diff --git a/test/offered_services_info_test/offered_services_info_test_local.json b/test/offered_services_info_test/offered_services_info_test_local.json
index cb7db92..872ebd2 100644
--- a/test/offered_services_info_test/offered_services_info_test_local.json
+++ b/test/offered_services_info_test/offered_services_info_test_local.json
@@ -29,24 +29,24 @@
"instance" : "0x1"
},
{
- "service" : "0x2222",
- "instance" : "0x2",
- "reliable" : { "port" : "30502" },
- "unreliable" : "31002"
+ "service" : "0x2222",
+ "instance" : "0x2",
+ "reliable" : { "port" : "30502" },
+ "unreliable" : "31002"
},
{
- "service" : "0x2223",
- "instance" : "0x3",
- "reliable" : { "port" : "30503" }
+ "service" : "0x2223",
+ "instance" : "0x3",
+ "reliable" : { "port" : "30503" }
},
{
- "service" : "0x2224",
- "instance" : "0x4",
- "unreliable" : "31004"
+ "service" : "0x2224",
+ "instance" : "0x4",
+ "unreliable" : "31004"
}
],
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"service-discovery" :
{
"enable" : "false",
diff --git a/test/offered_services_info_test/offered_services_info_test_local_starter.sh b/test/offered_services_info_test/offered_services_info_test_local_starter.sh
index 68482f9..50047db 100755
--- a/test/offered_services_info_test/offered_services_info_test_local_starter.sh
+++ b/test/offered_services_info_test/offered_services_info_test_local_starter.sh
@@ -31,8 +31,8 @@ End-of-message
# Array for client pids
CLIENT_PIDS=()
export VSOMEIP_CONFIGURATION=offered_services_info_test_local.json
-# Start the services (vsomeipd as app name)
-./offered_services_info_test_service 1 & #vsomeipd as app name
+# Start the services (routingmanagerd as app name)
+./offered_services_info_test_service 1 & #routingmanagerd as app name
PID_SERVICE_ONE=$!
./offered_services_info_test_client METHODCALL &
CLIENT_PIDS+=($!)
diff --git a/test/offered_services_info_test/offered_services_info_test_service.cpp b/test/offered_services_info_test/offered_services_info_test_service.cpp
index d9a7ae4..a77b074 100644
--- a/test/offered_services_info_test/offered_services_info_test_service.cpp
+++ b/test/offered_services_info_test/offered_services_info_test_service.cpp
@@ -17,7 +17,13 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
+
+#ifdef ANDROID
+#include "../../configuration/include/internal_android.hpp"
+#else
+#include "../../configuration/include/internal.hpp"
+#endif // ANDROID
#include "offered_services_info_test_globals.hpp"
@@ -32,13 +38,12 @@ public:
offer_test_service(struct offer_test::service_info _service_info, struct offer_test::service_info _remote_service_info) :
service_info_(_service_info),
remote_service_info_(_remote_service_info),
- // service with number 1 uses "vsomeipd" as application name
+ // service with number 1 uses "routingmanagerd" as application name
// this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
+ // including the ones with routingmanagerd
app_(vsomeip::runtime::get()->create_application(
- (service_number == "1") ? "vsomeipd" :
+ (service_number == "1") ? "routingmanagerd" :
"offered_services_info_test_service" + service_number)),
- counter_(0),
wait_until_registered_(true),
shutdown_method_called_(false),
offer_thread_(std::bind(&offer_test_service::run, this)) {
@@ -230,7 +235,6 @@ private:
struct offer_test::service_info service_info_;
struct offer_test::service_info remote_service_info_;
std::shared_ptr<vsomeip::application> app_;
- std::uint32_t counter_;
bool wait_until_registered_;
std::mutex mutex_;
diff --git a/test/payload_tests/conf/external_local_payload_test_client_external.json.in b/test/payload_tests/conf/external_local_payload_test_client_external.json.in
index d027a6f..0abaea2 100644
--- a/test/payload_tests/conf/external_local_payload_test_client_external.json.in
+++ b/test/payload_tests/conf/external_local_payload_test_client_external.json.in
@@ -36,7 +36,12 @@
}
}
],
-
+ "npdu-default-timings" : {
+ "debounce-time-request" : "0",
+ "debounce-time-response" : "0",
+ "max-retention-time-request" : "0",
+ "max-retention-time-response" : "0"
+ },
"routing" : "external_local_payload_test_client_external",
"service-discovery" :
{
diff --git a/test/payload_tests/conf/external_local_payload_test_client_local.json.in b/test/payload_tests/conf/external_local_payload_test_client_local.json.in
index 40f40ca..1f4fd6d 100644
--- a/test/payload_tests/conf/external_local_payload_test_client_local.json.in
+++ b/test/payload_tests/conf/external_local_payload_test_client_local.json.in
@@ -37,7 +37,12 @@
}
}
],
-
+ "npdu-default-timings" : {
+ "debounce-time-request" : "0",
+ "debounce-time-response" : "0",
+ "max-retention-time-request" : "0",
+ "max-retention-time-response" : "0"
+ },
"routing" : "external_local_payload_test_service",
"service-discovery" :
{
diff --git a/test/payload_tests/conf/external_local_payload_test_service.json.in b/test/payload_tests/conf/external_local_payload_test_service.json.in
index dc7680c..aaeae82 100644
--- a/test/payload_tests/conf/external_local_payload_test_service.json.in
+++ b/test/payload_tests/conf/external_local_payload_test_service.json.in
@@ -34,7 +34,12 @@
}
}
],
-
+ "npdu-default-timings" : {
+ "debounce-time-request" : "0",
+ "debounce-time-response" : "0",
+ "max-retention-time-request" : "0",
+ "max-retention-time-response" : "0"
+ },
"routing" : "external_local_payload_test_service",
"service-discovery" :
{
diff --git a/test/payload_tests/external_local_payload_test_client_external_starter.sh b/test/payload_tests/external_local_payload_test_client_external_starter.sh
index da6ca08..97d195a 100755
--- a/test/payload_tests/external_local_payload_test_client_external_starter.sh
+++ b/test/payload_tests/external_local_payload_test_client_external_starter.sh
@@ -58,10 +58,10 @@ SERIVCE_PID=$!
# to finish the test successfully
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting external local payload 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/test; ./external_local_payload_test_client_external_start.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; ./external_local_payload_test_client_external_start.sh\"" &
echo "remote ssh job id: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name elptces $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./external_local_payload_test_client_external_start.sh" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./external_local_payload_test_client_external_start.sh" &
else
cat <<End-of-message
*******************************************************************************
@@ -112,11 +112,6 @@ check_tcp_udp_sockets_are_open $SERIVCE_PID 2
# with a non-zero exit code
wait $SERIVCE_PID || ((FAIL+=1))
-if [ ! -z "$USE_DOCKER" ]; then
- docker wait elptces
- docker rm elptces
-fi
-
# Check if server exited sucessfully
if [ $FAIL -eq 0 ]
then
diff --git a/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh b/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh
index 041abc4..b1dd78d 100755
--- a/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh
+++ b/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh
@@ -75,10 +75,10 @@ wait $CLIENT_PID || ((FAIL+=1))
# to finish the test successfully
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting external local payload 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/test; ./external_local_payload_test_client_external_start.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; ./external_local_payload_test_client_external_start.sh\"" &
echo "remote ssh job id: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name elptclaes $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./external_local_payload_test_client_external_start.sh" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./external_local_payload_test_client_external_start.sh" &
else
cat <<End-of-message
*******************************************************************************
@@ -129,11 +129,6 @@ check_tcp_udp_sockets_are_open $SERIVCE_PID 2
# with a non-zero exit code
wait $SERIVCE_PID || ((FAIL+=1))
-if [ ! -z "$USE_DOCKER" ]; then
- docker wait elptclaes
- docker rm elptclaes
-fi
-
# Check if client and server both exited sucessfully and the service didnt't
# have any open TCP/UDP sockets
if [ $FAIL -eq 0 ]
diff --git a/test/payload_tests/payload_test_client.cpp b/test/payload_tests/payload_test_client.cpp
index 65dbec7..0a9708f 100644
--- a/test/payload_tests/payload_test_client.cpp
+++ b/test/payload_tests/payload_test_client.cpp
@@ -86,7 +86,7 @@ void payload_test_client::shutdown_service()
request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
request_->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
- app_->send(request_,true);
+ app_->send(request_);
}
void payload_test_client::join_sender_thread()
@@ -151,7 +151,7 @@ void payload_test_client::on_message(const std::shared_ptr<vsomeip::message>& _r
all_msg_acknowledged_ = true;
all_msg_acknowledged_cv_.notify_one();
}
- else if(number_of_acknowledged_messages_ % sliding_window_size == 0)
+ else if(number_of_acknowledged_messages_ % sliding_window_size_ == 0)
{
std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
all_msg_acknowledged_ = true;
@@ -259,7 +259,7 @@ void payload_test_client::send_messages_sync(std::unique_lock<std::mutex>& lk)
number_of_sent_messages_ < number_of_messages_to_send_;
number_of_sent_messages_++, number_of_sent_messages_total_++)
{
- app_->send(request_, true);
+ app_->send(request_);
// wait until the send messages has been acknowledged
// as long we wait lk is released; after wait returns lk is reacquired
all_msg_acknowledged_cv_.wait(lk, [&]
@@ -275,9 +275,9 @@ void payload_test_client::send_messages_async(std::unique_lock<std::mutex>& lk)
number_of_sent_messages_ < number_of_messages_to_send_;
number_of_sent_messages_++, number_of_sent_messages_total_++)
{
- app_->send(request_, true);
+ app_->send(request_);
- if((number_of_sent_messages_+1) % sliding_window_size == 0)
+ if((number_of_sent_messages_+1) % sliding_window_size_ == 0)
{
// wait until all send messages have been acknowledged
// as long we wait lk is released; after wait returns lk is reacquired
diff --git a/test/payload_tests/payload_test_service.cpp b/test/payload_tests/payload_test_service.cpp
index bb174cd..18935f9 100644
--- a/test/payload_tests/payload_test_service.cpp
+++ b/test/payload_tests/payload_test_service.cpp
@@ -6,13 +6,12 @@
#include "payload_test_service.hpp"
// this variables are changed via cmdline parameters
-static bool use_tcp = false;
+
static bool check_payload = true;
-payload_test_service::payload_test_service(bool _use_tcp) :
+payload_test_service::payload_test_service() :
app_(vsomeip::runtime::get()->create_application()),
is_registered_(false),
- use_tcp_(_use_tcp),
blocked_(false),
number_of_received_messages_(0),
offer_thread_(std::bind(&payload_test_service::run, this))
@@ -130,7 +129,7 @@ void payload_test_service::on_message(const std::shared_ptr<vsomeip::message>& _
std::shared_ptr<vsomeip::message> its_response =
vsomeip::runtime::get()->create_response(_request);
- app_->send(its_response, true);
+ app_->send(its_response);
}
void payload_test_service::on_message_shutdown(
@@ -152,7 +151,7 @@ void payload_test_service::run()
TEST(someip_payload_test, send_response_for_every_request)
{
- payload_test_service test_service(use_tcp);
+ payload_test_service test_service;
if (test_service.init()) {
test_service.start();
test_service.join_offer_thread();
diff --git a/test/payload_tests/payload_test_service.hpp b/test/payload_tests/payload_test_service.hpp
index 32ae1e7..9054fd9 100644
--- a/test/payload_tests/payload_test_service.hpp
+++ b/test/payload_tests/payload_test_service.hpp
@@ -19,7 +19,7 @@
class payload_test_service
{
public:
- payload_test_service(bool _use_tcp);
+ payload_test_service();
bool init();
void start();
void stop();
@@ -34,8 +34,6 @@ public:
private:
std::shared_ptr<vsomeip::application> app_;
bool is_registered_;
- bool use_tcp_;
- bool use_static_routing_;
std::mutex mutex_;
std::condition_variable condition_;
diff --git a/test/pending_subscription_tests/conf/pending_subscription_test_master.json.in b/test/pending_subscription_tests/conf/pending_subscription_test_master.json.in
index 5c363a7..5bcbe9a 100644
--- a/test/pending_subscription_tests/conf/pending_subscription_test_master.json.in
+++ b/test/pending_subscription_tests/conf/pending_subscription_test_master.json.in
@@ -29,10 +29,21 @@
{
"port":"40001",
"enable-magic-cookies":"false"
- }
+ },
+ "events" :
+ [
+ {
+ "event" : "0x1111",
+ "is_reliable" : "false"
+ },
+ {
+ "event" : "0x1112",
+ "is_reliable" : "false"
+ }
+ ]
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
diff --git a/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in b/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in
index c36f14d..a43e3c4 100755
--- a/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in
+++ b/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in
@@ -23,7 +23,7 @@ fi
TESTMODE=$1
export VSOMEIP_CONFIGURATION=pending_subscription_test_master.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the services
./pending_subscription_test_service $1 &
@@ -35,10 +35,12 @@ if [ ! -z "$USE_LXC_TEST" ]; then
echo "Waiting for 5s"
sleep 5
echo "starting offer test on slave LXC offer_test_external_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/test; ./pending_subscription_test_sd_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE\"" &
+ 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; ./pending_subscription_test_sd_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE\"" &
echo "remote ssh pid: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./pending_subscription_test_sd_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE" &
+ echo "Waiting for 5s"
+ sleep 5
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./pending_subscription_test_sd_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE" &
else
cat <<End-of-message
*******************************************************************************
@@ -66,10 +68,5 @@ done
kill $PID_VSOMEIPD
sleep 1
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otems
- docker rm otems
-fi
-
# Check if everything went well
exit $FAIL
diff --git a/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp b/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp
index 9668c66..6d597cb 100644
--- a/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp
+++ b/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp
@@ -51,6 +51,12 @@ protected:
std::thread io_thread_;
};
+/*
+ * @test Send 16 subscriptions to the service and check that every
+ * subscription is answered with an SubscribeEventgroupAck entry by the service.
+ * Check that the subscription is active at the end of the test and check that
+ * the notifications send by the service receive the client
+ */
TEST_F(pending_subscription, send_multiple_subscriptions)
{
std::promise<bool> trigger_notifications;
@@ -61,90 +67,88 @@ TEST_F(pending_subscription, send_multiple_subscriptions)
udp_socket.set_option(boost::asio::socket_base::linger(true, 0));
std::thread receive_thread([&](){
- std::atomic<bool> keep_receiving(true);
- std::function<void()> receive;
+ bool keep_receiving(true);
std::vector<std::uint8_t> receive_buffer(4096);
std::vector<vsomeip::event_t> its_received_events;
+ std::uint32_t subscribe_acks_receiveid = 0;
+ std::uint32_t events_received = 0;
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (error) {
keep_receiving = false;
ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #endif
-
- vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
- vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
- receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
- vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
- receive_buffer[VSOMEIP_METHOD_POS_MAX]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(3u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
+ } else {
+
+ std::uint32_t its_pos = 0;
+
+ while (bytes_transferred > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_EQ(2u, sd_msg.get_entries().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ EXPECT_TRUE(e->is_eventgroup_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
+ EXPECT_EQ(3u, e->get_ttl());
+ EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
+ EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
+ std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
+ EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
+ its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
+ subscribe_acks_receiveid++;
+ }
+ }
+ EXPECT_EQ(0u, sd_msg.get_options().size());
+ } else { // non-sd-message
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
+ EXPECT_EQ(0x2222, msg.get_client());
+ } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ its_received_events.push_back(msg.get_method());
+ if (its_received_events.size() == 2) {
+ EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
+ EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ events_received = 2;
+ }
+ EXPECT_EQ(1u, msg.get_payload()->get_length());
+ EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(0x0, msg.get_client());
+ }
}
}
- EXPECT_EQ(0u, sd_msg.get_options().size());
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
- }
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
+ if (subscribe_acks_receiveid == 30) { // all subscribeAcks received
+ trigger_notifications.set_value(true);
+ subscribe_acks_receiveid++; // don't set promise value again
+ }
+ if (its_received_events.size() == 2 && events_received == 2) {
+ // all events received as well
+ keep_receiving = false;
}
}
-
- static int called = 0;
- if (++called == 15) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- }
- if (called == 18) { // events were received as well
- keep_receiving = false;
- }
- if (!error && keep_receiving) {
- receive();
- }
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(keep_receiving) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
});
@@ -221,6 +225,13 @@ TEST_F(pending_subscription, send_multiple_subscriptions)
udp_socket.close(ec);
}
+/*
+ * @test Send 16 subscriptions to the service while alternating between Subscribe
+ * and Unsubscribe and check that every SubscribeEventgroupEntry (ttl > 0)
+ * is answered with an SubscribeEventgroupAck entry by the service.
+ * Check that the subscription is active at the end of the test and check that
+ * the notifications send by the service receive the client
+ */
TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe)
{
std::promise<bool> trigger_notifications;
@@ -242,97 +253,101 @@ TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe)
bool triggered_notifications(false);
- std::function<void()> receive;
std::vector<std::uint8_t> receive_buffer(4096);
std::vector<vsomeip::event_t> its_received_events;
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
+ bool keep_receiving(true);
+
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (error) {
+ keep_receiving = false;
acks_received = expected_acks;
responses_received = expected_responses;
ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #endif
-
- vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
- vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
- receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
- vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
- receive_buffer[VSOMEIP_METHOD_POS_MAX]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(16u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
- }
+ } else {
+ #if 0
+ std::stringstream str;
+ for (size_t i = 0; i < bytes_transferred; i++) {
+ str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
}
- EXPECT_EQ(0u, sd_msg.get_options().size());
- acks_received++;
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
+ #endif
+ std::uint32_t its_pos = 0;
+
+ while (bytes_transferred > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_EQ(2u, sd_msg.get_entries().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ EXPECT_TRUE(e->is_eventgroup_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
+ EXPECT_EQ(16u, e->get_ttl());
+ EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
+ EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
+ std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
+ EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
+ its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
+ }
+ }
+ EXPECT_EQ(0u, sd_msg.get_options().size());
+ acks_received++;
+ } else { // non-sd-message
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
+ EXPECT_EQ(0x2222, msg.get_client());
+ responses_received++;
+ } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ its_received_events.push_back(msg.get_method());
+ if (its_received_events.size() == 2) {
+ EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
+ EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ }
+ EXPECT_EQ(1u, msg.get_payload()->get_length());
+ EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(0x0, msg.get_client());
+ notifications_received++;
+ }
}
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- notifications_received++;
- }
- }
-
- if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- triggered_notifications = true;
+ if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
+ trigger_notifications.set_value(true);
+ triggered_notifications = true;
+ }
+ }
}
-
- if (!error && (acks_received != expected_acks ||
- responses_received != expected_responses ||
- notifications_received != expected_notifications)) {
- receive();
+ if (acks_received == expected_acks &&
+ responses_received == expected_responses &&
+ notifications_received == expected_notifications) {
+ keep_receiving = false;
}
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(acks_received < expected_acks ||
- responses_received < expected_responses ||
- notifications_received < expected_notifications) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
+
+
EXPECT_EQ(expected_acks, acks_received);
EXPECT_EQ(expected_responses, responses_received);
EXPECT_EQ(expected_notifications, notifications_received);
@@ -418,6 +433,14 @@ TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe)
udp_socket.close(ec);
}
+/*
+ * @test Send 16 subscriptions to the service while only two contain a
+ * SubscribeEventgroupEntry and the rest contain StopSubscribeEventgroupEntries
+ * and check that all subscriptions with SubscribeEventgroupEntries are
+ * answered with an SubscribeEventgroupAck entry by the service.
+ * Check that the subscription is active at the end of the test and check that
+ * the notifications send by the service receive the client
+ */
TEST_F(pending_subscription, send_multiple_unsubscriptions)
{
std::promise<bool> trigger_notifications;
@@ -439,97 +462,98 @@ TEST_F(pending_subscription, send_multiple_unsubscriptions)
bool triggered_notifications(false);
- std::function<void()> receive;
std::vector<std::uint8_t> receive_buffer(4096);
std::vector<vsomeip::event_t> its_received_events;
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
+ bool keep_receiving(true);
+
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (error) {
+ keep_receiving = false;
acks_received = expected_acks;
responses_received = expected_responses;
ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #endif
-
- vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
- vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
- receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
- vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
- receive_buffer[VSOMEIP_METHOD_POS_MAX]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(16u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
- }
+ } else {
+ #if 0
+ std::stringstream str;
+ for (size_t i = 0; i < bytes_transferred; i++) {
+ str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
}
- EXPECT_EQ(0u, sd_msg.get_options().size());
- acks_received++;
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
+ #endif
+ std::uint32_t its_pos = 0;
+ while (bytes_transferred > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_EQ(2u, sd_msg.get_entries().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ EXPECT_TRUE(e->is_eventgroup_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
+ EXPECT_EQ(16u, e->get_ttl());
+ EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
+ EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
+ std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
+ EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
+ its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
+ }
+ }
+ EXPECT_EQ(0u, sd_msg.get_options().size());
+ acks_received++;
+ } else { // non-sd-message
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
+ EXPECT_EQ(0x2222, msg.get_client());
+ responses_received++;
+ } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ its_received_events.push_back(msg.get_method());
+ if (its_received_events.size() == 2) {
+ EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
+ EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ }
+ EXPECT_EQ(1u, msg.get_payload()->get_length());
+ EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(0x0, msg.get_client());
+ notifications_received++;
+ }
}
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- notifications_received++;
+ }
+ if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
+ trigger_notifications.set_value(true);
+ triggered_notifications = true;
}
}
-
-
- if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- triggered_notifications = true;
- }
-
- if (!error && (acks_received != expected_acks ||
- responses_received != expected_responses ||
- notifications_received != expected_notifications)) {
- receive();
+ if (acks_received == expected_acks &&
+ responses_received == expected_responses &&
+ notifications_received == expected_notifications) {
+ std::cerr << "every thing received" << std::endl;
+ keep_receiving = false;
}
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(acks_received < expected_acks ||
- responses_received < expected_responses ||
- notifications_received < expected_notifications) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
+
EXPECT_EQ(expected_acks, acks_received);
EXPECT_EQ(expected_responses, responses_received);
EXPECT_EQ(expected_notifications, notifications_received);
@@ -615,6 +639,12 @@ TEST_F(pending_subscription, send_multiple_unsubscriptions)
udp_socket.close(ec);
}
+/*
+ * @test Send 16 subscriptions to the service and check that every second
+ * subscription is answered with an SubscribeEventgroupNack entry by the service.
+ * Check that the subscription is active at the end of the test and check that
+ * the notifications send by the service receive the client
+ */
TEST_F(pending_subscription, send_alternating_subscribe_nack_unsubscribe)
{
std::promise<bool> trigger_notifications;
@@ -638,107 +668,110 @@ TEST_F(pending_subscription, send_alternating_subscribe_nack_unsubscribe)
std::atomic<std::uint32_t> notifications_received(0);
bool triggered_notifications(false);
+ bool keep_receiving(true);
- std::function<void()> receive;
std::vector<std::uint8_t> receive_buffer(4096);
std::vector<vsomeip::event_t> its_received_events;
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (error) {
+ keep_receiving = false;
acks_received = expected_acks;
responses_received = expected_responses;
nacks_received = expected_nacks;
ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #endif
-
- vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
- vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
- receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
- vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
- receive_buffer[VSOMEIP_METHOD_POS_MAX]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- if (e->get_ttl()) {
- EXPECT_EQ(16u, e->get_ttl());
- acks_received++;
- } else {
- EXPECT_EQ(0u, e->get_ttl());
- nacks_received++;
- }
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
- }
+ } else {
+ #if 0
+ std::stringstream str;
+ for (size_t i = 0; i < bytes_transferred; i++) {
+ str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
}
- EXPECT_EQ(0u, sd_msg.get_options().size());
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
+ #endif
+ std::uint32_t its_pos = 0;
+ while (bytes_transferred > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_EQ(2u, sd_msg.get_entries().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ EXPECT_TRUE(e->is_eventgroup_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
+ if (e->get_ttl()) {
+ EXPECT_EQ(16u, e->get_ttl());
+ acks_received++;
+ } else {
+ EXPECT_EQ(0u, e->get_ttl());
+ nacks_received++;
+ }
+ EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
+ EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
+ std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
+ EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
+ its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
+ }
+ }
+ EXPECT_EQ(0u, sd_msg.get_options().size());
+ } else { // non-sd-message
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
+ EXPECT_EQ(0x2222, msg.get_client());
+ responses_received++;
+ } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ its_received_events.push_back(msg.get_method());
+ if (its_received_events.size() == 2) {
+ EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
+ EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ }
+ EXPECT_EQ(1u, msg.get_payload()->get_length());
+ EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(0x0, msg.get_client());
+ notifications_received++;
+ }
}
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- notifications_received++;
- }
- }
- if (!triggered_notifications && acks_received == expected_acks &&
- nacks_received == expected_nacks) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- triggered_notifications = true;
+ if (!triggered_notifications && acks_received == expected_acks &&
+ nacks_received == expected_nacks) { // all subscribeAcks received
+ trigger_notifications.set_value(true);
+ triggered_notifications = true;
+ }
+ }
}
-
- if (!error && (acks_received != expected_acks ||
- responses_received != expected_responses ||
- notifications_received != expected_notifications ||
- nacks_received != expected_nacks)) {
- receive();
+ if (nacks_received == expected_nacks &&
+ acks_received == expected_acks &&
+ notifications_received == expected_notifications &&
+ responses_received == expected_responses) {
+ keep_receiving = false;
}
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(acks_received < expected_acks ||
- responses_received < expected_responses ||
- notifications_received < expected_notifications) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
+
EXPECT_EQ(expected_acks, acks_received);
+ EXPECT_EQ(expected_nacks, nacks_received);
EXPECT_EQ(expected_responses, responses_received);
EXPECT_EQ(expected_notifications, notifications_received);
});
@@ -823,6 +856,14 @@ TEST_F(pending_subscription, send_alternating_subscribe_nack_unsubscribe)
udp_socket.close(ec);
}
+/*
+ * @test Send 16 subscriptions containing an UDP and TCP endpoint option
+ * to the service while alternating between Subscribe
+ * and Unsubscribe and check that every SubscribeEventgroupEntry (ttl > 0)
+ * is answered with an SubscribeEventgroupAck entry by the service.
+ * Check that the subscription is active at the end of the test and check that
+ * the notifications send by the service receive the client
+ */
TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe_same_port)
{
std::promise<bool> trigger_notifications;
@@ -848,7 +889,6 @@ TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe_same_port)
bool triggered_notifications(false);
- std::function<void()> receive;
std::vector<std::uint8_t> receive_buffer(4096);
std::vector<vsomeip::event_t> its_received_events;
@@ -858,93 +898,93 @@ TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe_same_port)
ASSERT_EQ(0, ec.value());
tcp_connected.set_value();
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
+ bool keep_receiving(true);
+
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (error) {
+ keep_receiving = false;
acks_received = expected_acks;
responses_received = expected_responses;
ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #endif
-
- vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
- vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
- receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
- vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
- receive_buffer[VSOMEIP_METHOD_POS_MAX]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(16u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
- }
- }
- EXPECT_EQ(0u, sd_msg.get_options().size());
- acks_received++;
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ } else {
+
+ std::uint32_t its_pos = 0;
+
+ while (bytes_transferred > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_EQ(2u, sd_msg.get_entries().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ EXPECT_TRUE(e->is_eventgroup_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
+ EXPECT_EQ(16u, e->get_ttl());
+ EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
+ EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
+ std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
+ EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
+ its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
+ }
+ }
+ EXPECT_EQ(0u, sd_msg.get_options().size());
+ acks_received++;
+ } else { // non-sd-message
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
+ EXPECT_EQ(0x2222, msg.get_client());
+ responses_received++;
+ } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ its_received_events.push_back(msg.get_method());
+ if (its_received_events.size() == 2) {
+ EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
+ EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
+ }
+ EXPECT_EQ(1u, msg.get_payload()->get_length());
+ EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(0x0, msg.get_client());
+ notifications_received++;
+ }
}
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- notifications_received++;
- }
- }
- if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- triggered_notifications = true;
+ if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
+ trigger_notifications.set_value(true);
+ triggered_notifications = true;
+ }
+ }
}
-
- if (!error && (acks_received != expected_acks ||
- responses_received != expected_responses ||
- notifications_received != expected_notifications)) {
- receive();
+ if (acks_received == expected_acks &&
+ responses_received == expected_responses &&
+ notifications_received == expected_notifications) {
+ keep_receiving = false;
}
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(acks_received < expected_acks ||
- responses_received < expected_responses ||
- notifications_received < expected_notifications) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
+
+
EXPECT_EQ(expected_acks, acks_received);
EXPECT_EQ(expected_responses, responses_received);
EXPECT_EQ(expected_notifications, notifications_received);
@@ -1056,99 +1096,115 @@ TEST_F(pending_subscription, subscribe_resubscribe_mixed)
udp_socket.set_option(boost::asio::socket_base::linger(true, 0));
std::thread receive_thread([&](){
- std::atomic<bool> keep_receiving(true);
- std::function<void()> receive;
std::vector<std::uint8_t> receive_buffer(4096);
std::vector<vsomeip::event_t> its_received_events;
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
+ const std::uint32_t expected_acks(3);
+ std::atomic<std::uint32_t> acks_received(0);
+
+ const std::uint32_t expected_responses(1);
+ std::atomic<std::uint32_t> responses_received(0);
+
+ const std::uint32_t expected_notifications(2);
+ std::atomic<std::uint32_t> notifications_received(0);
+
+ bool keep_receiving(true);
+ bool first_initial_event_checked(false);
+ bool second_initial_event_checked(false);
+
+
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transfered = udp_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (error) {
keep_receiving = false;
ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #endif
-
- vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
- vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
- receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
- vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
- receive_buffer[VSOMEIP_METHOD_POS_MAX]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_GE(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(3u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
+ } else {
+
+ std::uint32_t its_pos = 0;
+
+ while (bytes_transfered > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ its_pos += its_message_size;
+ bytes_transfered -= its_message_size;
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_GE(2u, sd_msg.get_entries().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ EXPECT_TRUE(e->is_eventgroup_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
+ EXPECT_EQ(3u, e->get_ttl());
+ EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
+ EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
+ acks_received++;
+ std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
+ EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
+ its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
+ }
+ }
+ EXPECT_EQ(0u, sd_msg.get_options().size());
+ } else { // non-sd-message
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
+ EXPECT_EQ(0x2222, msg.get_client());
+ responses_received++;
+ } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ its_received_events.push_back(msg.get_method());
+ if (its_received_events.size() == 2) {
+ EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[0]);
+ EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[1]);
+ }
+ EXPECT_EQ(1u, msg.get_payload()->get_length());
+ EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(0x0, msg.get_client());
+ notifications_received++;
+ }
}
- }
- EXPECT_EQ(0u, sd_msg.get_options().size());
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
+
+ if (!first_initial_event_checked && notifications_received == 1) {
+ EXPECT_EQ(1u, its_received_events.size());
+ EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[0]);
+ // all subscribeAcks and one initial event of first event received
+ first_initial_event_received.set_value();
+ first_initial_event_checked = true;
+ }
+
+ if (!second_initial_event_checked && notifications_received == 2) { // events were received as well
+ // all subscribeAcks and one initial event of second event received
+ EXPECT_EQ(2u, its_received_events.size());
EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[0]);
EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[1]);
+ second_initial_event_received.set_value();
+ second_initial_event_checked = true;
+ }
+ if (notifications_received == 2 && responses_received == 1) {
+ keep_receiving = false;
}
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
}
}
-
- static int called = 0;
- if (++called == 2) {
- EXPECT_EQ(1u, its_received_events.size());
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[0]);
- // all subscribeAcks and one initial event of first event received
- first_initial_event_received.set_value();
- }
- if (called == 4) { // events were received as well
- // all subscribeAcks and one initial event of second event received
- EXPECT_EQ(2u, its_received_events.size());
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[0]);
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[1]);
- keep_receiving = false;
- second_initial_event_received.set_value();
- }
- if (!error && keep_receiving) {
- receive();
- }
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(keep_receiving) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
+ EXPECT_EQ(expected_acks, acks_received);
+ EXPECT_EQ(expected_notifications, notifications_received);
+ EXPECT_EQ(expected_responses, responses_received);
});
std::thread send_thread([&]() {
@@ -1261,7 +1317,7 @@ TEST_F(pending_subscription, send_subscribe_stop_subscribe_subscribe)
tcp_socket.set_option(boost::asio::socket_base::linger(true, 0));
std::thread receive_thread([&](){
- const std::uint32_t expected_acks(1);
+ const std::uint32_t expected_acks(2);
std::atomic<std::uint32_t> acks_received(0);
const std::uint32_t expected_responses(1);
@@ -1272,7 +1328,6 @@ TEST_F(pending_subscription, send_subscribe_stop_subscribe_subscribe)
bool triggered_notifications(false);
- std::function<void()> receive;
std::vector<std::uint8_t> receive_buffer(4096);
std::vector<vsomeip::event_t> its_received_events;
@@ -1282,88 +1337,93 @@ TEST_F(pending_subscription, send_subscribe_stop_subscribe_subscribe)
ASSERT_EQ(0, ec.value());
tcp_connected.set_value();
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
+ bool keep_receiving(true);
+
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (error) {
+ keep_receiving = false;
acks_received = expected_acks;
responses_received = expected_responses;
ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #endif
-
- vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
- vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
- receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
- vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
- receive_buffer[VSOMEIP_METHOD_POS_MAX]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(1u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(16u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id);
- }
- }
- EXPECT_EQ(0u, sd_msg.get_options().size());
- acks_received++;
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- EXPECT_EQ(1u, its_received_events.size());
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- notifications_received++;
- }
- }
+ } else {
+ std::uint32_t its_pos = 0;
- if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- triggered_notifications = true;
- }
+ while (bytes_transferred > 0) {
+ #if 0
+ std::stringstream str;
+ for (size_t i = 0; i < bytes_transferred; i++) {
+ str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
+ }
+ std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
+ #endif
+
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_EQ(1u, sd_msg.get_entries().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ EXPECT_TRUE(e->is_eventgroup_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
+ EXPECT_EQ(16u, e->get_ttl());
+ EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
+ EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
+ std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
+ EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id);
+ }
+ }
+ EXPECT_EQ(0u, sd_msg.get_options().size());
+ acks_received++;
+ } else { // non-sd-message
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
+ EXPECT_EQ(0x2222, msg.get_client());
+ responses_received++;
+ } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ its_received_events.push_back(msg.get_method());
+ EXPECT_EQ(1u, its_received_events.size());
+ EXPECT_EQ(1u, msg.get_payload()->get_length());
+ EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(0x0, msg.get_client());
+ notifications_received++;
+ }
+ }
- if (!error && (acks_received != expected_acks ||
- responses_received != expected_responses ||
- notifications_received != expected_notifications)) {
- receive();
+ if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
+ trigger_notifications.set_value(true);
+ triggered_notifications = true;
+ }
+ }
+ if (acks_received == expected_acks &&
+ responses_received == expected_responses &&
+ notifications_received == expected_notifications) {
+ keep_receiving = false;
+ }
}
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(acks_received < expected_acks ||
- responses_received < expected_responses ||
- notifications_received < expected_notifications) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
EXPECT_EQ(expected_acks, acks_received);
EXPECT_EQ(expected_responses, responses_received);
@@ -1376,10 +1436,26 @@ TEST_F(pending_subscription, send_subscribe_stop_subscribe_subscribe)
}
try {
+ std::uint8_t its_normal_subscribe_message[] = {
+ 0xff, 0xff, 0x81, 0x00,
+ 0x00, 0x00, 0x00, 0x30, // length
+ 0x00, 0x00, 0x00, 0x01,
+ 0x01, 0x01, 0x02, 0x00,
+ 0xc0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, // length entries array
+ 0x06, 0x00, 0x00, 0x10, // subscribe Eventgroup entry
+ 0x11, 0x22, 0x00, 0x01, // service / instance
+ 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL
+ 0x00, 0x00, 0x10, 0x00, // eventgroup
+ 0x00, 0x00, 0x00, 0x0c, // length options array
+ 0x00, 0x09, 0x04, 0x00,
+ 0xff, 0xff, 0xff, 0xff, // ip address
+ 0x00, 0x11, 0x77, 0x1a
+ };
std::uint8_t its_subscribe_message[] = {
0xff, 0xff, 0x81, 0x00,
0x00, 0x00, 0x00, 0x50, // length
- 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x02,
0x01, 0x01, 0x02, 0x00,
0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, // length entries array
@@ -1404,10 +1480,13 @@ TEST_F(pending_subscription, send_subscribe_stop_subscribe_subscribe)
boost::asio::ip::address its_local_address =
boost::asio::ip::address::from_string(std::string(local_address));
std::memcpy(&its_subscribe_message[80], &its_local_address.to_v4().to_bytes()[0], 4);
+ std::memcpy(&its_normal_subscribe_message[48], &its_local_address.to_v4().to_bytes()[0], 4);
boost::asio::ip::udp::socket::endpoint_type target_sd(
boost::asio::ip::address::from_string(std::string(remote_address)),
30490);
+
+ udp_socket.send_to(boost::asio::buffer(its_normal_subscribe_message), target_sd);
udp_socket.send_to(boost::asio::buffer(its_subscribe_message), target_sd);
if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) {
@@ -1466,80 +1545,80 @@ TEST_F(pending_subscription, send_request_to_sd_port)
udp_socket.set_option(boost::asio::socket_base::linger(true, 0));
std::thread receive_thread([&](){
- std::atomic<bool> keep_receiving(true);
- std::function<void()> receive;
+ bool keep_receiving(true);
std::vector<std::uint8_t> receive_buffer(4096);
std::vector<vsomeip::event_t> its_received_events;
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
if (error) {
keep_receiving = false;
ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #endif
-
- static int offers_received = 0;
- static int responses_received = 0;
- vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
- vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
- receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
- vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
- receive_buffer[VSOMEIP_METHOD_POS_MAX]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(1u, sd_msg.get_entries().size());
- EXPECT_EQ(2u, sd_msg.get_options().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_service_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::OFFER_SERVICE, e->get_type());
- EXPECT_EQ(0xffffffu, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- offers_received++;
- }
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- }
- }
+ } else {
+ std::uint32_t its_pos = 0;
+ while (bytes_transferred > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+
+ #if 0
+ std::stringstream str;
+ for (size_t i = 0; i < bytes_transferred; i++) {
+ str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
+ }
+ std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
+ #endif
+ static int offers_received = 0;
+ static int responses_received = 0;
+
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_EQ(1u, sd_msg.get_entries().size());
+ EXPECT_EQ(2u, sd_msg.get_options().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ EXPECT_TRUE(e->is_service_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::OFFER_SERVICE, e->get_type());
+ EXPECT_EQ(0xffffffu, e->get_ttl());
+ EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
+ EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
+ offers_received++;
+ }
+ } else { // non-sd-message
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
+ EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
+ EXPECT_EQ(0x2222, msg.get_client());
+ responses_received++;
+ }
+ }
- if (responses_received == 1) { // resonse to shutdown method was received as well
- keep_receiving = false;
- } else if (offers_received == 3 ) { // all multiple offers received
- try {
- all_offers_received.set_value(true);
- } catch (const std::future_error& e) {
+ if (responses_received == 1) { // response to shutdown method was received as well
+ keep_receiving = false;
+ } else if (offers_received == 3 ) { // all multiple offers received
+ try {
+ all_offers_received.set_value(true);
+ } catch (const std::future_error& e) {
+ }
+ }
}
}
- if (!error && keep_receiving) {
- receive();
- }
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(keep_receiving) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
});
diff --git a/test/pending_subscription_tests/pending_subscription_test_service.cpp b/test/pending_subscription_tests/pending_subscription_test_service.cpp
index 6a917ea..29ce3f2 100644
--- a/test/pending_subscription_tests/pending_subscription_test_service.cpp
+++ b/test/pending_subscription_tests/pending_subscription_test_service.cpp
@@ -17,7 +17,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "pending_subscription_test_globals.hpp"
@@ -44,14 +44,19 @@ public:
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(_service_info.eventgroup_id);
app_->offer_event(service_info_.service_id, 0x1,
- service_info_.event_id, its_eventgroups, true);
+ service_info_.event_id,
+ its_eventgroups, vsomeip::event_type_e::ET_FIELD,
+ std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
its_eventgroups.clear();
its_eventgroups.insert(static_cast<vsomeip::eventgroup_t>(_service_info.eventgroup_id+1u));
app_->offer_event(service_info_.service_id, 0x1,
static_cast<vsomeip::event_t>(service_info_.event_id+1u),
- its_eventgroups, true);
+ its_eventgroups, vsomeip::event_type_e::ET_FIELD,
+ std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
app_->register_message_handler(vsomeip::ANY_SERVICE,
vsomeip::ANY_INSTANCE, service_info_.shutdown_method_id,
@@ -66,11 +71,13 @@ public:
app_->register_async_subscription_handler(service_info_.service_id,
0x1, service_info_.eventgroup_id,
std::bind(&pending_subscription_test_service::subscription_handler_async,
- this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+ this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
+ std::placeholders::_4, std::placeholders::_5));
app_->register_subscription_handler(service_info_.service_id,
0x1, static_cast<vsomeip::eventgroup_t>(service_info_.eventgroup_id+1u),
std::bind(&pending_subscription_test_service::subscription_handler,
- this, std::placeholders::_1, std::placeholders::_2));
+ this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
+ std::placeholders::_4));
app_->start();
}
@@ -158,7 +165,7 @@ public:
}
std::future<bool> itsFuture = notify_method_called_.get_future();
- if (std::future_status::timeout == itsFuture.wait_for(std::chrono::seconds(10))) {
+ if (std::future_status::timeout == itsFuture.wait_for(std::chrono::seconds(30))) {
ADD_FAILURE() << "notify method wasn't called within time!";
} else {
EXPECT_TRUE(itsFuture.get());
@@ -170,8 +177,10 @@ public:
stop();
}
- void subscription_handler_async(vsomeip::client_t _client, bool _subscribed,
- std::function<void(const bool)> _cbk) {
+ void subscription_handler_async(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid,
+ bool _subscribed, const std::function<void(const bool)>& _cbk) {
+ (void)_uid;
+ (void)_gid;
VSOMEIP_WARNING << __func__ << " " << std::hex << _client << " subscribed." << _subscribed;
if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE) {
async_subscription_handler_ = _cbk;
@@ -225,7 +234,7 @@ public:
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
_cbk(true);
- if (count_subscribe == 16 || count_unsubscribe == 14) {
+ if (count_subscribe == 8 || count_unsubscribe == 7) {
subscription_accepted_asynchronous_ = true;
}
} else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_RESUBSCRIBE_MIXED) {
@@ -248,8 +257,10 @@ public:
}
}
- bool subscription_handler(vsomeip::client_t _client, bool _subscribed) {
+ bool subscription_handler(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid, bool _subscribed) {
(void)_subscribed;
+ (void)_uid;
+ (void)_gid;
bool ret(false);
VSOMEIP_WARNING << __func__ << " " << std::hex << _client << " subscribed. " << _subscribed;
if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE) {
@@ -300,10 +311,11 @@ public:
static int count_subscribed = 0;
static int count_unsubscribe = 0;
_subscribed ? count_subscribed++ : count_unsubscribe++;
+
if (count_subscribed == 1) {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
- if (count_subscribed == 16 && count_unsubscribe == 14) {
+ if (count_subscribed == 8 && count_unsubscribe == 7) {
subscription_accepted_synchronous_ = true;
}
ret = true;
diff --git a/test/readme.txt b/test/readme.txt
index 9f7985a..2841795 100644
--- a/test/readme.txt
+++ b/test/readme.txt
@@ -520,3 +520,54 @@ Rejecting remote offer for which there is already a local offer
* start application which offers service
* send SD message trying to offer the same service instance as already
offered locally from a remote host -> should be rejected
+
+nPDU tests
+-----------------
+
+This test is intended to test the functionality of the so called nPDU
+feature. The test setup is as followed:
+
+* There are two nodes, one hosting the services, one hosting the clients.
+* On each of the nodes is a routing manager daemon (RMD) started whose only
+ purpose is to provide routing manager functionality and shutdown the clients
+ and services at the end.
+* There are four services created. Each of the services has four methods.
+* All services are listening on the same port. Therefore there only is:
+ * one server endpoint created in the RMD on service side
+ * one client endpoint created in the RMD on client side
+* There are four clients created. Each of the clients will:
+ * Create a thread for each service
+ * Create a thread for each method of each service
+ * Send multiple messages with increasing payload to each of the services'
+ methods from the corresponding thread.
+ * After sending the threads will sleep the correct amount of time to insure
+ applicative debounce > debounce time + max retention time.
+* After all messages have been sent to the services the clients will notify the
+ RMD that they're finished. The RMD then instructs the RMD on service side to
+ shutdown the services and exit afterwards. After that the RMD on client side
+ exits as well.
+* Upon receiving a method call the service will check if the debounce time
+ specified in the json file for this method was undershot and print out a
+ warning.
+* The test first runs in synchronous mode and waits for a response of the
+ service before sending the next message.
+* After that the test runs in a mode where no response from the service are
+ required (message type REQUEST_NO_RETURN) thus the clients send at maximum
+ allowed frequency.
+
+Automatic start from build directory:
+
+ctest -V -R npdu_test_UDP
+ctest -V -R npdu_test_TCP
+
+A message will be shown when the external clients should be started.
+
+Manual start:
+# Service side
+./npdu_test_service_npdu_start.sh
+
+# Client side UDP mode
+./npdu_test_client_npdu_start.sh UDP
+
+# Client side TCP mode
+./npdu_test_client_npdu_start.sh TCP
diff --git a/test/restart_routing_tests/restart_routing_test_client.cpp b/test/restart_routing_tests/restart_routing_test_client.cpp
index a8c0acc..847594e 100644
--- a/test/restart_routing_tests/restart_routing_test_client.cpp
+++ b/test/restart_routing_tests/restart_routing_test_client.cpp
@@ -98,6 +98,7 @@ void routing_restart_test_client::on_message(const std::shared_ptr<vsomeip::mess
if (received_responses_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS) {
VSOMEIP_WARNING << std::hex << app_->get_client()
<< ": Received all messages ~> going down!";
+ all_responses_received_.set_value();
}
}
}
@@ -116,14 +117,18 @@ void routing_restart_test_client::run() {
request->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
request->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
- app_->send(request, true);
+ app_->send(request);
std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
- std::this_thread::sleep_for(std::chrono::milliseconds(250));
- EXPECT_EQ(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS,
- received_responses_);
+ if (std::future_status::ready == all_responses_received_.get_future().wait_for(std::chrono::milliseconds(10000))) {
+ EXPECT_EQ(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS,
+ received_responses_);
+ VSOMEIP_WARNING << "Received all answers";
+ } else {
+ ADD_FAILURE() << "Didn't receive all responses within time";
+ }
stop();
}
@@ -140,7 +145,7 @@ void routing_restart_test_client::shutdown_service() {
request->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
request->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
- app_->send(request,true);
+ app_->send(request);
}
TEST(someip_restart_routing_test, request_response_over_restart)
diff --git a/test/restart_routing_tests/restart_routing_test_client.hpp b/test/restart_routing_tests/restart_routing_test_client.hpp
index fdc56d4..cd4a12f 100644
--- a/test/restart_routing_tests/restart_routing_test_client.hpp
+++ b/test/restart_routing_tests/restart_routing_test_client.hpp
@@ -17,6 +17,7 @@
#include <mutex>
#include <condition_variable>
#include <atomic>
+#include <future>
class routing_restart_test_client {
public:
@@ -45,6 +46,7 @@ private:
std::thread sender_;
std::atomic<std::uint32_t> received_responses_;
+ std::promise<void> all_responses_received_;
};
#endif // RESTART_ROUTING_TEST_CLIENT_HPP
diff --git a/test/restart_routing_tests/restart_routing_test_client.json b/test/restart_routing_tests/restart_routing_test_client.json
index 0d901d8..93fafab 100644
--- a/test/restart_routing_tests/restart_routing_test_client.json
+++ b/test/restart_routing_tests/restart_routing_test_client.json
@@ -37,7 +37,7 @@
[
],
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"service-discovery" :
{
"enable" : "false",
diff --git a/test/restart_routing_tests/restart_routing_test_service.cpp b/test/restart_routing_tests/restart_routing_test_service.cpp
index cf4bba1..35ab01a 100644
--- a/test/restart_routing_tests/restart_routing_test_service.cpp
+++ b/test/restart_routing_tests/restart_routing_test_service.cpp
@@ -94,7 +94,7 @@ void routing_restart_test_service::on_message(const std::shared_ptr<vsomeip::mes
std::shared_ptr<vsomeip::message> its_response =
vsomeip::runtime::get()->create_response(_request);
- app_->send(its_response, true);
+ app_->send(its_response);
number_of_received_messages_++;
if(number_of_received_messages_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS) {
diff --git a/test/restart_routing_tests/restart_routing_test_service.json b/test/restart_routing_tests/restart_routing_test_service.json
index 8ff90cb..9a1d3bf 100644
--- a/test/restart_routing_tests/restart_routing_test_service.json
+++ b/test/restart_routing_tests/restart_routing_test_service.json
@@ -16,7 +16,7 @@
"applications" :
[
{
- "name" : "vsomeipd",
+ "name" : "routingmanagerd",
"id" : "0x0815"
},
{
@@ -33,7 +33,7 @@
}
],
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"service-discovery" :
{
"enable" : "false",
diff --git a/test/restart_routing_tests/restart_routing_test_starter.sh b/test/restart_routing_tests/restart_routing_test_starter.sh
index 0778e98..9d74c36 100755
--- a/test/restart_routing_tests/restart_routing_test_starter.sh
+++ b/test/restart_routing_tests/restart_routing_test_starter.sh
@@ -21,7 +21,7 @@ echo "----------------------------------------------"
export VSOMEIP_CONFIGURATION=restart_routing_test_autoconfig.json
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
DAEMON_PID=$!
sleep 2
@@ -53,15 +53,15 @@ CLIENT4_PID=$!
sleep 2
echo "----------------------------------------------"
-echo " let vsomeipd crash (kill -9) "
+echo " let routingmanagerd crash (kill -9) "
echo "----------------------------------------------"
kill -9 $DAEMON_PID
echo "----------------------------------------------"
-echo " restart vsomeipd "
+echo " restart routingmanagerd "
echo "----------------------------------------------"
sleep 2
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
DAEMON_PID=$!
wait $SERIVCE_PID || ((FAIL+=1))
@@ -156,7 +156,7 @@ echo "----------------------------------------------"
sleep 2
export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
DAEMON_PID=$!
# Start the service
@@ -191,16 +191,16 @@ CLIENT4_PID=$!
sleep 2
echo "----------------------------------------------"
-echo " let vsomeipd crash (kill -9) "
+echo " let routingmanagerd crash (kill -9) "
echo "----------------------------------------------"
kill -9 $DAEMON_PID
echo "----------------------------------------------"
-echo " restart vsomeipd "
+echo " restart routingmanagerd "
echo "----------------------------------------------"
sleep 2
export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
DAEMON_PID=$!
wait $SERIVCE_PID || ((FAIL+=1))
@@ -230,7 +230,7 @@ echo "----------------------------------------------"
sleep 2
export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
DAEMON_PID=$!
# Start the service
@@ -265,7 +265,7 @@ CLIENT4_PID=$!
sleep 2
echo "----------------------------------------------"
-echo " let vsomeipd crash (kill -9) "
+echo " let routingmanagerd crash (kill -9) "
echo "----------------------------------------------"
kill -9 $DAEMON_PID
sleep 1
@@ -274,12 +274,12 @@ echo " let service crash (kill -9) "
echo "----------------------------------------------"
kill -9 $SERIVCE_PID
echo "----------------------------------------------"
-echo " restart vsomeipd "
+echo " restart routingmanagerd "
echo "----------------------------------------------"
sleep 2
export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
DAEMON_PID=$!
echo "----------------------------------------------"
diff --git a/test/routing_tests/conf/local_routing_test_starter.sh.in b/test/routing_tests/conf/local_routing_test_starter.sh.in
index 457c60c..9e10480 100755
--- a/test/routing_tests/conf/local_routing_test_starter.sh.in
+++ b/test/routing_tests/conf/local_routing_test_starter.sh.in
@@ -35,7 +35,7 @@ check_tcp_udp_sockets_are_closed ()
export VSOMEIP_CONFIGURATION=local_routing_test_service.json
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
WAIT_PIDS=()
diff --git a/test/routing_tests/external_local_routing_test_service.cpp b/test/routing_tests/external_local_routing_test_service.cpp
index ce8b9ef..c357165 100644
--- a/test/routing_tests/external_local_routing_test_service.cpp
+++ b/test/routing_tests/external_local_routing_test_service.cpp
@@ -130,7 +130,7 @@ void external_local_routing_test_service::on_message(
std::shared_ptr<vsomeip::message> its_response =
vsomeip::runtime::get()->create_response(_request);
- app_->send(its_response, true);
+ app_->send(its_response);
if(number_received_messages_local_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND
&& number_received_messages_external_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND)
diff --git a/test/routing_tests/external_local_routing_test_starter.sh b/test/routing_tests/external_local_routing_test_starter.sh
index af94ab6..f8fa2df 100755
--- a/test/routing_tests/external_local_routing_test_starter.sh
+++ b/test/routing_tests/external_local_routing_test_starter.sh
@@ -78,10 +78,10 @@ if [ $CLIENT_STILL_THERE -ne 0 ]
then
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting external_local_routing_test_starter.sh 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/test; ./external_local_routing_test_client_external_start.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; ./external_local_routing_test_client_external_start.sh\"" &
echo "remote ssh job id: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name elrts --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./external_local_routing_test_client_external_start.sh" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./external_local_routing_test_client_external_start.sh" &
else
cat <<End-of-message
*******************************************************************************
@@ -111,11 +111,6 @@ do
wait $job || ((FAIL+=1))
done
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop elrts
- docker rm elrts
-fi
-
# Check if client and server both exited sucessfully and the service didnt't
# have any open
if [ $FAIL -eq 0 ]
diff --git a/test/routing_tests/local_routing_test_client.cpp b/test/routing_tests/local_routing_test_client.cpp
index 5bd83fe..26df99f 100644
--- a/test/routing_tests/local_routing_test_client.cpp
+++ b/test/routing_tests/local_routing_test_client.cpp
@@ -8,7 +8,6 @@
local_routing_test_client::local_routing_test_client(bool _use_tcp) :
app_(vsomeip::runtime::get()->create_application()),
request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- running_(true),
blocked_(false),
is_available_(false),
number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND),
@@ -130,7 +129,7 @@ void local_routing_test_client::run()
for (uint32_t i = 0; i < number_of_messages_to_send_; i++)
{
- app_->send(request_, true);
+ app_->send(request_);
VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0')
<< std::hex << request_->get_client() << "/" << std::setw(4)
<< std::setfill('0') << std::hex << request_->get_session()
diff --git a/test/routing_tests/local_routing_test_client.hpp b/test/routing_tests/local_routing_test_client.hpp
index b135dea..7cc442a 100644
--- a/test/routing_tests/local_routing_test_client.hpp
+++ b/test/routing_tests/local_routing_test_client.hpp
@@ -37,7 +37,6 @@ private:
std::shared_ptr<vsomeip::message> request_;
std::mutex mutex_;
std::condition_variable condition_;
- bool running_;
bool blocked_;
bool is_available_;
std::uint32_t number_of_messages_to_send_;
diff --git a/test/routing_tests/local_routing_test_client.json b/test/routing_tests/local_routing_test_client.json
index 2b4bdaa..e3521c8 100644
--- a/test/routing_tests/local_routing_test_client.json
+++ b/test/routing_tests/local_routing_test_client.json
@@ -27,7 +27,7 @@
[
],
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"service-discovery" :
{
"enable" : "false",
diff --git a/test/routing_tests/local_routing_test_service.cpp b/test/routing_tests/local_routing_test_service.cpp
index 4f7962d..81d47eb 100644
--- a/test/routing_tests/local_routing_test_service.cpp
+++ b/test/routing_tests/local_routing_test_service.cpp
@@ -114,7 +114,7 @@ void local_routing_test_service::on_message(const std::shared_ptr<vsomeip::messa
std::shared_ptr<vsomeip::message> its_response =
vsomeip::runtime::get()->create_response(_request);
- app_->send(its_response, true);
+ app_->send(its_response);
if(number_of_received_messages_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND)
{
diff --git a/test/routing_tests/local_routing_test_service.json b/test/routing_tests/local_routing_test_service.json
index f5da8c6..6b7e11d 100644
--- a/test/routing_tests/local_routing_test_service.json
+++ b/test/routing_tests/local_routing_test_service.json
@@ -30,7 +30,7 @@
}
],
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"service-discovery" :
{
"enable" : "false",
diff --git a/test/debug_diag_job_plugin_tests/conf/debug_diag_job_plugin_test_slave.json.in b/test/second_address_tests/conf/second_address_test_master_client.json.in
index e8e38cf..542480f 100644
--- a/test/debug_diag_job_plugin_tests/conf/debug_diag_job_plugin_test_slave.json.in
+++ b/test/second_address_tests/conf/second_address_test_master_client.json.in
@@ -1,5 +1,5 @@
{
- "unicast":"@TEST_IP_SLAVE@",
+ "unicast":"@TEST_IP_MASTER@",
"logging":
{
"level":"warning",
@@ -11,24 +11,21 @@
},
"dlt":"false"
},
- "applications":
+ "applications" :
[
{
- "name":"debug_diag_job_plugin_test_client",
- "id":"0x9090"
+ "name" : "second_address_test_client",
+ "id" : "0x1210",
+ "max_dispatch_time" : "1000"
}
],
- "routing":"vsomeipd",
+ "routing":"routingmanagerd",
"service-discovery":
{
"enable":"true",
- "multicast":"224.1.1.1",
+ "multicast":"224.0.50.1",
"port":"30490",
"protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
"cyclic_offer_delay" : "1000",
"ttl" : "3"
}
diff --git a/test/second_address_tests/conf/second_address_test_master_service_udp.json.in b/test/second_address_tests/conf/second_address_test_master_service_udp.json.in
new file mode 100644
index 0000000..1b45898
--- /dev/null
+++ b/test/second_address_tests/conf/second_address_test_master_service_udp.json.in
@@ -0,0 +1,40 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications" :
+ [
+ {
+ "name" : "second_address_test_service",
+ "id" : "0x3489",
+ "max_dispatch_time" : "1000"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30001"
+ }
+ ],
+ "routing":"routingmanagerd",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.50.1",
+ "port":"30490",
+ "protocol":"udp",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+} \ No newline at end of file
diff --git a/test/second_address_tests/conf/second_address_test_slave_client.json.in b/test/second_address_tests/conf/second_address_test_slave_client.json.in
new file mode 100644
index 0000000..303bfae
--- /dev/null
+++ b/test/second_address_tests/conf/second_address_test_slave_client.json.in
@@ -0,0 +1,32 @@
+{
+ "unicast":"@TEST_IP_SLAVE_SECOND@",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications" :
+ [
+ {
+ "name" : "second_address_test_client",
+ "id" : "0x1210",
+ "max_dispatch_time" : "1000"
+ }
+ ],
+ "routing":"routingmanagerd",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.50.1",
+ "port":"30490",
+ "protocol":"udp",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+} \ No newline at end of file
diff --git a/test/second_address_tests/conf/second_address_test_slave_service_udp.json.in b/test/second_address_tests/conf/second_address_test_slave_service_udp.json.in
new file mode 100644
index 0000000..9a7c062
--- /dev/null
+++ b/test/second_address_tests/conf/second_address_test_slave_service_udp.json.in
@@ -0,0 +1,40 @@
+{
+ "unicast":"@TEST_IP_SLAVE_SECOND@",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications" :
+ [
+ {
+ "name" : "second_address_test_service",
+ "id" : "0x3489",
+ "max_dispatch_time" : "1000"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30001"
+ }
+ ],
+ "routing":"routingmanagerd",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.50.1",
+ "port":"30490",
+ "protocol":"udp",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+} \ No newline at end of file
diff --git a/test/second_address_tests/conf/second_address_test_slave_starter.sh.in b/test/second_address_tests/conf/second_address_test_slave_starter.sh.in
new file mode 100755
index 0000000..85080aa
--- /dev/null
+++ b/test/second_address_tests/conf/second_address_test_slave_starter.sh.in
@@ -0,0 +1,60 @@
+#!/bin/bash
+# Copyright (C) 2015-2018 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
+
+if [ $# -lt 2 ]
+then
+ echo "Please pass a operation and communication mode to this script."
+ echo "For example: $0 CLIENT UDP"
+ echo "Valid operation modes include [SERVICE, CLIENT]"
+ echo "Valid communication modes include [UDP, TCP]"
+ exit 1
+fi
+
+OPERATIONMODE=$1
+COMMUNICATIONMODE=$2
+
+# Add second IP address to interface
+ip addr add @TEST_IP_SLAVE_SECOND@ dev eth0
+
+if [ "$OPERATIONMODE" = "CLIENT" ]; then
+ SLAVE_APPLICATION=second_address_test_client
+ export VSOMEIP_CONFIGURATION=second_address_test_slave_client.json
+
+elif [ "$OPERATIONMODE" = "SERVICE" ]; then
+ SLAVE_APPLICATION=second_address_test_service
+
+ if [ "$COMMUNICATIONMODE" = "TCP" ]; then
+ export VSOMEIP_CONFIGURATION=second_address_test_slave_service_tcp.json
+ elif [ "$COMMUNICATIONMODE" = "UDP" ]; then
+ export VSOMEIP_CONFIGURATION=second_address_test_slave_service_udp.json
+ fi
+fi
+
+../examples/routingmanagerd/./routingmanagerd &
+PID_VSOMEIPD=$!
+
+./$SLAVE_APPLICATION $COMMUNICATIONMODE &
+PID_SLAVE=$!
+
+# Wait until all slaves are finished
+for job in $PID_SLAVE
+do
+ # Fail gets incremented if a client exits with a non-zero exit code
+ echo "waiting for $job"
+ wait $job || FAIL=$(($FAIL+1))
+done
+
+# kill the services
+kill $PID_VSOMEIPD
+sleep 1
+
+# Delete second IP address
+ip addr del @TEST_IP_SLAVE_SECOND@ dev eth0
+
+# Check if everything went well
+exit $FAIL
diff --git a/test/second_address_tests/second_address_test_client.cpp b/test/second_address_tests/second_address_test_client.cpp
new file mode 100644
index 0000000..616346b
--- /dev/null
+++ b/test/second_address_tests/second_address_test_client.cpp
@@ -0,0 +1,353 @@
+// Copyright (C) 2014-2018 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 <chrono>
+#include <condition_variable>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <thread>
+#include <map>
+#include <algorithm>
+#include <atomic>
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+#include <vsomeip/internal/logger.hpp>
+
+#include "second_address_test_globals.hpp"
+
+class second_address_test_client {
+public:
+ second_address_test_client(struct second_address_test::service_info _service_info, bool _use_tcp) :
+ service_info_(_service_info),
+ use_tcp_(_use_tcp),
+ app_(vsomeip::runtime::get()->create_application("second_address_test_client")),
+ send_thread_(std::bind(&second_address_test_client::send, this)) {
+
+ if (!app_->init()) {
+ ADD_FAILURE() << "Couldn't initialize application";
+ return;
+ }
+
+ app_->register_state_handler(
+ std::bind(&second_address_test_client::on_state, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.request_method_id,
+ std::bind(&second_address_test_client::on_message, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.event_id,
+ std::bind(&second_address_test_client::on_notification, this,
+ std::placeholders::_1, false));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.selective_event_id,
+ std::bind(&second_address_test_client::on_notification, this,
+ std::placeholders::_1, true));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.shutdown_method_id,
+ std::bind(&second_address_test_client::on_shutdown_method_called, this,
+ std::placeholders::_1));
+
+ // register availability for all other services and request their event.
+ app_->register_availability_handler(service_info_.service_id,
+ service_info_.instance_id,
+ std::bind(&second_address_test_client::on_availability, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3));
+
+ app_->request_service(service_info_.service_id,
+ service_info_.instance_id);
+
+ app_->register_subscription_status_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.eventgroup_id,
+ service_info_.event_id,
+ std::bind(&second_address_test_client::on_subscription_status_changed, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, std::placeholders::_4,
+ std::placeholders::_5, false));
+
+ app_->register_subscription_status_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.selective_eventgroup_id,
+ service_info_.selective_event_id,
+ std::bind(&second_address_test_client::on_subscription_status_changed, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, std::placeholders::_4,
+ std::placeholders::_5, true));
+
+ app_->start();
+ }
+
+ ~second_address_test_client() {
+ send_thread_.join();
+ }
+
+ void subscribe() {
+ std::set<vsomeip::eventgroup_t> its_eventgroups;
+ its_eventgroups.insert(service_info_.eventgroup_id);
+
+ app_->request_event(service_info_.service_id,
+ service_info_.instance_id, service_info_.event_id,
+ its_eventgroups, vsomeip::event_type_e::ET_EVENT);
+
+ its_eventgroups.clear();
+ its_eventgroups.insert(service_info_.selective_eventgroup_id);
+
+ app_->request_event(service_info_.service_id,
+ service_info_.instance_id, service_info_.selective_event_id,
+ its_eventgroups, vsomeip::event_type_e::ET_SELECTIVE_EVENT);
+
+ app_->subscribe(service_info_.service_id, service_info_.instance_id,
+ service_info_.eventgroup_id);
+
+ app_->subscribe(service_info_.service_id, service_info_.instance_id,
+ service_info_.selective_eventgroup_id);
+ }
+
+ void on_state(vsomeip::state_type_e _state) {
+ VSOMEIP_DEBUG << "Application " << app_->get_name() << " is "
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ?
+ "registered" : "deregistered") << " on client.";
+
+ if (_state == vsomeip::state_type_e::ST_REGISTERED) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_registered_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance,
+ bool _is_available) {
+
+ VSOMEIP_DEBUG << "Service [" << std::setw(4)
+ << std::setfill('0') << std::hex << _service << "." << _instance
+ << "] is " << (_is_available ? "available":"not available") << " on client.";
+
+ if (_is_available) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_service_available_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_message(const std::shared_ptr<vsomeip::message> &_message) {
+ EXPECT_EQ(service_info_.service_id, _message->get_service());
+ EXPECT_EQ(service_info_.instance_id, _message->get_instance());
+ EXPECT_EQ(service_info_.request_method_id, _message->get_method());
+
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ auto its_payload = _message->get_payload();
+ std::uint32_t data = static_cast<std::uint32_t>(its_payload->get_data()[0]);
+
+ EXPECT_EQ(reply_received_, data);
+
+ wait_until_reply_received_ = false;
+ reply_received_++;
+ condition_.notify_one();
+ }
+
+ void on_notification(const std::shared_ptr<vsomeip::message> &_message,
+ bool _selective) {
+ EXPECT_EQ(service_info_.service_id, _message->get_service());
+ EXPECT_EQ(service_info_.instance_id, _message->get_instance());
+
+ static vsomeip::length_t length_last_received_msg(0);
+ EXPECT_GT(_message->get_payload()->get_length(), length_last_received_msg);
+ length_last_received_msg = _message->get_payload()->get_length();
+
+ if (_selective) {
+ EXPECT_EQ(service_info_.selective_event_id, _message->get_method());
+
+ if (++number_selective_events_received_ == second_address_test::number_of_events_to_send) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_selective_events_received_ = false;
+ condition_.notify_one();
+ }
+ } else {
+ EXPECT_EQ(service_info_.event_id, _message->get_method());
+
+ if (++number_events_received_ == second_address_test::number_of_events_to_send) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_events_received_ = false;
+ condition_.notify_one();
+ }
+ }
+ }
+
+ void on_subscription_status_changed(const vsomeip::service_t _service,
+ const vsomeip::instance_t _instance,
+ const vsomeip::eventgroup_t _eventgroup,
+ const vsomeip::event_t _event,
+ const uint16_t error_code,
+ bool _selective) {
+
+ VSOMEIP_DEBUG << "Subscription status changed on client";
+
+ EXPECT_EQ(service_info_.service_id, _service);
+ EXPECT_EQ(service_info_.instance_id, _instance);
+ EXPECT_TRUE((error_code == 0x0u || error_code == 0x7u));
+
+ if (_selective) {
+ EXPECT_EQ(service_info_.selective_eventgroup_id, _eventgroup);
+ EXPECT_EQ(service_info_.selective_event_id, _event);
+
+ if (error_code == 0x0u) { // accepted
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_selective_subscription_accepted_ = false;
+ condition_.notify_one();
+ }
+
+ } else {
+ EXPECT_EQ(service_info_.eventgroup_id, _eventgroup);
+ EXPECT_EQ(service_info_.event_id, _event);
+
+ if (error_code == 0x0u) { // accepted
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_subscription_accepted_ = false;
+ condition_.notify_one();
+ }
+ }
+ }
+
+ void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
+ EXPECT_EQ(service_info_.service_id, _message->get_service());
+ EXPECT_EQ(service_info_.instance_id, _message->get_instance());
+ EXPECT_EQ(service_info_.shutdown_method_id, _message->get_method());
+
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_shutdown_reply_received_ = false;
+ condition_.notify_one();
+ }
+
+ void send() {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (wait_until_registered_) {
+ condition_.wait(its_lock);
+ }
+
+ while (wait_until_service_available_) {
+ condition_.wait(its_lock);
+ }
+
+ auto its_message = vsomeip::runtime::get()->create_request(use_tcp_);
+ its_message->set_service(service_info_.service_id);
+ its_message->set_instance(service_info_.instance_id);
+ its_message->set_method(service_info_.request_method_id);
+ its_message->set_message_type(vsomeip::message_type_e::MT_REQUEST);
+
+ auto its_payload = vsomeip::runtime::get()->create_payload();
+
+ VSOMEIP_DEBUG << "Client sending request messages";
+
+ for (std::uint32_t index = 0; index < second_address_test::number_of_messages_to_send; index++) {
+ vsomeip::byte_t *msg_payload = reinterpret_cast<vsomeip::byte_t *>(&index);
+ its_payload->set_data(msg_payload, sizeof(index));
+ its_message->set_payload(its_payload);
+ app_->send(its_message);
+
+ wait_until_reply_received_ = true;
+ message_sent_++;
+
+ while (wait_until_reply_received_) {
+ condition_.wait(its_lock);
+ }
+ }
+
+ VSOMEIP_DEBUG << "Client subscribing events";
+
+ subscribe();
+ while (wait_until_subscription_accepted_ || wait_until_selective_subscription_accepted_) {
+ condition_.wait(its_lock);
+ }
+
+ VSOMEIP_DEBUG << "Client requesting event notification";
+
+ its_message->set_method(service_info_.notify_method_id);
+ its_message->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
+ its_payload->set_data(&second_address_test::number_of_events_to_send, 1);
+ its_message->set_payload(its_payload);
+ app_->send(its_message);
+
+ VSOMEIP_DEBUG << "Client waiting event notification";
+
+ while (wait_until_events_received_ || wait_until_selective_events_received_) {
+ condition_.wait(its_lock);
+ }
+
+ VSOMEIP_DEBUG << "Client shutting down the service";
+
+ // shutdown service
+ its_message->set_method(service_info_.shutdown_method_id);
+ its_message->set_message_type(vsomeip::message_type_e::MT_REQUEST);
+ app_->send(its_message);
+
+ while (wait_until_shutdown_reply_received_) {
+ if (std::cv_status::timeout == condition_.wait_for(its_lock, std::chrono::seconds(30))) {
+ VSOMEIP_ERROR << "Shutdown request wasn't answered in time!";
+ break;
+ }
+ }
+
+ VSOMEIP_INFO << "Client going down";
+ app_->clear_all_handler();
+ app_->stop();
+ }
+
+
+private:
+ struct second_address_test::service_info service_info_;
+ bool use_tcp_;
+ std::shared_ptr<vsomeip::application> app_;
+
+ bool wait_until_registered_ = true;
+ bool wait_until_service_available_ = true;
+ bool wait_until_subscription_accepted_ = true;
+ bool wait_until_selective_subscription_accepted_ = true;
+ bool wait_until_shutdown_reply_received_ = true;
+ bool wait_until_reply_received_ = true;
+ bool wait_until_events_received_ = true;
+ bool wait_until_selective_events_received_ = true;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+
+ std::thread send_thread_;
+ std::uint32_t message_sent_ = 0;
+ std::uint32_t reply_received_ = 0;
+ std::uint32_t number_events_received_ = 0;
+ std::uint32_t number_selective_events_received_ = 0;
+};
+
+static bool use_tcp = false;
+
+TEST(someip_event_test, communicate_using_second_address)
+{
+ second_address_test_client its_sample(second_address_test::service, use_tcp);
+}
+
+#ifndef _WIN32
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ if (argc < 2) {
+ std::cerr << "Please specify a communication mode, like: " << argv[0] << " TCP" << std::endl;
+ std::cerr << "Valid communication modes are UDP or TCP" << std::endl;
+ return 1;
+ }
+
+ if (std::string("TCP")== std::string(argv[1])) {
+ use_tcp = true;
+ } else if (std::string("UDP")== std::string(argv[1])) {
+ use_tcp = false;
+ }
+
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/second_address_tests/second_address_test_globals.hpp b/test/second_address_tests/second_address_test_globals.hpp
new file mode 100644
index 0000000..1909fcd
--- /dev/null
+++ b/test/second_address_tests/second_address_test_globals.hpp
@@ -0,0 +1,29 @@
+// Copyright (C) 2014-2019 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 SECOND_ADDRESS_TEST_GLOBALS_HPP_
+#define SECOND_ADDRESS_TEST_GLOBALS_HPP_
+
+namespace second_address_test {
+
+struct service_info {
+ vsomeip::service_t service_id;
+ vsomeip::instance_t instance_id;
+ vsomeip::eventgroup_t eventgroup_id;
+ vsomeip::event_t event_id;
+ vsomeip::eventgroup_t selective_eventgroup_id;
+ vsomeip::event_t selective_event_id;
+ vsomeip::method_t request_method_id;
+ vsomeip::method_t notify_method_id;
+ vsomeip::method_t shutdown_method_id;
+};
+
+struct service_info service = { 0x3333, 0x1, 0x1, 0x3301, 0x2, 0x3302, 0x1111, 0x2222, 0x1404 };
+
+static constexpr std::uint32_t number_of_messages_to_send = 150;
+static constexpr std::uint8_t number_of_events_to_send = 150;
+}
+
+#endif /* SECOND_ADDRESS_TEST_GLOBALS_HPP_ */
diff --git a/test/second_address_tests/second_address_test_master_starter.sh b/test/second_address_tests/second_address_test_master_starter.sh
new file mode 100755
index 0000000..a7bcc0a
--- /dev/null
+++ b/test/second_address_tests/second_address_test_master_starter.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Copyright (C) 2015-2019 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
+
+if [ $# -lt 2 ]
+then
+ echo "Please pass a operation and communication mode to this script."
+ echo "For example: $0 SERVICE UDP"
+ echo "Valid operation modes include [SERVICE, CLIENT]"
+ echo "Valid communication modes include [UDP, TCP]"
+ exit 1
+fi
+
+OPERATIONMODE=$1
+COMMUNICATIONMODE=$2
+
+if [ "$OPERATIONMODE" = "SERVICE" ]; then
+ MASTER_APPLICATION=second_address_test_service
+ SLAVE_OPERATIONMODE="CLIENT"
+
+ if [ "$COMMUNICATIONMODE" = "TCP" ]; then
+ export VSOMEIP_CONFIGURATION=second_address_test_master_service_tcp.json
+ elif [ "$COMMUNICATIONMODE" = "UDP" ]; then
+ export VSOMEIP_CONFIGURATION=second_address_test_master_service_udp.json
+ fi
+
+elif [ "$OPERATIONMODE" = "CLIENT" ]; then
+ MASTER_APPLICATION=second_address_test_client
+ SLAVE_OPERATIONMODE="SERVICE"
+ export VSOMEIP_CONFIGURATION=second_address_test_master_client.json
+fi
+
+../examples/routingmanagerd/./routingmanagerd &
+PID_VSOMEIPD=$!
+
+./$MASTER_APPLICATION $COMMUNICATIONMODE &
+PID_MASTER=$!
+
+sleep 1
+
+if [ ! -z "$USE_LXC_TEST" ]; then
+ echo "starting offer test on slave LXC second_address_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; ./second_address_test_slave_starter.sh $SLAVE_OPERATIONMODE $COMMUNICATIONMODE\"" &
+elif [ ! -z "$USE_DOCKER" ]; then
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS; sleep 10; ./second_address_test_slave_starter.sh $SLAVE_OPERATIONMODE $COMMUNICATIONMODE" &
+else
+cat <<End-of-message
+*******************************************************************************
+*******************************************************************************
+** Please now run:
+** second_address_test_slave_starter.sh $COMMUNICATIONMODE
+** from an external host to successfully complete this test.
+**
+** You probably will need to adapt the 'unicast' settings in
+** second_address_test_slave_{udp,tcp}.json to your personal setup.
+*******************************************************************************
+*******************************************************************************
+End-of-message
+fi
+
+# Wait until all slaves are finished
+for job in $PID_MASTER
+do
+ # Fail gets incremented if a client exits with a non-zero exit code
+ echo "waiting for $job"
+ wait $job || FAIL=$(($FAIL+1))
+done
+
+kill $PID_VSOMEIPD
+sleep 1
+
+# Check if everything went well
+exit $FAIL
diff --git a/test/second_address_tests/second_address_test_service.cpp b/test/second_address_tests/second_address_test_service.cpp
new file mode 100644
index 0000000..374db0a
--- /dev/null
+++ b/test/second_address_tests/second_address_test_service.cpp
@@ -0,0 +1,252 @@
+// Copyright (C) 2014-2019 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 <chrono>
+#include <condition_variable>
+#include <iostream>
+#include <sstream>
+#include <thread>
+#include <map>
+
+#include <gtest/gtest.h>
+#include <vsomeip/vsomeip.hpp>
+#include <vsomeip/internal/logger.hpp>
+
+#include "second_address_test_globals.hpp"
+
+class second_address_test_service {
+public:
+ second_address_test_service(struct second_address_test::service_info _service_info) :
+ service_info_(_service_info),
+ app_(vsomeip::runtime::get()->create_application("second_address_test_service")),
+ offer_thread_(std::bind(&second_address_test_service::run, this)) {
+
+ if (!app_->init()) {
+ ADD_FAILURE() << "Couldn't initialize application";
+ return;
+ }
+
+ app_->register_state_handler(
+ std::bind(&second_address_test_service::on_state, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.request_method_id,
+ std::bind(&second_address_test_service::on_message, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.notify_method_id,
+ std::bind(&second_address_test_service::on_notify, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.shutdown_method_id,
+ std::bind(&second_address_test_service::on_shutdown_method_called, this,
+ std::placeholders::_1));
+
+ app_->register_subscription_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.eventgroup_id,
+ std::bind(&second_address_test_service::subscription_handler,
+ this, std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, std::placeholders::_4));
+
+ app_->register_subscription_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.selective_eventgroup_id,
+ std::bind(&second_address_test_service::selective_subscription_handler,
+ this, std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, std::placeholders::_4));
+
+ app_->start();
+ }
+
+ ~second_address_test_service() {
+ offer_thread_.join();
+ }
+
+ void stop() {
+ app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
+ app_->clear_all_handler();
+ app_->stop();
+ }
+
+private:
+ void on_state(vsomeip::state_type_e _state) {
+ VSOMEIP_INFO << "Application " << app_->get_name() << " is "
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ?
+ "registered" : "deregistered") << " on service.";
+
+ if (_state == vsomeip::state_type_e::ST_REGISTERED) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_registered_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
+ app_->send(vsomeip::runtime::get()->create_response(_message));
+
+ VSOMEIP_WARNING << "************************************************************";
+ VSOMEIP_WARNING << "Shutdown method called on service -> going down!";
+ VSOMEIP_WARNING << "************************************************************";
+
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_shutdown_method_called_ = false;
+ condition_.notify_one();
+ }
+
+ void on_message(const std::shared_ptr<vsomeip::message> &_message) {
+ EXPECT_EQ(service_info_.service_id, _message->get_service());
+ EXPECT_EQ(service_info_.request_method_id, _message->get_method());
+ EXPECT_EQ(service_info_.instance_id, _message->get_instance());
+
+ std::shared_ptr<vsomeip::message> response = vsomeip::runtime::get()->create_response(_message);
+ response->set_payload(_message->get_payload());
+ app_->send(response);
+
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ messages_received_++;
+
+ if (messages_received_ == second_address_test::number_of_messages_to_send) {
+ wait_until_receive_messages_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_notify(const std::shared_ptr<vsomeip::message> &_message) {
+ EXPECT_EQ(service_info_.service_id, _message->get_service());
+ EXPECT_EQ(service_info_.notify_method_id, _message->get_method());
+ EXPECT_EQ(service_info_.instance_id, _message->get_instance());
+
+ auto its_payload = _message->get_payload();
+ notifications_to_send_ = its_payload->get_data()[0];
+
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_notify_method_called_ = false;
+ condition_.notify_one();
+ }
+
+ void offer() {
+ app_->offer_service(service_info_.service_id, service_info_.instance_id);
+
+ std::set<vsomeip::eventgroup_t> its_eventgroups;
+ its_eventgroups.insert(service_info_.eventgroup_id);
+
+ app_->offer_event(service_info_.service_id, service_info_.instance_id,
+ service_info_.event_id, its_eventgroups,
+ vsomeip::event_type_e::ET_EVENT, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
+
+ its_eventgroups.clear();
+ its_eventgroups.insert(service_info_.selective_eventgroup_id);
+
+ app_->offer_event(service_info_.service_id, service_info_.instance_id,
+ service_info_.selective_event_id, its_eventgroups,
+ vsomeip::event_type_e::ET_SELECTIVE_EVENT, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
+ }
+
+ void notify() {
+ EXPECT_TRUE(client_subscribed_);
+ EXPECT_TRUE(client_subscribed_selective_);
+ auto its_payload = vsomeip::runtime::get()->create_payload();
+
+ std::uint32_t i = 0;
+
+ for (; i < notifications_to_send_; i++) {
+ its_payload->set_data(std::vector<vsomeip::byte_t>(i+1, 0x55));
+ app_->notify(service_info_.service_id, service_info_.instance_id,
+ service_info_.event_id, its_payload);
+ }
+
+ for (; i < 2 * notifications_to_send_; i++) {
+ its_payload->set_data(std::vector<vsomeip::byte_t>(i+1, 0x55));
+ app_->notify_one(service_info_.service_id, service_info_.instance_id,
+ service_info_.selective_event_id, its_payload, client_id_);
+ }
+ }
+
+ void run() {
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Running";
+
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (wait_until_registered_) {
+ condition_.wait(its_lock);
+ }
+
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Offering";
+ offer();
+
+ while (wait_until_receive_messages_) {
+ condition_.wait(its_lock);
+ }
+
+ VSOMEIP_DEBUG << "Service waiting for notify method has been called";
+ while (wait_until_notify_method_called_) {
+ condition_.wait(its_lock);
+ }
+
+ VSOMEIP_DEBUG << "Service notifying events";
+ notify();
+
+ while (wait_until_shutdown_method_called_) {
+ condition_.wait(its_lock);
+ }
+
+ its_lock.unlock();
+ stop();
+ }
+
+ bool subscription_handler(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid, bool _subscribed) {
+ (void)_uid;
+ (void)_gid;
+ VSOMEIP_DEBUG << __func__ << ": client 0x" << std::hex << std::setw(4) << std::setfill('0') << _client
+ << ((_subscribed) ? " subscribed" : "unsubscribed") << " on service.";
+ client_subscribed_ = _subscribed;
+ return true;
+ }
+
+ bool selective_subscription_handler(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid, bool _subscribed) {
+ (void)_uid;
+ (void)_gid;
+ VSOMEIP_DEBUG << __func__ << ": client 0x" << std::hex << std::setw(4) << std::setfill('0') << _client
+ << ((_subscribed) ? " subscribed" : "unsubscribed") << " on service.";
+ client_subscribed_selective_ = _subscribed;
+ client_id_ = _client;
+ return true;
+ }
+
+private:
+ struct second_address_test::service_info service_info_;
+ std::shared_ptr<vsomeip::application> app_;
+
+ bool wait_until_registered_ = true;
+ bool wait_until_receive_messages_ = true;
+ bool wait_until_notify_method_called_ = true;
+ bool wait_until_shutdown_method_called_ = true;
+ bool client_subscribed_ = false;
+ bool client_subscribed_selective_ = false;
+ vsomeip::client_t client_id_ = 0;
+ std::uint32_t messages_received_ = 0;
+ std::uint8_t notifications_to_send_ = 0;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ std::thread offer_thread_;
+};
+
+TEST(someip_second_address_test, test_communication_with_client)
+{
+ second_address_test_service its_sample(second_address_test::service);
+}
+
+#ifndef _WIN32
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/security_config_plugin_tests/conf/security_config_plugin_test_local.json.in b/test/security_config_plugin_tests/conf/security_config_plugin_test_local.json.in
deleted file mode 100644
index a1497dc..0000000
--- a/test/security_config_plugin_tests/conf/security_config_plugin_test_local.json.in
+++ /dev/null
@@ -1,128 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "diagnosis" : "0x63",
- "applications":
- [
- {
- "name":"vsomeipd",
- "id" : "0x6310",
- "plugins" :
- [
- {
- "application_plugin" : "vsomeip-security-config-plugin-mgu"
- }
- ]
- }
- ],
- "security": {
- "policies": [
- {
- "credentials": {
- "deny": [
- {
- "uid": [{"first" : "@TEST_UID@", "last" : "@TEST_UID@"}],
- "gid": [{"first" : "@TEST_GID@", "last" : "@TEST_GID@"}]
- }
- ]
- },
- "deny": {}
- },
- {
- "credentials": {
- "allow": [
- {
- "uid": ["@TEST_UID@"],
- "gid": ["@TEST_GID@"]
- }
- ]
- },
- "allow" :
- {
- "offers":
- [
- {
- "service" : "0xF90F",
- "instance" : "0x01"
- },
- {
- "service" : "0x0101",
- "instance" : "0x63"
- },
- {
- "service" : "0x0103",
- "instance" : "0x63"
- }
- ],
- "requests":
- [
- {
- "service" : "0xF90F",
- "instances" :
- [
- {
- "ids" : ["0x01"],
- "methods" : [ "0x01", "0x02" ]
- }
- ]
- },
- {
- "service" : "0x0103",
- "instances" :
- [
- {
- "ids" : ["0x63"],
- "methods" : [ "0x03", "0x7777" ]
- }
- ]
- },
- {
- "service" : "0x0101",
- "instances" :
- [
- {
- "ids" : ["0x63"],
- "methods" : [ "0x88" ]
- }
- ]
- }
- ]
- }
- }
- ],
- "check_credentials" : "true"
- },
- "security-update-whitelist" :
- {
- "uids" :
- [
- "@TEST_UID@"
- ],
- "services" :
- [
- {"first" : "0x101", "last" : "0x103"},
- "0xf90f"
- ],
- "check-whitelist" : "true"
- },
- "routing":"vsomeipd",
- "routing-credentials" :
- {
- "uid" : "@TEST_UID@",
- "gid" : "@TEST_GID@"
- },
- "service-discovery":
- {
- "enable":"false"
- }
-}
diff --git a/test/security_config_plugin_tests/security_config_plugin_test_client.cpp b/test/security_config_plugin_tests/security_config_plugin_test_client.cpp
deleted file mode 100755
index 9438738..0000000
--- a/test/security_config_plugin_tests/security_config_plugin_test_client.cpp
+++ /dev/null
@@ -1,1045 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <cstring>
-
-#include <gtest/gtest.h>
-
-#ifndef _WIN32
-#include <signal.h>
-#endif
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/utility/include/utility.hpp"
-#include "../../implementation/logging/include/logger.hpp"
-#include "../../implementation/configuration/include/policy.hpp"
-
-#include "../security_config_plugin_tests/security_config_plugin_test_globals.hpp"
-class security_config_plugin_test_client;
-static security_config_plugin_test_client* the_client;
-extern "C" void signal_handler(int _signum);
-
-#define GET_LONG_BYTE0(x) ((x) & 0xFF)
-#define GET_LONG_BYTE1(x) (((x) >> 8) & 0xFF)
-#define GET_LONG_BYTE2(x) (((x) >> 16) & 0xFF)
-#define GET_LONG_BYTE3(x) (((x) >> 24) & 0xFF)
-
-class security_config_plugin_test_client {
-public:
- security_config_plugin_test_client(bool _update_only, bool _remove_only, bool _subscribe_only) :
- update_only_(_update_only),
- remove_only_(_remove_only),
- subscribe_only_(_subscribe_only),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- wait_until_security_config_service_available_(true),
- wait_until_control_service_available_(true),
- wait_until_updated_service_101_available_(true),
- wait_until_updated_service_102_available_(true),
- wait_until_method_1_responses_received_(true),
- wait_until_method_2_responses_received_(true),
- number_of_received_responses_method_1(0),
- number_of_received_responses_method_2(0),
- number_of_received_events_1(0),
- number_of_received_events_2(0),
- number_of_received_events_4(0),
- wait_until_notifications_1_received_(true),
- wait_until_notifications_2_received_(true),
- wait_for_stop_(true),
- update_ok_(false),
- removal_ok_(false),
- stop_thread_(std::bind(&security_config_plugin_test_client::wait_for_stop, this)),
- run_thread_(std::bind(&security_config_plugin_test_client::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
-
- // register signal handler
- the_client = this;
- struct sigaction sa_new, sa_old;
- sa_new.sa_handler = signal_handler;
- sa_new.sa_flags = 0;
- sigemptyset(&sa_new.sa_mask);
- ::sigaction(SIGUSR1, &sa_new, &sa_old);
- ::sigaction(SIGINT, &sa_new, &sa_old);
- ::sigaction(SIGTERM, &sa_new, &sa_old);
- ::sigaction(SIGABRT, &sa_new, &sa_old);
-
- app_->register_state_handler(
- std::bind(&security_config_plugin_test_client::on_state, this,
- std::placeholders::_1));
-
- // handle plugin messages
- app_->register_message_handler(security_config_plugin_test::security_config_plugin_serviceinfo.service_id,
- security_config_plugin_test::security_config_plugin_serviceinfo.instance_id,
- vsomeip::ANY_METHOD,
- std::bind(&security_config_plugin_test_client::on_plugin_message, this,
- std::placeholders::_1));
-
- // handle service 0x0101 messages
- app_->register_message_handler(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- vsomeip::ANY_METHOD,
- std::bind(&security_config_plugin_test_client::on_service_1_message, this,
- std::placeholders::_1));
-
- // handle service 0x0102 messages
- app_->register_message_handler(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- vsomeip::ANY_METHOD,
- std::bind(&security_config_plugin_test_client::on_service_2_message, this,
- std::placeholders::_1));
-
- // request acl plugin interface service
- app_->register_availability_handler(
- security_config_plugin_test::security_config_plugin_serviceinfo.service_id,
- security_config_plugin_test::security_config_plugin_serviceinfo.instance_id,
- std::bind(&security_config_plugin_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3),
- security_config_plugin_test::security_config_plugin_major_version_);
- app_->request_service(
- security_config_plugin_test::security_config_plugin_serviceinfo.service_id,
- security_config_plugin_test::security_config_plugin_serviceinfo.instance_id,
- security_config_plugin_test::security_config_plugin_major_version_, vsomeip::ANY_MINOR);
-
- // request control service which is globally allowed
- app_->register_availability_handler(
- security_config_plugin_test::security_config_test_serviceinfo_3.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_3.instance_id,
- std::bind(&security_config_plugin_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(
- security_config_plugin_test::security_config_test_serviceinfo_3.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_3.instance_id,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR);
-
- // request service 0x0101 which is globally blacklisted and shall get available after aclUpdate
- app_->register_availability_handler(
- security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- std::bind(&security_config_plugin_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(
- security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR);
-
-
- // request service 0x0102 which is globally blacklisted and shall get available after aclUpdate
- app_->register_availability_handler(
- security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- std::bind(&security_config_plugin_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(
- security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR);
-
- // offer service 0x0100 which is not allowed to be offered at any time
- // (log message "Skip offer!" should be printed by daemon)
- app_->offer_service(0x666, security_config_plugin_test::security_config_test_serviceinfo_1.instance_id);
-
- app_->start();
- }
-
- ~security_config_plugin_test_client() {
- run_thread_.join();
- stop_thread_.join();
-
- }
-
- void on_state(vsomeip::state_type_e _state) {
- VSOMEIP_INFO << "Application " << app_->get_name() << " is "
- << (_state == vsomeip::state_type_e::ST_REGISTERED ?
- "registered." : "deregistered.");
-
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- if(_is_available) {
- // check plugin interface availability
- if (_service == security_config_plugin_test::security_config_plugin_serviceinfo.service_id &&
- _instance == security_config_plugin_test::security_config_plugin_serviceinfo.instance_id) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_security_config_service_available_ = false;
- condition_.notify_one();
- }
-
- // check control service availability
- if (_service == security_config_plugin_test::security_config_test_serviceinfo_3.service_id &&
- _instance == security_config_plugin_test::security_config_test_serviceinfo_3.instance_id) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_control_service_available_ = false;
- condition_.notify_one();
- }
-
- // check updated policy makes service 0x0101 available
- if (_service == security_config_plugin_test::security_config_test_serviceinfo_1.service_id &&
- _instance == security_config_plugin_test::security_config_test_serviceinfo_1.instance_id) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_updated_service_101_available_ = false;
- condition_.notify_one();
- }
-
- // check updated policy makes service 0x0102 available
- if (_service == security_config_plugin_test::security_config_test_serviceinfo_2.service_id &&
- _instance == security_config_plugin_test::security_config_test_serviceinfo_2.instance_id) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_updated_service_102_available_ = false;
- condition_.notify_one();
- }
- } else {
-
- }
- }
-
- void on_service_1_message(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
-
- number_of_received_events_1++;
-
- // event which should never be received
- if (_message->get_method() == 0x8004)
- number_of_received_events_4++;
-
- other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())]++;
- VSOMEIP_INFO
- << "on_service_1_message Received a notification with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] (now have: "
- << std::dec << other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())] << ")";
-
- std::shared_ptr<vsomeip::payload> its_payload(_message->get_payload());
- EXPECT_EQ(2u, its_payload->get_length());
- EXPECT_EQ((_message->get_service() & 0xFF00 ) >> 8, its_payload->get_data()[0]);
- EXPECT_EQ((_message->get_service() & 0xFF), its_payload->get_data()[1]);
- bool notify = all_notifications_received();
-
- if(notify) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_notifications_1_received_ = false;
- condition_.notify_one();
- }
- } else if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- if(_message->get_method() == security_config_plugin_test::security_config_test_serviceinfo_1.method_id) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- number_of_received_responses_method_1++;
- wait_until_method_1_responses_received_ = false;
- condition_.notify_one();
- }
- }
- }
-
- void on_service_2_message(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
-
- number_of_received_events_2++;
- other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())]++;
- VSOMEIP_INFO
- << "on_service_2_message Received a notification with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] (now have: "
- << std::dec << other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())] << ")";
-
- std::shared_ptr<vsomeip::payload> its_payload(_message->get_payload());
- EXPECT_EQ(2u, its_payload->get_length());
- EXPECT_EQ((_message->get_service() & 0xFF00 ) >> 8, its_payload->get_data()[0]);
- EXPECT_EQ((_message->get_service() & 0xFF), its_payload->get_data()[1]);
- bool notify = all_notifications_received();
-
- if(notify) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_notifications_2_received_ = false;
- condition_.notify_one();
- }
- } else if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- if(_message->get_method() == security_config_plugin_test::security_config_test_serviceinfo_2.method_id) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- number_of_received_responses_method_2++;
- wait_until_method_2_responses_received_ = false;
- condition_.notify_one();
- }
- }
- }
-
- void on_plugin_message(const std::shared_ptr<vsomeip::message> &_message) {
- if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- VSOMEIP_INFO
- << "Received a response with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method();
-
- std::shared_ptr<vsomeip::payload> pl = _message->get_payload();
- EXPECT_EQ( vsomeip::return_code_e::E_OK, _message->get_return_code());
-
- uint32_t length = pl->get_length();
- EXPECT_EQ(length, (uint32_t) 0x01);
-
- // expect status_success_ returned by plugin interface
- bool success(false);
- uint8_t* dataptr = pl->get_data();
- for(uint32_t i = 0; i< pl->get_length(); i++) {
- std::cout << "payload data: " << std::hex << (uint32_t) dataptr[i] << std::endl;
- EXPECT_EQ(dataptr[i], 0);
- if (dataptr[i] == 0x00) {
- success = true;
- }
- }
- if (success) {
- // updateAcl answer
- if (_message->get_service() == security_config_plugin_test::security_config_plugin_serviceinfo.service_id
- &&_message->get_method() == security_config_plugin_test::security_config_plugin_serviceinfo.method_id) {
- update_ok_ = true;
- }
-
- // removeAcl answer
- if (_message->get_service() == security_config_plugin_test::security_config_plugin_serviceinfo.service_id
- &&_message->get_method() == security_config_plugin_test::security_config_plugin_serviceinfo_reset.method_id) {
- removal_ok_ = true;
- }
- }
- }
- }
-
- bool all_notifications_received() {
- return std::all_of(
- other_services_received_notification_.cbegin(),
- other_services_received_notification_.cend(),
- [&](const std::map<std::pair<vsomeip::service_t,
- vsomeip::method_t>, std::uint32_t>::value_type& v)
- {
- if (v.second == security_config_plugin_test::notifications_to_send) {
- return true;
- } else {
- if (v.second >= security_config_plugin_test::notifications_to_send) {
- VSOMEIP_WARNING
- << " Received multiple initial events from service/instance: "
- << std::setw(4) << std::setfill('0') << std::hex << v.first.first
- << "."
- << std::setw(4) << std::setfill('0') << std::hex << v.first.second
- << " number of received events: " << v.second
- << ". This is caused by StopSubscribe/Subscribe messages and/or"
- << " service offered via UDP and TCP";
- return false;
- } else {
- return false;
- }
- }
- }
- );
- }
-
- void handle_signal(int _signum) {
- VSOMEIP_DEBUG << "Catched signal, going down ("
- << std::dec <<_signum << ")";
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
-
- void wait_for_stop() {
- {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
-
- EXPECT_TRUE(update_ok_);
-
- // Todo if policy was removed, the plugin answer is not allowed to be sent back as plugin service is blacklisted again
- //EXPECT_TRUE(removal_ok_);
-
- VSOMEIP_INFO << "Received all responses from plugin, going down";
- }
- app_->clear_all_handler();
- app_->stop();
- }
-
- void call_acl_deployment_interface(bool _updateAcl) {
-
- uint32_t user_id = (uint32_t) getuid();
- uint32_t group_id = (uint32_t) getgid();
-
- if(update_only_ || remove_only_) {
- user_id = 1001;
- group_id = 1001;
- }
-
- uint8_t uid_byte_0 = (uint8_t) GET_LONG_BYTE3(user_id);
- uint8_t uid_byte_1 = GET_LONG_BYTE2(user_id);
- uint8_t uid_byte_2 = GET_LONG_BYTE1(user_id);
- uint8_t uid_byte_3 = GET_LONG_BYTE0(user_id);
-
- uint8_t gid_byte_0 = (uint8_t) GET_LONG_BYTE3(group_id);
- uint8_t gid_byte_1 = GET_LONG_BYTE2(group_id);
- uint8_t gid_byte_2 = GET_LONG_BYTE1(group_id);
- uint8_t gid_byte_3 = GET_LONG_BYTE0(group_id);
-
- // send policy payload which also contains part of global security json to allow answer for removeAcl calls
- // updateAcl payload:
- /*
- Security configuration: UID: 0x3e8
- Security configuration: GID: 0x3e8
- Security configuration: RQUESTS POLICY SIZE: 4
- ALLOWED REQUESTS Service: 0x101
- Instances:
- first: 0x63 last: 0x63
- Methods:
- first: 0x1 last: 0x5
- first: 0x8001 last: 0x8003
- ALLOWED REQUESTS Service: 0x102
- Instances:
- first: 0x63 last: 0x63
- Methods:
- first: 0x1 last: 0x5
- first: 0x8001 last: 0x8003
- ALLOWED REQUESTS Service: 0x103
- Instances:
- first: 0x63 last: 0x63
- Methods:
- first: 0x3 last: 0x3
- first: 0x7777 last: 0x7777
- ALLOWED REQUESTS Service: 0xF90F
- Instances:
- first: 0x1 last: 0x1
- Methods:
- first: 0x1 last: 0x1
- first: 0x2 last: 0x2
- Security configuration: OFFER POLICY SIZE: 4
- ALLOWED OFFERS Service: 0x101
- Instances:
- first: 0x63 last: 0x63
- ALLOWED OFFERS Service: 0x102
- Instances:
- first: 0x63 last: 0x63
- ALLOWED OFFERS Service: 0x103
- Instances:
- first: 0x63 last: 0x63
- ALLOWED OFFERS Service: 0xF90F
- Instances:
- first: 0x1 last: 0x1
- */
- std::array<unsigned char, 280> update_payload =
- {{ uid_byte_0, uid_byte_1, uid_byte_2, uid_byte_3, gid_byte_0, gid_byte_1, gid_byte_2, gid_byte_3,
- 0x00, 0x00, 0x00, 0xb8, 0xF9, 0x0F, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00,
- 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x01, 0x77, 0x77, 0x01, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x80, 0x01, 0x80, 0x03, 0x01, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02,
- 0x80, 0x01, 0x80, 0x03, 0x00, 0x00, 0x00, 0x40, 0xF9, 0x0F, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x01, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x01, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63}};
-
- // removeAcl payload for UID 12345 GID 4567 or UID: 1000 -> 0x03, 0xe8,
- std::array<unsigned char, 8> remove_payload = {{uid_byte_0, uid_byte_1, uid_byte_2, uid_byte_3, gid_byte_0, gid_byte_1, gid_byte_2, gid_byte_3}};
-
- std::shared_ptr<vsomeip::message> its_request = vsomeip::runtime::get()->create_request();
- its_request->set_service(security_config_plugin_test::security_config_plugin_serviceinfo.service_id);
- its_request->set_instance(security_config_plugin_test::security_config_plugin_serviceinfo.instance_id);
- std::vector<vsomeip::byte_t> its_payload;
-
- if (_updateAcl) {
- its_request->set_method(security_config_plugin_test::security_config_plugin_serviceinfo.method_id);
- for (uint32_t i=0; i < update_payload.size(); i++) {
- its_payload.push_back(update_payload[i]);
- }
- } else {
- its_request->set_method(security_config_plugin_test::security_config_plugin_serviceinfo_reset.method_id);
- for (uint32_t i=0; i < remove_payload.size(); i++) {
- its_payload.push_back(remove_payload[i]);
- }
- }
- its_request->set_payload(vsomeip::runtime::get()->create_payload(its_payload));
- app_->send(its_request);
- }
-
- void call_try_offer() {
- std::shared_ptr<vsomeip::message> its_request = vsomeip::runtime::get()->create_request();
- its_request->set_service(security_config_plugin_test::security_config_test_serviceinfo_3.service_id);
- its_request->set_instance(security_config_plugin_test::security_config_test_serviceinfo_3.instance_id);
- its_request->set_method(security_config_plugin_test::security_config_test_serviceinfo_3.method_id);
- app_->send(its_request);
- }
-
- void call_method(vsomeip::service_t _service, vsomeip::instance_t _instance, vsomeip::method_t _method) {
- std::shared_ptr<vsomeip::message> its_request = vsomeip::runtime::get()->create_request();
- its_request->set_service(_service);
- its_request->set_instance(_instance);
- its_request->set_method(_method);
- app_->send(its_request);
- }
-
- void run() {
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
- }
-
- // payload for testing utility::parse_policy()
- /*
- Security configuration: UID: 0x01
- Security configuration: GID: 0x01
- Security configuration: RQUESTS POLICY SIZE: 4
- ALLOWED REQUESTS Service: 0x101
- Instances:
- first: 0x63 last: 0x63
- Methods:
- first: 0x1 last: 0x5
- first: 0x8001 last: 0x8003
- ALLOWED REQUESTS Service: 0x102
- Instances:
- first: 0x63 last: 0x63
- Methods:
- first: 0x1 last: 0x5
- first: 0x8001 last: 0x8003
- ALLOWED REQUESTS Service: 0x103
- Instances:
- first: 0x63 last: 0x63
- Methods:
- first: 0x3 last: 0x3
- first: 0x7777 last: 0x7777
- ALLOWED REQUESTS Service: 0xF90F
- Instances:
- first: 0x1 last: 0x1
- Methods:
- first: 0x1 last: 0x1
- first: 0x2 last: 0x2
- Security configuration: OFFER POLICY SIZE: 4
- ALLOWED OFFERS Service: 0x101
- Instances:
- first: 0x63 last: 0x63
- ALLOWED OFFERS Service: 0x102
- Instances:
- first: 0x63 last: 0x63
- ALLOWED OFFERS Service: 0x103
- Instances:
- first: 0x63 last: 0x63
- ALLOWED OFFERS Service: 0xF90F
- Instances:
- first: 0x1 last: 0x1
- */
- std::array<unsigned char, 280> policy_update_payload =
- {{ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, // uid / gid
- 0x00, 0x00, 0x00, 0xb8,
- 0xF9, 0x0F, // 0xf90f -> service ID at array index 12 - 13
- 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x0a,
- 0x00, 0x00, 0x00, 0x02, // -> union length = 2 byte
- 0x00, 0x00, 0x00, 0x01, // -> union type is single instance ID
- 0x00, 0x01, // -> single instance id 0x1 at array index 30 - 31
- 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00,
- 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x01, 0x77, 0x77, 0x01, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x00, 0x00, 0x00, 0x18,
- 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x02, // -> union type is ID range
- 0x00, 0x01, // first 0x01 at array index 132 - 133
- 0x00, 0x05, // last 0x05 at array index 134 - 135
- 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x80, 0x01, 0x80, 0x03, 0x01, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02,
- 0x80, 0x01, 0x80, 0x03, 0x00, 0x00, 0x00, 0x40, 0xF9, 0x0F, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x01, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63, 0x01, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x63}};
-
- // Check if parse_policy() correctly handles invalid service, instance and method ID's / ranges.
- uint32_t its_uid = 0x00;
- uint32_t its_gid = 0x00;
- uint32_t its_remaining_bytes_ = policy_update_payload.size();
- std::shared_ptr<vsomeip::policy> its_policy(std::make_shared<vsomeip::policy>());
- const vsomeip::byte_t* its_buffer_ptr = policy_update_payload.data();
-
- // valid policy
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), true);
-
- // set request service ID to invalid value 0x00
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_invalid_service = policy_update_payload;
- // set service ID from 0xf90f to 0x00
- policy_invalid_service[12] = 0x00;
- policy_invalid_service[13] = 0x00;
- its_buffer_ptr = policy_invalid_service.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), false);
-
- // set request service ID to invalid value 0xFFFF
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_invalid_service_2 = policy_update_payload;
- // set service ID from 0xf90f to 0x00
- policy_invalid_service_2[12] = 0xFF;
- policy_invalid_service_2[13] = 0xFF;
- its_buffer_ptr = policy_invalid_service_2.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), false);
-
- // set request single instance ID to invalid value 0x00 which shall be ignored
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_invalid_instance = policy_update_payload;
- // set instance ID of service 0xf90f to 0x00
- policy_invalid_instance[30] = 0x00;
- policy_invalid_instance[31] = 0x00;
- its_buffer_ptr = policy_invalid_instance.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), true);
-
- // set request single instance ID to valid value 0xFFFF
- // meaning ANY_INSTANCE range from 0x01 to 0xFFFE
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_valid_instance = policy_update_payload;
- // set instance ID of service 0xf90f to 0xFFFF
- policy_valid_instance[30] = 0xFF;
- policy_valid_instance[31] = 0xFF;
- its_buffer_ptr = policy_valid_instance.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), true);
-
- // set first of range to 0x00 and last to 0x05 which is invalid
- // the range shall be adjusted to be 0x01 to 0x05 without giving an error
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_invalid_method = policy_update_payload;
- policy_invalid_method[132] = 0x00;
- policy_invalid_method[133] = 0x00;
- its_buffer_ptr = policy_invalid_method.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), true);
-
- // set first of range to 0x01 and last to 0x00 which is invalid
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_invalid_method_2 = policy_update_payload;
- policy_invalid_method_2[134] = 0x00;
- policy_invalid_method_2[135] = 0x00;
- its_buffer_ptr = policy_invalid_method_2.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), false);
-
- // set first of range to 0x06 and last to 0x05 which is invalid
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_invalid_method_3 = policy_update_payload;
- policy_invalid_method_3[132] = 0x00;
- policy_invalid_method_3[133] = 0x06;
- its_buffer_ptr = policy_invalid_method_3.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), false);
-
- // set first of range to 0x01 and last to 0xFFFF which is invalid as first and last
- // must be set to 0xFFFF if ANY_METHOD / ANY_INSTANCE shall be specified
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_invalid_method_4 = policy_update_payload;
- policy_invalid_method_4[134] = 0xFF;
- policy_invalid_method_4[135] = 0xFF;
- its_buffer_ptr = policy_invalid_method_4.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), false);
-
- // set first of range to 0xFFFF and last to 0xFFFF which is valid
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_valid_method = policy_update_payload;
- policy_valid_method[132] = 0xFF;
- policy_valid_method[133] = 0xFF;
- policy_valid_method[134] = 0xFF;
- policy_valid_method[135] = 0xFF;
- its_buffer_ptr = policy_valid_method.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), true);
-
- // set first of range to 0x01 and last to 0x01 which is valid
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_valid_method_2 = policy_update_payload;
- policy_valid_method_2[132] = 0x00;
- policy_valid_method_2[133] = 0x01;
- policy_valid_method_2[134] = 0x00;
- policy_valid_method_2[135] = 0x01;
- its_buffer_ptr = policy_valid_method_2.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), true);
-
- // set first of range to 0x01 and last to 0xFFFE which is valid
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_valid_method_3 = policy_update_payload;
- policy_valid_method_3[132] = 0x00;
- policy_valid_method_3[133] = 0x01;
- policy_valid_method_3[134] = 0xFF;
- policy_valid_method_3[135] = 0xFE;
- its_buffer_ptr = policy_valid_method_3.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), true);
-
- // set first of range to 0xFFFF and last to 0x05 which is invalid
- its_remaining_bytes_ = policy_update_payload.size();
- std::array<unsigned char, 280> policy_invalid_method_6 = policy_update_payload;
- policy_invalid_method_6[132] = 0xFF;
- policy_invalid_method_6[133] = 0xFF;
- its_buffer_ptr = policy_invalid_method_6.data();
- EXPECT_EQ(::vsomeip::utility::parse_policy(its_buffer_ptr, its_remaining_bytes_, its_uid, its_gid, its_policy), false);
-
- VSOMEIP_INFO << "waiting until security_config plugin service is available!";
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_security_config_service_available_) {
- condition_.wait(its_lock);
- }
- wait_until_security_config_service_available_ = true;
- VSOMEIP_INFO << "security config plugin service is available";
- }
-
- if (update_only_) {
- VSOMEIP_INFO << "ONLY Calling updateAcl with user ID 1001 and exit -> shall allow method calls and events...";
- call_acl_deployment_interface(true);
- sleep(1);
- exit(0);
- } else if (remove_only_) {
- VSOMEIP_INFO << "ONLY Calling removeAcl with user ID 1001 and exit -> removes complete allow policy (disables all method calls / events)";
- call_acl_deployment_interface(false);
- sleep(1);
- exit(0);
- } else if (subscribe_only_) {
- VSOMEIP_INFO << "Subscribe to still blacklisted event 0x8004 and do not expect an event!";
- // check that events for service 0x101 and event 0x8004 are never received as policy does not allow it
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id);
- app_->request_event(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(0x8004),
- its_eventgroups, true);
- app_->subscribe(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- static_cast<vsomeip::event_t>(0x8004));
- sleep(1);
- EXPECT_EQ(number_of_received_events_4, (uint32_t) 0);
- exit(0);
- }
-
- VSOMEIP_INFO << "Do method calls to blacklisted service/methods 0x101/0x01 and 0x102/0x02 and do not expect any response";
-
- // do method calls to blacklisted services -> no response expected
- call_method(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.method_id);
-
- call_method(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.method_id);
-
-
- // check that no events are received before policy allows subscribing
- VSOMEIP_INFO << "Subscribe to blacklisted service/event 0x101/0x8001 and do not expect any event";
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id);
-
- app_->request_event(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(security_config_plugin_test::security_config_test_serviceinfo_1.event_id),
- its_eventgroups, true);
- app_->subscribe(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- static_cast<vsomeip::event_t>(security_config_plugin_test::security_config_test_serviceinfo_1.event_id));
-
- sleep(1);
-
- EXPECT_EQ(number_of_received_responses_method_1, (uint32_t) 0);
- EXPECT_EQ(number_of_received_responses_method_2, (uint32_t) 0);
- EXPECT_EQ(number_of_received_events_1, (uint32_t) 0);
- EXPECT_EQ(number_of_received_events_2, (uint32_t) 0);
-
- VSOMEIP_INFO << "Calling updateAcl which shall allow method calls and events...";
- call_acl_deployment_interface(true);
- VSOMEIP_INFO << "wait until control service is available ...";
-
- // wait until control service is available
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_control_service_available_) {
- condition_.wait(its_lock);
- }
- wait_until_control_service_available_ = true;
- VSOMEIP_INFO << "local control service 0x0103 available";
- }
- // Todo wait until plugin has answered the acl update
- sleep(1);
-
- // Send message_try_offer request in order to trigger stopoffer and reoffering of now allowed services
- VSOMEIP_INFO << "trigger stopoffer / reoffer of service 0x0101 and 0x0102 ...";
- call_try_offer();
-
- // try requesting the services 0x0101 and 0x0102 again
- // (initial request service was rejected before which causes no routing info to be sent after policy update)
- app_->request_service(
- security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR);
-
- app_->request_service(
- security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_3.instance_id,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR);
-
- // check that services 0x0101 get available after acl update
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_updated_service_101_available_) {
- condition_.wait(its_lock);
- }
- wait_until_updated_service_101_available_ = true;
- VSOMEIP_INFO << "By policy update allowed service 0x0101 got available";
- }
-
- // check that services 0x0102 get available after acl update
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_updated_service_102_available_) {
- condition_.wait(its_lock);
- }
- wait_until_updated_service_102_available_ = true;
- VSOMEIP_INFO << "By policy update allowed service 0x0102 got available";
- }
-
- VSOMEIP_INFO << "Call now allowed service/methods 0x101/0x01 and 0x102/0x02 after allow policy update and expect responses!";
-
- // call method ids which should now be allowed to be requested
- call_method(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.method_id);
-
- // check that method calls are working
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_method_1_responses_received_) {
- condition_.wait(its_lock);
- }
- wait_until_method_1_responses_received_ = true;
- VSOMEIP_INFO << "By policy update allowed response to request of service/instance/method "
- << std::hex << security_config_plugin_test::security_config_test_serviceinfo_1.service_id
- << "/" << security_config_plugin_test::security_config_test_serviceinfo_1.instance_id
- << "/" << security_config_plugin_test::security_config_test_serviceinfo_1.method_id << " received";
- }
-
- call_method(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.method_id);
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_method_2_responses_received_) {
- condition_.wait(its_lock);
- }
- wait_until_method_2_responses_received_ = true;
- VSOMEIP_INFO << "By policy update allowed response to request of service/instance/method "
- << std::hex << security_config_plugin_test::security_config_test_serviceinfo_2.service_id
- << "/" << security_config_plugin_test::security_config_test_serviceinfo_2.instance_id
- << "/" << security_config_plugin_test::security_config_test_serviceinfo_2.method_id << " received";
- }
-
- EXPECT_EQ(number_of_received_responses_method_1, (uint32_t) 1);
- EXPECT_EQ(number_of_received_responses_method_2, (uint32_t) 1);
-
- // check that events are received now
- VSOMEIP_INFO << "Subscribe to service 0x101 / 0x102 events 0x8001 / 0x8002 and expect initial events";
- app_->request_event(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(security_config_plugin_test::security_config_test_serviceinfo_1.event_id),
- its_eventgroups, true);
- app_->subscribe(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- static_cast<vsomeip::event_t>(security_config_plugin_test::security_config_test_serviceinfo_1.event_id));
-
- // check that from first service events were received
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_notifications_1_received_) {
- condition_.wait(its_lock);
- }
- wait_until_notifications_1_received_ = true;
- VSOMEIP_INFO << "notifications from service 0x0101 received";
- }
-
- app_->request_event(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- static_cast<vsomeip::event_t>(security_config_plugin_test::security_config_test_serviceinfo_2.event_id),
- its_eventgroups, true);
- app_->subscribe(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- static_cast<vsomeip::event_t>(security_config_plugin_test::security_config_test_serviceinfo_2.event_id));
-
- // check that from second service events were received
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_notifications_2_received_) {
- condition_.wait(its_lock);
- }
- wait_until_notifications_2_received_ = true;
- VSOMEIP_INFO << "notifications from service 0x0102 received";
- }
-
- VSOMEIP_INFO << "Subscribe to still blacklisted event 0x8004 and do not expect an event!";
- // check that events for service 0x101 and event 0x8004 are never received as policy does not allow it
- app_->request_event(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(0x8004),
- its_eventgroups, true);
- app_->subscribe(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- static_cast<vsomeip::event_t>(0x8004));
- sleep(1);
- EXPECT_EQ(number_of_received_events_4, (uint32_t) 0);
-
-
- // unsusbcribe
- app_->unsubscribe(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id);
-
- app_->unsubscribe(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.eventgroup_id);
-
- // tigger removeAcl (removes the whole configuration for uid 1000)
- VSOMEIP_INFO << "Calling removeAcl which removes complete allow policy (disables all method calls / events)";
- call_acl_deployment_interface(false);
-
- //Todo wait for plugin response
- sleep(1);
-
- VSOMEIP_INFO << "Call now blacklisted methods after complete allow policy removal and do not expect any response!";
- // no response expected as policy was removed
- call_method(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.method_id);
-
- call_method(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.method_id);
-
- // check that no more initial events are received now on resubscribe
- VSOMEIP_INFO << "Subscribe to now blacklisted events after complete allow policy removal and do not expect initial events!";
- app_->subscribe(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id);
-
- app_->subscribe(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.eventgroup_id);
-
- sleep(1);
-
- EXPECT_EQ(number_of_received_responses_method_1, (uint32_t) 1);
- EXPECT_EQ(number_of_received_responses_method_2, (uint32_t) 1);
- EXPECT_EQ(number_of_received_events_1, (uint32_t) 1);
- EXPECT_EQ(number_of_received_events_2, (uint32_t) 1);
-
- {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- sleep(1);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
- }
-
-private:
- bool update_only_;
- bool remove_only_;
- bool subscribe_only_;
- std::shared_ptr<vsomeip::application> app_;
- bool wait_until_registered_;
- bool wait_until_security_config_service_available_;
- bool wait_until_control_service_available_;
- bool wait_until_updated_service_101_available_;
- bool wait_until_updated_service_102_available_;
- bool wait_until_method_1_responses_received_;
- bool wait_until_method_2_responses_received_;
- uint32_t number_of_received_responses_method_1;
- uint32_t number_of_received_responses_method_2;
- uint32_t number_of_received_events_1;
- uint32_t number_of_received_events_2;
- uint32_t number_of_received_events_4;
- bool wait_until_notifications_1_received_;
- bool wait_until_notifications_2_received_;
- std::mutex mutex_;
- std::condition_variable condition_;
-
- bool wait_for_stop_;
- bool update_ok_;
- bool removal_ok_;
-
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
- std::thread stop_thread_;
-
- std::thread run_thread_;
- std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_notification_;
-
-};
-
-#if 1
-static bool only_update;
-static bool only_remove;
-static bool only_subscribe;
-#endif
-
-extern "C" void signal_handler(int signum) {
- the_client->handle_signal(signum);
-}
-
-TEST(someip_security_config_plugin_test, update_remove_security_config_policy)
-{
- security_config_plugin_test_client its_sample(only_update, only_remove, only_subscribe);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
-#if 1
- only_update = false;
- only_remove = false;
- only_subscribe = false;
- if (argc > 1) {
- if(std::string("UPDATE") == std::string(argv[1])) {
- only_update = true;
- } else if(std::string("REMOVE") == std::string(argv[1])) {
- only_remove = true;
- } else if (std::string("SUBSCRIBE") == std::string(argv[1])) {
- only_subscribe = true;
- }
- }
-
-#endif
-
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/security_config_plugin_tests/security_config_plugin_test_globals.hpp b/test/security_config_plugin_tests/security_config_plugin_test_globals.hpp
deleted file mode 100755
index 0e2f456..0000000
--- a/test/security_config_plugin_tests/security_config_plugin_test_globals.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (C) 2014-2017 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 SECURITY_CONFIG_PLUGIN_TEST_GLOBALS_HPP_
-#define SECURITY_CONFIG_PLUGIN_TEST_GLOBALS_HPP_
-
-namespace security_config_plugin_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
-};
-
-// ACL interface of plugin (this service is allowed to be offered in global security config)
-static constexpr service_info security_config_plugin_serviceinfo = { 0xF90F, 0x01, 0x1, 0x0, 0x0 };
-static constexpr vsomeip::major_version_t security_config_plugin_major_version_ = 0x01;
-static constexpr vsomeip::minor_version_t security_config_plugin_minor_version_ = 0x00;
-
-static constexpr service_info security_config_plugin_serviceinfo_reset = { 0xF90F, 0x01, 0x2, 0x0, 0x0 };
-
-// services to test policy (these services are denied to be offered in global security config and will be allowed via updateAcl)
-static constexpr service_info security_config_test_serviceinfo_1 = { 0x0101, 0x63, 0x1, 0x8001, 0x1 };
-static constexpr service_info security_config_test_serviceinfo_2 = { 0x0102, 0x63, 0x2, 0x8002, 0x1 };
-
-// service to control offering of above service instances via client method call (this service is allowed to be offered in global security config)
-static constexpr service_info security_config_test_serviceinfo_3 = { 0x0103, 0x63, 0x3, 0x0, 0x0 };
-
-
-static constexpr int notifications_to_send = 1;
-}
-
-#endif /* SECURITY_CONFIG_PLUGIN_TEST_GLOBALS_HPP_ */
diff --git a/test/security_config_plugin_tests/security_config_plugin_test_local_starter.sh b/test/security_config_plugin_tests/security_config_plugin_test_local_starter.sh
deleted file mode 100755
index dd1939c..0000000
--- a/test/security_config_plugin_tests/security_config_plugin_test_local_starter.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Running first test
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=security_config_plugin_test_local.json
-
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(readlink -f ../plugins/mgu)
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-
-sleep 1
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=service-sample
-./security_config_plugin_test_service &
-PID_SERVICE=$!
-
-sleep 1
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=client-sample
-./security_config_plugin_test_client &
-CLIENT_PIDS+=($!)
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-kill $PID_VSOMEIPD
-sleep 1
-
-kill $PID_SERVICE
-sleep 1
-
-# Check if everything went well
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/security_config_plugin_tests/security_config_plugin_test_service.cpp b/test/security_config_plugin_tests/security_config_plugin_test_service.cpp
deleted file mode 100644
index 40a7f8c..0000000
--- a/test/security_config_plugin_tests/security_config_plugin_test_service.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright (C) 2017 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 "security_config_plugin_test_service.hpp"
-#include "../security_config_plugin_tests/security_config_plugin_test_globals.hpp"
-
-security_config_plugin_test_service::security_config_plugin_test_service() :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- blocked_(false),
- number_of_received_messages_(0),
- offer_thread_(std::bind(&security_config_plugin_test_service::run, this)) {
-}
-
-bool security_config_plugin_test_service::init() {
- std::lock_guard<std::mutex> its_lock(mutex_);
-
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
- app_->register_message_handler(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- vsomeip::ANY_METHOD,
- std::bind(&security_config_plugin_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_message_handler(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- vsomeip::ANY_METHOD,
- std::bind(&security_config_plugin_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_message_handler(security_config_plugin_test::security_config_test_serviceinfo_3.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_3.instance_id,
- security_config_plugin_test::security_config_test_serviceinfo_3.method_id,
- std::bind(&security_config_plugin_test_service::on_message_try_offer, this,
- std::placeholders::_1));
-
- app_->register_message_handler(security_config_plugin_test::security_config_test_serviceinfo_3.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_3.instance_id,
- vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN,
- std::bind(&security_config_plugin_test_service::on_message_shutdown, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&security_config_plugin_test_service::on_state, this,
- std::placeholders::_1));
-
- // offer allowed field 0x8001 eventgroup 0x01
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(security_config_plugin_test::security_config_test_serviceinfo_1.eventgroup_id);
-
- app_->offer_event(security_config_plugin_test::security_config_test_serviceinfo_1.service_id, security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(0x8001), its_eventgroups, true);
-
- // offer never allowed field 0x8004 eventgroup 0x01
- app_->offer_event(security_config_plugin_test::security_config_test_serviceinfo_1.service_id, security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(0x8004), its_eventgroups, true);
-
-
- // offer allowed field 0x8002 eventgroup 0x01
- app_->offer_event(security_config_plugin_test::security_config_test_serviceinfo_2.service_id, security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- static_cast<vsomeip::event_t>(0x8002), its_eventgroups, true);
-
- // set value to fields
- std::shared_ptr<vsomeip::payload> its_payload =
- vsomeip::runtime::get()->create_payload();
- vsomeip::byte_t its_data[2] = {static_cast<vsomeip::byte_t>((security_config_plugin_test::security_config_test_serviceinfo_1.service_id & 0xFF00) >> 8),
- static_cast<vsomeip::byte_t>((security_config_plugin_test::security_config_test_serviceinfo_1.service_id & 0xFF))};
- its_payload->set_data(its_data, 2);
-
- app_->notify(security_config_plugin_test::security_config_test_serviceinfo_1.service_id, security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(0x8001), its_payload);
-
- app_->notify(security_config_plugin_test::security_config_test_serviceinfo_1.service_id, security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(0x8004), its_payload);
-
- app_->notify(security_config_plugin_test::security_config_test_serviceinfo_2.service_id, security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- static_cast<vsomeip::event_t>(0x8002), its_payload);
-
- return true;
-}
-
-void security_config_plugin_test_service::start() {
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void security_config_plugin_test_service::stop() {
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
-}
-
-void security_config_plugin_test_service::join_offer_thread() {
- if (offer_thread_.joinable()) {
- offer_thread_.join();
- }
-}
-
-void security_config_plugin_test_service::offer() {
- // offer the initially in global security config file denied service / instance
- app_->offer_service(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id);
-
- // offer the initially in global security config file denied service / instance
- app_->offer_service(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id);
-
- // offer the allowed control service / instance
- app_->offer_service(security_config_plugin_test::security_config_test_serviceinfo_3.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_3.instance_id);
-}
-
-void security_config_plugin_test_service::stop_offer() {
- app_->stop_offer_service(security_config_plugin_test::security_config_test_serviceinfo_1.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_1.instance_id);
- app_->stop_offer_service(security_config_plugin_test::security_config_test_serviceinfo_2.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_2.instance_id);
- app_->stop_offer_service(security_config_plugin_test::security_config_test_serviceinfo_3.service_id,
- security_config_plugin_test::security_config_test_serviceinfo_3.instance_id);
-}
-
-void security_config_plugin_test_service::on_state(vsomeip::state_type_e _state) {
- VSOMEIP_INFO << "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<std::mutex> its_lock(mutex_);
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else {
- is_registered_ = false;
- }
-}
-
-void security_config_plugin_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request) {
- VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _request->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _request->get_session() << "] method: " << _request->get_method() ;
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- app_->send(its_response, true);
-
- number_of_received_messages_++;
- if(number_of_received_messages_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS) {
- VSOMEIP_INFO << "Received all messages!";
- }
-}
-
-void security_config_plugin_test_service::on_message_shutdown(
- const std::shared_ptr<vsomeip::message>& _request) {
- (void)_request;
- VSOMEIP_INFO << "Shutdown method was called, going down now.";
- stop();
-}
-
-void security_config_plugin_test_service::on_message_try_offer(
- const std::shared_ptr<vsomeip::message>& _request) {
- (void)_request;
- VSOMEIP_INFO << "Try offering method was called.";
- stop_offer();
- offer();
-
- // set value to fields
- std::shared_ptr<vsomeip::payload> its_payload =
- vsomeip::runtime::get()->create_payload();
- vsomeip::byte_t its_data[2] = {static_cast<vsomeip::byte_t>((security_config_plugin_test::security_config_test_serviceinfo_1.service_id & 0xFF00) >> 8),
- static_cast<vsomeip::byte_t>((security_config_plugin_test::security_config_test_serviceinfo_1.service_id & 0xFF))};
- its_payload->set_data(its_data, 2);
- app_->notify(security_config_plugin_test::security_config_test_serviceinfo_1.service_id, security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(0x8001), its_payload);
-
- app_->notify(security_config_plugin_test::security_config_test_serviceinfo_1.service_id, security_config_plugin_test::security_config_test_serviceinfo_1.instance_id,
- static_cast<vsomeip::event_t>(0x8004), its_payload);
-
- // set value to fields
- std::shared_ptr<vsomeip::payload> its_payload_2 =
- vsomeip::runtime::get()->create_payload();
- vsomeip::byte_t its_data_2[2] = {static_cast<vsomeip::byte_t>((security_config_plugin_test::security_config_test_serviceinfo_2.service_id & 0xFF00) >> 8),
- static_cast<vsomeip::byte_t>((security_config_plugin_test::security_config_test_serviceinfo_2.service_id & 0xFF))};
- its_payload_2->set_data(its_data_2, 2);
- app_->notify(security_config_plugin_test::security_config_test_serviceinfo_2.service_id, security_config_plugin_test::security_config_test_serviceinfo_2.instance_id,
- static_cast<vsomeip::event_t>(0x8002), its_payload_2);
-
-}
-
-void security_config_plugin_test_service::run() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- offer();
-}
-
-TEST(someip_security_test, basic_security_update_) {
- security_config_plugin_test_service test_service;
- if (test_service.init()) {
- test_service.start();
- test_service.join_offer_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/security_tests/conf/security_test_config_client_external_allow.json.in b/test/security_tests/conf/security_test_config_client_external_allow.json.in
index 531c620..e73f3db 100644
--- a/test/security_tests/conf/security_test_config_client_external_allow.json.in
+++ b/test/security_tests/conf/security_test_config_client_external_allow.json.in
@@ -15,7 +15,7 @@
"id" : "0x1255"
},
{
- "name" : "vsomeipd",
+ "name" : "routingmanagerd",
"id" : "0x2222"
}
],
@@ -67,7 +67,7 @@
}
]
},
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"routing-credentials" :
{
"uid" : "@TEST_UID@",
diff --git a/test/security_tests/conf/security_test_config_client_external_deny.json.in b/test/security_tests/conf/security_test_config_client_external_deny.json.in
index 0cd96fb..1161f4f 100644
--- a/test/security_tests/conf/security_test_config_client_external_deny.json.in
+++ b/test/security_tests/conf/security_test_config_client_external_deny.json.in
@@ -15,7 +15,7 @@
"id" : "0x1255"
},
{
- "name" : "vsomeipd",
+ "name" : "routingmanagerd",
"id" : "0x2222"
}
],
@@ -67,7 +67,7 @@
}
]
},
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"routing-credentials" :
{
"uid" : "@TEST_UID@",
diff --git a/test/security_tests/conf/security_test_config_service_external_allow.json.in b/test/security_tests/conf/security_test_config_service_external_allow.json.in
index e95b942..4d9129a 100644
--- a/test/security_tests/conf/security_test_config_service_external_allow.json.in
+++ b/test/security_tests/conf/security_test_config_service_external_allow.json.in
@@ -15,7 +15,7 @@
"id" : "0x1277"
},
{
- "name" : "vsomeipd",
+ "name" : "routingmanagerd",
"id" : "0x1111"
}
],
@@ -61,7 +61,7 @@
}
]
},
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"routing-credentials" :
{
"uid" : "@TEST_UID@",
diff --git a/test/security_tests/conf/security_test_config_service_external_deny.json.in b/test/security_tests/conf/security_test_config_service_external_deny.json.in
index 8caf0af..769b04f 100644
--- a/test/security_tests/conf/security_test_config_service_external_deny.json.in
+++ b/test/security_tests/conf/security_test_config_service_external_deny.json.in
@@ -15,7 +15,7 @@
"id" : "0x1277"
},
{
- "name" : "vsomeipd",
+ "name" : "routingmanagerd",
"id" : "0x1111"
}
],
@@ -61,7 +61,7 @@
}
]
},
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"routing-credentials" :
{
"uid" : "@TEST_UID@",
diff --git a/test/security_tests/conf/security_test_local_config.json.in b/test/security_tests/conf/security_test_local_config.json.in
index aab7f39..60036f8 100644
--- a/test/security_tests/conf/security_test_local_config.json.in
+++ b/test/security_tests/conf/security_test_local_config.json.in
@@ -18,7 +18,7 @@
"id" : "0x1255"
},
{
- "name" : "vsomeipd",
+ "name" : "routingmanagerd",
"id" : "0x1111"
}
],
@@ -55,7 +55,7 @@
}
]
},
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"routing-credentials" :
{
"uid" : "@TEST_UID@",
diff --git a/test/security_tests/security_test_client.cpp b/test/security_tests/security_test_client.cpp
index 2841f23..e96d48a 100644
--- a/test/security_tests/security_test_client.cpp
+++ b/test/security_tests/security_test_client.cpp
@@ -92,18 +92,16 @@ void security_test_client::on_state(vsomeip::state_type_e _state) {
its_eventgroups.insert(0x01);
app_->request_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
static_cast<vsomeip::event_t>(0x8001),
- its_eventgroups, true);
+ its_eventgroups, vsomeip::event_type_e::ET_FIELD);
app_->request_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
static_cast<vsomeip::event_t>(0x8002),
- its_eventgroups, true);
+ its_eventgroups, vsomeip::event_type_e::ET_FIELD);
app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, 0x01,
- vsomeip::DEFAULT_MAJOR, vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- static_cast<vsomeip::event_t>(0x8001));
+ vsomeip::DEFAULT_MAJOR, static_cast<vsomeip::event_t>(0x8001));
app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, 0x01,
- vsomeip::DEFAULT_MAJOR, vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- static_cast<vsomeip::event_t>(0x8002));
+ vsomeip::DEFAULT_MAJOR, static_cast<vsomeip::event_t>(0x8002));
}
}
@@ -184,11 +182,11 @@ void security_test_client::run() {
request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
// send a request which is allowed by policy -> expect answer
- app_->send(request, true);
+ app_->send(request);
// send a request with a not allowed method ID -> expect no answer
request->set_method(0x888);
- app_->send(request, true);
+ app_->send(request);
std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
@@ -222,7 +220,7 @@ void security_test_client::shutdown_service() {
request->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
request->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
- app_->send(request,true);
+ app_->send(request);
}
TEST(someip_security_test, basic_subscribe_request_response)
diff --git a/test/security_tests/security_test_external_master_start.sh b/test/security_tests/security_test_external_master_start.sh
index 855654b..75d8667 100755
--- a/test/security_tests/security_test_external_master_start.sh
+++ b/test/security_tests/security_test_external_master_start.sh
@@ -24,9 +24,9 @@ ALLOW_DENY=$2
FAIL=0
export VSOMEIP_CONFIGURATION=$1
-export VSOMEIP_APPLICATION_NAME=vsomeipd
+export VSOMEIP_APPLICATION_NAME=routingmanagerd
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
export VSOMEIP_CONFIGURATION=$1
@@ -37,7 +37,7 @@ PID_CLIENT=$!
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting external security 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/test; ./security_test_external_slave_start.sh $SERVICE_JSON_FILE $2\"" &
+ 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; ./security_test_external_slave_start.sh $SERVICE_JSON_FILE $2\"" &
elif [ ! -z "$USE_DOCKER" ]; then
docker run --name citms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./security_test_external_slave_start.sh $SERVICE_JSON_FILE $2" &
else
diff --git a/test/security_tests/security_test_external_slave_start.sh b/test/security_tests/security_test_external_slave_start.sh
index 2b2391f..41b6251 100755
--- a/test/security_tests/security_test_external_slave_start.sh
+++ b/test/security_tests/security_test_external_slave_start.sh
@@ -23,9 +23,9 @@ ALLOW_DENY=$2
FAIL=0
export VSOMEIP_CONFIGURATION=$1
-export VSOMEIP_APPLICATION_NAME=vsomeipd
+export VSOMEIP_APPLICATION_NAME=routingmanagerd
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
export VSOMEIP_CONFIGURATION=$1
diff --git a/test/security_tests/security_test_local_start.sh b/test/security_tests/security_test_local_start.sh
index 886b412..fb8273d 100755
--- a/test/security_tests/security_test_local_start.sh
+++ b/test/security_tests/security_test_local_start.sh
@@ -6,9 +6,9 @@
export VSOMEIP_CONFIGURATION=security_test_local_config.json
-export VSOMEIP_APPLICATION_NAME=vsomeipd
+export VSOMEIP_APPLICATION_NAME=routingmanagerd
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
sleep 1
diff --git a/test/security_tests/security_test_service.cpp b/test/security_tests/security_test_service.cpp
index baaa60d..347a01b 100644
--- a/test/security_tests/security_test_service.cpp
+++ b/test/security_tests/security_test_service.cpp
@@ -43,11 +43,15 @@ bool security_test_service::init() {
its_eventgroups.insert(0x01);
app_->offer_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- static_cast<vsomeip::event_t>(0x8001), its_eventgroups, true);
+ static_cast<vsomeip::event_t>(0x8001), its_eventgroups,
+ vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
// also offer field 0x8002 which is not allowed to be received by client
app_->offer_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- static_cast<vsomeip::event_t>(0x8002), its_eventgroups, true);
+ static_cast<vsomeip::event_t>(0x8002), its_eventgroups,
+ vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
// set value to fields
std::shared_ptr<vsomeip::payload> its_payload =
@@ -128,7 +132,7 @@ void security_test_service::on_message(const std::shared_ptr<vsomeip::message>&
std::shared_ptr<vsomeip::message> its_response =
vsomeip::runtime::get()->create_response(_request);
- app_->send(its_response, true);
+ app_->send(its_response);
number_of_received_messages_++;
if(number_of_received_messages_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS) {
diff --git a/test/someip_test_globals.hpp b/test/someip_test_globals.hpp
index 8e7af4b..4380cd3 100644
--- a/test/someip_test_globals.hpp
+++ b/test/someip_test_globals.hpp
@@ -7,8 +7,7 @@
#define SOMEIP_TEST_GLOBALS_HPP_
#include <vsomeip/vsomeip.hpp>
-
-#include "../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
namespace vsomeip_test
{
diff --git a/test/someip_tp_tests/conf/someip_tp_test_master.json.in b/test/someip_tp_tests/conf/someip_tp_test_master.json.in
new file mode 100644
index 0000000..a2f67a1
--- /dev/null
+++ b/test/someip_tp_tests/conf/someip_tp_test_master.json.in
@@ -0,0 +1,45 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications" :
+ [
+ {
+ "name" : "someip_tp_test_service",
+ "id" : "0xCAFE"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4545",
+ "instance":"0x1",
+ "unreliable":"30001",
+ "someip-tp" : {
+ "service-to-client": [ "0x4545", "0x8001"]
+ }
+ },
+ {
+ "service":"0x6767",
+ "instance":"0x1",
+ "unicast" : "@TEST_IP_SLAVE@",
+ "unreliable":"40001",
+ "someip-tp" : {
+ "client-to-service": [ "0x6767", "0x8001" ]
+ }
+ }
+ ],
+ "max-payload-size-unreliable" : "8352",
+ "routing":"routingmanagerd",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.77.1",
+ "port":"30490",
+ "protocol":"udp",
+ "cyclic_offer_delay" : "1000"
+ }
+} \ No newline at end of file
diff --git a/test/someip_tp_tests/conf/someip_tp_test_master_starter.sh.in b/test/someip_tp_tests/conf/someip_tp_test_master_starter.sh.in
new file mode 100755
index 0000000..c01feea
--- /dev/null
+++ b/test/someip_tp_tests/conf/someip_tp_test_master_starter.sh.in
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright (C) 2015-2019 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
+
+if [ $# -lt 1 ]
+then
+ echo "Please pass a test mode to this script."
+ echo "For example: $0 IN_SEQUENCE"
+ echo "Valid subscription types include:"
+ echo " [IN_SEQUENCE, MIXED, INCOMPLETE, DUPLICATE, OVERLAP, OVERLAP_FRONT_BACK]"
+ exit 1
+fi
+TESTMODE=$1
+export VSOMEIP_CONFIGURATION=someip_tp_test_master.json
+# start daemon
+../examples/routingmanagerd/./routingmanagerd &
+PID_VSOMEIPD=$!
+# Start the services
+./someip_tp_test_service $1 &
+PID_SERIVCE=$!
+
+sleep 1
+
+if [ ! -z "$USE_LXC_TEST" ]; then
+ echo "Waiting for 5s"
+ sleep 5
+ 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; ./someip_tp_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE\"" &
+ echo "remote ssh pid: $!"
+elif [ ! -z "$USE_DOCKER" ]; then
+ echo "Waiting for 5s"
+ sleep 5
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./someip_tp_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE" &
+else
+cat <<End-of-message
+*******************************************************************************
+*******************************************************************************
+** Please now run:
+** someip_tp_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE
+** from an external host to successfully complete this test.
+**
+** You probably will need to adapt the 'unicast' settings in
+** someip_tp_test_master.json to your personal setup.
+*******************************************************************************
+*******************************************************************************
+End-of-message
+fi
+
+# Wait until all clients and services are finished
+for job in $PID_SERIVCE
+do
+ # Fail gets incremented if a client exits with a non-zero exit code
+ echo "waiting for $job"
+ wait $job || FAIL=$(($FAIL+1))
+done
+
+# kill the services
+kill $PID_VSOMEIPD
+sleep 1
+
+# Check if everything went well
+exit $FAIL
diff --git a/test/someip_tp_tests/someip_tp_test_globals.hpp b/test/someip_tp_tests/someip_tp_test_globals.hpp
new file mode 100644
index 0000000..723cfe1
--- /dev/null
+++ b/test/someip_tp_tests/someip_tp_test_globals.hpp
@@ -0,0 +1,40 @@
+// Copyright (C) 2014-2017 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 SOMEIP_TP_TEST_GLOBALS_HPP_
+#define SOMEIP_TP_TEST_GLOBALS_HPP_
+
+#include <vsomeip/primitive_types.hpp>
+
+namespace someip_tp_test {
+
+struct service_info {
+ vsomeip::service_t service_id;
+ vsomeip::instance_t instance_id;
+ vsomeip::method_t method_id;
+ vsomeip::event_t event_id;
+ vsomeip::eventgroup_t eventgroup_id;
+ vsomeip::method_t shutdown_method_id;
+ vsomeip::method_t notify_method_id;
+};
+
+struct service_info service = { 0x4545, 0x1, 0x4545, 0x8001, 0x1, 0x4501, 0x4502 };
+struct service_info service_slave = { 0x6767, 0x1, 0x6767, 0x8001, 0x1, 0x6701, 0x6702 };
+
+enum test_mode_e {
+ IN_SEQUENCE,
+ MIXED,
+ INCOMPLETE,
+ DUPLICATE,
+ OVERLAP,
+ OVERLAP_FRONT_BACK
+};
+
+const std::uint32_t number_of_fragments = 6;
+const std::uint32_t max_segment_size = 1392;
+
+}
+
+#endif /* SOMEIP_TP_TEST_GLOBALS_HPP_ */
diff --git a/test/someip_tp_tests/someip_tp_test_master.json b/test/someip_tp_tests/someip_tp_test_master.json
new file mode 100644
index 0000000..9a08e77
--- /dev/null
+++ b/test/someip_tp_tests/someip_tp_test_master.json
@@ -0,0 +1,45 @@
+{
+ "unicast":"10.0.3.1",
+ "logging":
+ {
+ "level":"info",
+ "console":"true"
+ },
+ "applications" :
+ [
+ {
+ "name" : "someip_tp_test_service",
+ "id" : "0xCAFE"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4545",
+ "instance":"0x1",
+ "unreliable":"30001",
+ "someip-tp" : {
+ "service-to-client": [ "0x4545", "0x8001"]
+ }
+ },
+ {
+ "service":"0x6767",
+ "instance":"0x1",
+ "unicast" : "10.0.3.2",
+ "unreliable":"40001",
+ "someip-tp" : {
+ "client-to-service": [ "0x6767", "0x8001" ]
+ }
+ }
+ ],
+ "max-payload-size-unreliable" : "8352",
+ "routing":"routingmanagerd",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.77.1",
+ "port":"30490",
+ "protocol":"udp",
+ "cyclic_offer_delay" : "1000"
+ }
+}
diff --git a/test/someip_tp_tests/someip_tp_test_master_starter.sh b/test/someip_tp_tests/someip_tp_test_master_starter.sh
new file mode 100755
index 0000000..20c8c2a
--- /dev/null
+++ b/test/someip_tp_tests/someip_tp_test_master_starter.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright (C) 2015-2019 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
+
+if [ $# -lt 1 ]
+then
+ echo "Please pass a test mode to this script."
+ echo "For example: $0 IN_SEQUENCE"
+ echo "Valid subscription types include:"
+ echo " [IN_SEQUENCE, MIXED, INCOMPLETE, DUPLICATE, OVERLAP, OVERLAP_FRONT_BACK]"
+ exit 1
+fi
+TESTMODE=$1
+export VSOMEIP_CONFIGURATION=someip_tp_test_master.json
+# start daemon
+../examples/routingmanagerd/./routingmanagerd &
+PID_VSOMEIPD=$!
+# Start the services
+./someip_tp_test_service $1 &
+PID_SERIVCE=$!
+
+sleep 1
+
+if [ ! -z "$USE_LXC_TEST" ]; then
+ echo "Waiting for 5s"
+ sleep 5
+ 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; ./someip_tp_test_msg_sender 10.0.3.1 10.0.3.2 $TESTMODE\"" &
+ echo "remote ssh pid: $!"
+elif [ ! -z "$USE_DOCKER" ]; then
+ echo "Waiting for 5s"
+ sleep 5
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./someip_tp_test_msg_sender 10.0.3.1 10.0.3.2 $TESTMODE" &
+else
+cat <<End-of-message
+*******************************************************************************
+*******************************************************************************
+** Please now run:
+** someip_tp_test_msg_sender 10.0.3.1 10.0.3.2 $TESTMODE
+** from an external host to successfully complete this test.
+**
+** You probably will need to adapt the 'unicast' settings in
+** someip_tp_test_master.json to your personal setup.
+*******************************************************************************
+*******************************************************************************
+End-of-message
+fi
+
+# Wait until all clients and services are finished
+for job in $PID_SERIVCE
+do
+ # Fail gets incremented if a client exits with a non-zero exit code
+ echo "waiting for $job"
+ wait $job || FAIL=$(($FAIL+1))
+done
+
+# kill the services
+kill $PID_VSOMEIPD
+sleep 1
+
+# Check if everything went well
+exit $FAIL
diff --git a/test/someip_tp_tests/someip_tp_test_msg_sender.cpp b/test/someip_tp_tests/someip_tp_test_msg_sender.cpp
new file mode 100644
index 0000000..c930acb
--- /dev/null
+++ b/test/someip_tp_tests/someip_tp_test_msg_sender.cpp
@@ -0,0 +1,1387 @@
+// Copyright (C) 2015-2017 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 <iostream>
+#include <memory>
+#include <thread>
+#include <chrono>
+#include <cstring>
+#include <future>
+#include <numeric>
+#include <random>
+#include <algorithm>
+#include <list>
+
+#ifndef _WIN32
+#include <arpa/inet.h>
+#endif
+
+#include <gtest/gtest.h>
+
+#include <boost/asio.hpp>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include "../../implementation/utility/include/byteorder.hpp"
+#include "../../implementation/message/include/deserializer.hpp"
+#include "../../implementation/message/include/serializer.hpp"
+#include "../../implementation/service_discovery/include/service_discovery.hpp"
+#include "../../implementation/service_discovery/include/message_impl.hpp"
+#include "../../implementation/service_discovery/include/constants.hpp"
+#include "../../implementation/service_discovery/include/enumeration_types.hpp"
+#include "../../implementation/service_discovery/include/eventgroupentry_impl.hpp"
+#include "../../implementation/service_discovery/include/serviceentry_impl.hpp"
+#include "../../implementation/message/include/message_impl.hpp"
+#include "../../implementation/service_discovery/include/option_impl.hpp"
+#include "../../implementation/service_discovery/include/ipv4_option_impl.hpp"
+#include "../../implementation/endpoints/include/tp.hpp"
+#include "../../implementation/endpoints/include/tp_reassembler.hpp"
+#include "../../implementation/message/include/payload_impl.hpp"
+
+#include "someip_tp_test_globals.hpp"
+
+static char* remote_address;
+static char* local_address;
+
+std::vector<someip_tp_test::test_mode_e> its_modes({
+ someip_tp_test::test_mode_e::IN_SEQUENCE,
+ someip_tp_test::test_mode_e::MIXED,
+ someip_tp_test::test_mode_e::INCOMPLETE,
+ someip_tp_test::test_mode_e::DUPLICATE,
+ someip_tp_test::test_mode_e::OVERLAP,
+ someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK,
+});
+
+class someip_tp : public ::testing::TestWithParam<someip_tp_test::test_mode_e> {
+public:
+ someip_tp() :
+ work_(std::make_shared<boost::asio::io_service::work>(io_)),
+ io_thread_(std::bind(&someip_tp::io_run, this)),
+ session_(0x0),
+ sd_session_(0x0),
+ address_remote_(boost::asio::ip::address::from_string(std::string(remote_address))),
+ address_local_(boost::asio::ip::address::from_string(std::string(local_address))),
+ runtime_(vsomeip::runtime::get()) {}
+protected:
+ void TearDown() {
+ work_.reset();
+ io_thread_.join();
+ io_.stop();
+ }
+
+ void call_shutdown_method() {
+ boost::system::error_code ec;
+ std::uint8_t shutdown_call[] = {
+ 0x45, 0x45, 0x45, 0x01,
+ 0x00, 0x00, 0x00, 0x08,
+ 0xDD, 0xDD, 0x00, 0x01,
+ 0x01, 0x00, 0x00, 0x00 };
+ boost::asio::ip::udp::socket::endpoint_type target_service(address_remote_,
+ 30001);
+ boost::asio::ip::udp::socket udp_socket2(io_, boost::asio::ip::udp::v4());
+ udp_socket2.send_to(boost::asio::buffer(shutdown_call), target_service);
+ udp_socket2.shutdown(boost::asio::socket_base::shutdown_both, ec);
+ udp_socket2.close(ec);
+ }
+
+ void io_run() {
+ io_.run();
+ }
+
+ void offer_service(boost::asio::ip::udp::socket* const _udp_socket) {
+ // offer the service
+ std::uint8_t its_offer_service_message[] = {
+ 0xff, 0xff, 0x81, 0x00,
+ 0x00, 0x00, 0x00, 0x30, // length
+ 0x00, 0x00, 0x00, 0x01,
+ 0x01, 0x01, 0x02, 0x00,
+ 0xc0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, // length entries array
+ 0x01, 0x00, 0x00, 0x20,
+ 0x67, 0x67, 0x00, 0x01, // service / instance
+ 0x00, 0xff, 0xff, 0xff, // major / ttl
+ 0x00, 0x00, 0x00, 0x00, // minor
+ 0x00, 0x00, 0x00, 0x0c, // length options array
+ 0x00, 0x09, 0x04, 0x00,
+ 0xff, 0xff, 0xff, 0xff, // slave address
+ 0x00, 0x11, 0x9c, 0x41,
+ };
+ std::memcpy(&its_offer_service_message[48], &address_local_.to_v4().to_bytes()[0], 4);
+ std::uint16_t its_session = htons(++sd_session_);
+ std::memcpy(&its_offer_service_message[10], &its_session, sizeof(its_session));
+
+ boost::asio::ip::udp::socket::endpoint_type target_sd(address_remote_,30490);
+ _udp_socket->send_to(boost::asio::buffer(its_offer_service_message), target_sd);
+ }
+
+ void subscribe_at_master(boost::asio::ip::udp::socket* const _udp_socket) {
+ std::uint8_t its_subscription[] = {
+ 0xff, 0xff, 0x81, 0x00,
+ 0x00, 0x00, 0x00, 0x30, // length
+ 0x00, 0x00, 0x00, 0x01,
+ 0x01, 0x01, 0x02, 0x00,
+ 0xc0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, // length entries array
+ 0x06, 0x00, 0x00, 0x10,
+ 0x45, 0x45, 0x00, 0x01, // service / instance
+ 0x00, 0xff, 0xff, 0xff, // major / ttl
+ 0x00, 0x00, 0x00, 0x01, // counter
+ 0x00, 0x00, 0x00, 0x0c, // length options array
+ 0x00, 0x09, 0x04, 0x00,
+ 0xff, 0xff, 0xff, 0xff, // slave address
+ 0x00, 0x11, 0x75, 0x31, // port 30001
+ };
+ std::memcpy(&its_subscription[48], &address_local_.to_v4().to_bytes()[0], 4);
+ std::uint16_t its_session = htons(++sd_session_);
+ std::memcpy(&its_subscription[10], &its_session, sizeof(its_session));
+
+ boost::asio::ip::udp::socket::endpoint_type target_sd(address_remote_,30490);
+ _udp_socket->send_to(boost::asio::buffer(its_subscription), target_sd);
+ }
+
+ /*
+ * @brief custom version of tp::tp_split_message with adjustable segment size
+ * needed to send overlapping segments within the 1392 byte segment size limit
+ */
+ vsomeip::tp::tp_split_messages_t split_message(const std::uint8_t * const _data,
+ std::uint32_t _size , std::uint32_t _segment_size) {
+ using namespace vsomeip::tp;
+ using namespace vsomeip;
+ tp_split_messages_t split_messages;
+
+ if (_size < VSOMEIP_MAX_UDP_MESSAGE_SIZE) {
+ std::cerr << __func__ << " called with size: " << std::dec << _size;
+ return split_messages;
+ }
+
+ const auto data_end = _data + _size;
+
+ for (auto current_offset = _data + 16; current_offset < data_end;) {
+ auto msg = std::make_shared<message_buffer_t>();
+ msg->reserve(VSOMEIP_FULL_HEADER_SIZE + sizeof(tp_header_t) + _segment_size);
+ // copy the header
+ msg->insert(msg->end(), _data, _data + VSOMEIP_FULL_HEADER_SIZE);
+ // change the message type
+ (*msg)[VSOMEIP_MESSAGE_TYPE_POS] = (*msg)[VSOMEIP_MESSAGE_TYPE_POS] | 0x20;
+ // check if last segment
+ const auto segment_end = current_offset + _segment_size;
+ const bool is_last_segment = (segment_end >= data_end);
+ // insert tp_header
+ const tp_header_t header = htonl(
+ static_cast<tp_header_t>((current_offset - VSOMEIP_FULL_HEADER_SIZE - _data)) |
+ static_cast<tp_header_t>((is_last_segment) ? 0x0u : 0x1u));
+
+ const byte_t * const headerp = reinterpret_cast<const byte_t*>(&header);
+ msg->insert(msg->end(), headerp, headerp + sizeof(tp_header_t));
+
+ // insert payload
+ if (is_last_segment) {
+ msg->insert(msg->end(), current_offset, data_end);
+ current_offset = data_end;
+ } else {
+ msg->insert(msg->end(), current_offset, segment_end);
+ current_offset += _segment_size;
+ }
+ // update length
+ const length_t its_length = static_cast<length_t>(msg->size()
+ - VSOMEIP_SOMEIP_HEADER_SIZE);
+ *(reinterpret_cast<length_t*>(&(*msg)[VSOMEIP_LENGTH_POS_MIN])) = htonl(its_length);
+ split_messages.emplace_back(std::move(msg));
+ }
+
+ return split_messages;
+ }
+
+ void create_fragments(std::uint32_t _count, vsomeip::service_t _service,
+ vsomeip::instance_t _instance,
+ vsomeip::method_t _method,
+ vsomeip::message_type_e _message_type,
+ vsomeip::client_t _client,
+ vsomeip::session_t _session,
+ std::vector<vsomeip::message_buffer_ptr_t>* _target,
+ std::uint32_t _segment_size) {
+ vsomeip::message_impl msg;
+ msg.set_reliable(false);
+ msg.set_service(_service);
+ msg.set_instance(_instance);
+ msg.set_method(_method);
+ msg.set_message_type(_message_type);
+ msg.set_return_code(vsomeip::return_code_e::E_OK);
+ if (_client == vsomeip::ANY_CLIENT) {
+ msg.set_client(0xDDDD);
+ } else {
+ msg.set_client(_client);
+ }
+ if (_session == 0xFFFF) {
+ msg.set_session(++session_);
+ } else {
+ msg.set_session(_session);
+ }
+ std::vector<vsomeip::byte_t> its_payload_data;
+ for (uint32_t i = 0; i < _count; i++) {
+ its_payload_data.resize((i * _segment_size) + _segment_size, static_cast<std::uint8_t>(i));
+ }
+ std::shared_ptr<vsomeip::payload> payload = std::make_shared<vsomeip::payload_impl>(its_payload_data);
+ msg.set_payload(payload);
+ vsomeip::serializer its_serializer(0);
+ msg.serialize(&its_serializer);
+
+ *_target = split_message(its_serializer.get_data(), its_serializer.get_size(), _segment_size);
+ its_serializer.reset();
+
+ }
+
+ vsomeip::message_buffer_t create_full_message(
+ const std::vector<vsomeip::message_buffer_ptr_t>& _fragments) {
+ auto its_reassembler = std::make_shared<vsomeip::tp::tp_reassembler>(
+ std::numeric_limits<std::uint32_t>::max(), io_);
+ vsomeip::message_buffer_t its_reassemlbed_msg;
+ for (const auto& frag : _fragments) {
+ const auto res = its_reassembler->process_tp_message(&(*frag)[0],
+ std::uint32_t(frag->size()), address_local_, 12345);
+ if (res.first) {
+ its_reassemlbed_msg = res.second;
+ }
+ }
+ its_reassembler->stop();
+ return its_reassemlbed_msg;
+ }
+
+ std::vector<int> create_shuffled_seqeuence(std::uint32_t _count) {
+ std::vector<int> its_indexes(_count);
+ std::iota(its_indexes.begin(), its_indexes.end(), 0);
+ std::random_device rd;
+ std::mt19937 its_twister(rd());
+ std::shuffle(its_indexes.begin(), its_indexes.end(), its_twister);
+ return its_indexes;
+ }
+ void increase_segment_back(const vsomeip::message_buffer_ptr_t& _seg,
+ std::uint32_t _amount) {
+ _seg->resize(_seg->size() + _amount, 0xff);
+ // update length
+ *(reinterpret_cast<vsomeip::length_t*>(&((*_seg)[VSOMEIP_LENGTH_POS_MIN]))) =
+ htonl(static_cast<vsomeip::length_t>(_seg->size() - VSOMEIP_SOMEIP_HEADER_SIZE));
+ }
+
+ void increase_segment_front(const vsomeip::message_buffer_ptr_t& _seg,
+ std::uint32_t _amount) {
+ // increase segment by amount
+ _seg->insert(_seg->begin() + VSOMEIP_TP_PAYLOAD_POS, _amount, 0xff);
+
+ // decrease offset by amount
+ const vsomeip::tp::tp_header_t its_tp_header = VSOMEIP_BYTES_TO_LONG(
+ (*_seg)[VSOMEIP_TP_HEADER_POS_MIN],
+ (*_seg)[VSOMEIP_TP_HEADER_POS_MIN + 1],
+ (*_seg)[VSOMEIP_TP_HEADER_POS_MIN + 2],
+ (*_seg)[VSOMEIP_TP_HEADER_POS_MAX]);
+ std::uint32_t its_offset = vsomeip::tp::tp::get_offset(its_tp_header);
+ its_offset -= _amount;
+ const vsomeip::tp::tp_header_t its_new_tp_header =
+ htonl(static_cast<vsomeip::tp::tp_header_t>(its_offset |
+ static_cast<vsomeip::tp::tp_header_t>(its_tp_header & 0x1)));
+ *(reinterpret_cast<vsomeip::tp::tp_header_t*>(
+ &((*_seg)[VSOMEIP_TP_HEADER_POS_MIN]))) = its_new_tp_header;
+
+ // update length
+ *(reinterpret_cast<vsomeip::length_t*>(&((*_seg)[VSOMEIP_LENGTH_POS_MIN]))) =
+ htonl(static_cast<vsomeip::length_t>(_seg->size() - VSOMEIP_SOMEIP_HEADER_SIZE));
+ }
+
+ void increase_segment_front_back(const vsomeip::message_buffer_ptr_t& _seg,
+ std::uint32_t _amount) {
+ increase_segment_front(_seg, _amount);
+ increase_segment_back(_seg, _amount);
+ }
+
+ void decrease_segment_back(const vsomeip::message_buffer_ptr_t& _seg,
+ std::uint32_t _amount) {
+ _seg->resize(_seg->size() - _amount, 0xff);
+ // update length
+ *(reinterpret_cast<vsomeip::length_t*>(&((*_seg)[VSOMEIP_LENGTH_POS_MIN]))) =
+ htonl(static_cast<vsomeip::length_t>(_seg->size() - VSOMEIP_SOMEIP_HEADER_SIZE));
+ }
+
+ void decrease_segment_front(const vsomeip::message_buffer_ptr_t& _seg,
+ std::uint32_t _amount) {
+ if (_amount % 16 != 0) {
+ std::cerr << __func__ << ":" << __LINE__ << std::endl;
+ return;
+ }
+ _seg->erase(_seg->begin() + VSOMEIP_TP_PAYLOAD_POS, _seg->begin() + VSOMEIP_TP_PAYLOAD_POS + _amount);
+ // increase offset by amount
+ const vsomeip::tp::tp_header_t its_tp_header = VSOMEIP_BYTES_TO_LONG(
+ (*_seg)[VSOMEIP_TP_HEADER_POS_MIN],
+ (*_seg)[VSOMEIP_TP_HEADER_POS_MIN + 1],
+ (*_seg)[VSOMEIP_TP_HEADER_POS_MIN + 2],
+ (*_seg)[VSOMEIP_TP_HEADER_POS_MAX]);
+ std::uint32_t its_offset = vsomeip::tp::tp::get_offset(its_tp_header);
+ its_offset += _amount;
+ const vsomeip::tp::tp_header_t its_new_tp_header =
+ htonl(static_cast<vsomeip::tp::tp_header_t>(its_offset |
+ static_cast<vsomeip::tp::tp_header_t>(its_tp_header & 0x1)));
+ *(reinterpret_cast<vsomeip::tp::tp_header_t*>(
+ &((*_seg)[VSOMEIP_TP_HEADER_POS_MIN]))) = its_new_tp_header;
+ // update length
+ *(reinterpret_cast<vsomeip::length_t*>(&((*_seg)[VSOMEIP_LENGTH_POS_MIN]))) =
+ htonl(static_cast<vsomeip::length_t>(_seg->size() - VSOMEIP_SOMEIP_HEADER_SIZE));
+ }
+
+ void decrease_segment_front_back(const vsomeip::message_buffer_ptr_t& _seg,
+ std::uint32_t _amount) {
+ if (_amount % 16 != 0) {
+ std::cerr << __func__ << ":" << __LINE__ << std::endl;
+ return;
+ }
+ decrease_segment_back(_seg, _amount);
+ decrease_segment_front(_seg, _amount);
+ }
+
+
+ enum order_e {
+ ASCENDING,
+ DESCENDING,
+ MIXED_PREDEFINED,
+ MIXED_RANDOM,
+ };
+
+ boost::asio::io_service io_;
+ std::shared_ptr<boost::asio::io_service::work> work_;
+ std::thread io_thread_;
+ std::vector<vsomeip::message_buffer_ptr_t> fragments_request_to_master_;
+ std::vector<vsomeip::message_buffer_ptr_t> fragments_response_of_master_;
+
+ std::vector<vsomeip::message_buffer_ptr_t> fragments_received_as_server_;
+ std::vector<vsomeip::message_buffer_ptr_t> fragments_response_to_master_;
+
+ std::vector<vsomeip::message_buffer_ptr_t> fragments_event_from_master_;
+ std::vector<vsomeip::message_buffer_ptr_t> fragments_event_to_master_;
+
+ std::atomic<std::uint16_t> session_;
+ std::atomic<std::uint16_t> sd_session_;
+ boost::asio::ip::address address_remote_;
+ boost::asio::ip::address address_local_;
+ std::shared_ptr<vsomeip::runtime> runtime_;
+ someip_tp_test::test_mode_e test_mode_ = GetParam();
+};
+
+INSTANTIATE_TEST_CASE_P(send_in_mode,
+ someip_tp,
+ ::testing::ValuesIn(its_modes));
+
+
+/*
+ * @test Send a big fragmented UDP request to the master and wait for the
+ * response. Check that the received response is the same as the request (server
+ * just echos the requests).
+ * Wait for a big fragmented UDP message request from the master and send back
+ * the response in the same size. Check that the request and response are
+ * identical.
+ * Do this two times one with fragments ordered ascending and one time descending.
+ * Wait for the master to subscribe and send back two big, fragmented
+ * notifications one with fragments ordered ascending and one descending
+ * Subscribe at master and wait for one fragmented event.
+ * With testmode INCOMPLETE incomplete fragments are send as well
+ * With testmode MIXED instead of ascending/descedning order the fragments are
+ * send in a predefined or in a random order
+ */
+TEST_P(someip_tp, send_in_mode)
+{
+ std::promise<void> remote_client_subscribed;
+ std::atomic<std::uint16_t> remote_client_subscription_port(0);
+ std::promise<void> offer_received;
+
+ std::mutex udp_sd_socket_mutex;
+ boost::asio::ip::udp::socket udp_sd_socket(io_,
+ boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490));
+
+ boost::asio::ip::udp::socket udp_client_socket(io_,
+ boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30001));
+
+ boost::asio::ip::udp::socket udp_server_socket(io_,
+ boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 40001));
+
+ std::thread sd_receive_thread([&](){
+ std::atomic<bool> keep_receiving(true);
+ std::vector<std::uint8_t> receive_buffer(4096);
+ std::vector<vsomeip::event_t> its_received_events;
+ std::atomic<bool> service_offered(false);
+ std::atomic<bool> client_subscribed(false);
+
+ // join the sd multicast group 224.0.77.1
+ udp_sd_socket.set_option(boost::asio::ip::multicast::join_group(
+ boost::asio::ip::address::from_string("224.0.77.1").to_v4()));
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_sd_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
+ if (error) {
+ keep_receiving = false;
+ ADD_FAILURE() << __func__ << " error: " << error.message();
+ return;
+ } else {
+ vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0);
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[VSOMEIP_METHOD_POS_MAX]);
+ if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
+ vsomeip::sd::message_impl sd_msg;
+ EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
+ EXPECT_EQ(1u, sd_msg.get_entries().size());
+ for (const auto& e : sd_msg.get_entries()) {
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP && !client_subscribed) {
+ EXPECT_TRUE(e->is_eventgroup_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP, e->get_type());
+ EXPECT_EQ(1,e->get_num_options(1));
+ EXPECT_EQ(std::uint32_t(0xFFFFFF), e->get_ttl());
+ EXPECT_EQ(someip_tp_test::service_slave.service_id, e->get_service());
+ EXPECT_EQ(someip_tp_test::service_slave.instance_id, e->get_instance());
+ EXPECT_EQ(1u, sd_msg.get_options().size());
+ if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP) {
+ std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
+ EXPECT_EQ(someip_tp_test::service_slave.eventgroup_id,
+ its_casted_entry->get_eventgroup());
+ std::shared_ptr<vsomeip::sd::option_impl> its_option =
+ sd_msg.get_options().at(its_casted_entry->get_options(1)[0]);
+ EXPECT_TRUE(its_option > 0);
+ if(its_option->get_type() == vsomeip::sd::option_type_e::IP4_ENDPOINT) {
+ std::shared_ptr<vsomeip::sd::ipv4_option_impl> its_ipv4_option =
+ std::dynamic_pointer_cast<vsomeip::sd::ipv4_option_impl> (its_option);
+ EXPECT_TRUE(its_ipv4_option > 0);
+ EXPECT_EQ(vsomeip::sd::layer_four_protocol_e::UDP, its_ipv4_option->get_layer_four_protocol());
+ EXPECT_EQ(address_remote_,
+ boost::asio::ip::address(
+ boost::asio::ip::address_v4(its_ipv4_option->get_address())));
+ remote_client_subscription_port = its_ipv4_option->get_port();
+ }
+ std::vector<vsomeip::byte_t> its_sub_ack(&receive_buffer[0], &receive_buffer[0] + VSOMEIP_FULL_HEADER_SIZE + 8 + (sd_msg.get_entries().size() * 16));
+ its_sub_ack[24] = static_cast<vsomeip::byte_t>(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK);
+ // fix length
+ const std::uint32_t its_length = htonl(static_cast<std::uint32_t>(its_sub_ack.size()) - VSOMEIP_SOMEIP_HEADER_SIZE);
+ std::memcpy(&its_sub_ack[4], &its_length, sizeof(its_length));
+ // set number of options to zero
+ its_sub_ack[27] = 0x0;
+ // update session
+ std::uint16_t its_session = htons(++sd_session_);
+ std::memcpy(&its_sub_ack[10], &its_session, sizeof(its_session));
+ boost::asio::ip::udp::socket::endpoint_type target_sd(address_remote_,30490);
+ {
+ std::lock_guard<std::mutex> its_lock(udp_sd_socket_mutex);
+ udp_sd_socket.send_to(boost::asio::buffer(its_sub_ack), target_sd);
+ }
+ std::cout << __LINE__ << ": master subscribed" << std::endl;
+ remote_client_subscribed.set_value();
+ client_subscribed = true;
+ }
+ } else if (e->get_type() == vsomeip::sd::entry_type_e::OFFER_SERVICE && !service_offered) {
+ EXPECT_TRUE(e->is_service_entry());
+ EXPECT_EQ(vsomeip::sd::entry_type_e::OFFER_SERVICE, e->get_type());
+ EXPECT_EQ(1u,e->get_num_options(1));
+ EXPECT_EQ(std::uint32_t(0xFFFFFF), e->get_ttl());
+ EXPECT_EQ(someip_tp_test::service.service_id, e->get_service());
+ EXPECT_EQ(someip_tp_test::service.instance_id, e->get_instance());
+ EXPECT_EQ(1u, sd_msg.get_options().size());
+ if (e->get_type() == vsomeip::sd::entry_type_e::OFFER_SERVICE) {
+ std::shared_ptr<vsomeip::sd::serviceentry_impl> its_casted_entry =
+ std::static_pointer_cast<vsomeip::sd::serviceentry_impl>(e);
+ EXPECT_EQ(0u, its_casted_entry->get_minor_version());
+ }
+ offer_received.set_value();
+ service_offered = true;
+ }
+ }
+ if (service_offered && client_subscribed) {
+ keep_receiving = false;
+ }
+ } else {
+ ADD_FAILURE() << " received non-sd message";
+ return;
+ }
+ }
+ }
+ });
+
+ std::thread send_thread([&]() {
+ boost::system::error_code ec;
+ try {
+
+ // wait until a offer was received
+ if (std::future_status::timeout == offer_received.get_future().wait_for(std::chrono::seconds(10))) {
+ ADD_FAILURE() << "Didn't receive offer within time";
+ return;
+ }
+
+ {
+ std::lock_guard<std::mutex> its_lock(udp_sd_socket_mutex);
+ subscribe_at_master(&udp_sd_socket);
+ }
+
+ std::mutex all_fragments_received_mutex_;
+ std::condition_variable all_fragments_received_cond_;
+ bool wait_for_all_response_fragments_received_(true);
+ std::uint32_t received_responses(0);
+ bool wait_for_all_event_fragments_received_(true);
+
+ std::thread udp_client_receive_thread([&]() {
+ bool keep_receiving(true);
+ std::vector<std::uint8_t> receive_buffer(4096);
+ while (keep_receiving) {
+ boost::system::error_code error;
+ std::size_t bytes_transferred = udp_client_socket.receive(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), 0, error);
+ if (error) {
+ keep_receiving = false;
+ ADD_FAILURE() << __func__ << " error: " << error.message();
+ return;
+ } else {
+ std::uint32_t its_pos = 0;
+
+ while (bytes_transferred > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ std::cout << __LINE__ << ": received response " << its_message_size << std::endl;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
+ EXPECT_EQ(someip_tp_test::service.service_id, msg.get_service());
+ } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ std::cout << __LINE__ << ": received event" << std::endl;
+ } else if (vsomeip::tp::tp::tp_flag_is_set(receive_buffer[its_pos + VSOMEIP_MESSAGE_TYPE_POS]) &&
+ vsomeip::tp::tp::tp_flag_unset(receive_buffer[its_pos + VSOMEIP_MESSAGE_TYPE_POS]) == vsomeip::message_type_e::MT_RESPONSE) {
+ EXPECT_EQ(someip_tp_test::service.service_id, its_service);
+ EXPECT_EQ(someip_tp_test::service.method_id, its_method);
+ auto its_buffer = std::make_shared<vsomeip::message_buffer_t>(&receive_buffer[its_pos], &receive_buffer[its_pos] + its_message_size);
+
+ fragments_response_of_master_.push_back(its_buffer);
+ if (fragments_response_of_master_.size() == someip_tp_test::number_of_fragments) {
+ std::lock_guard<std::mutex> its_lock(all_fragments_received_mutex_);
+ wait_for_all_response_fragments_received_ = false;
+ std::cout << __LINE__ << ": received all response fragments as client" << std::endl;
+ all_fragments_received_cond_.notify_one();
+ if (++received_responses == 2 && !wait_for_all_event_fragments_received_) {
+ std::cout << __LINE__ << ": received all responses as client --> Finished" << std::endl;
+ keep_receiving = false;
+ }
+ }
+ } else if (vsomeip::tp::tp::tp_flag_is_set(receive_buffer[its_pos + VSOMEIP_MESSAGE_TYPE_POS]) &&
+ vsomeip::tp::tp::tp_flag_unset(receive_buffer[its_pos + VSOMEIP_MESSAGE_TYPE_POS]) == vsomeip::message_type_e::MT_NOTIFICATION) {
+ std::cout << __LINE__ << ": received event fragment" << std::endl;
+ EXPECT_EQ(someip_tp_test::service.service_id, its_service);
+ EXPECT_EQ(someip_tp_test::service.event_id, its_method);
+ auto its_buffer = std::make_shared<vsomeip::message_buffer_t>(&receive_buffer[its_pos], &receive_buffer[its_pos] + its_message_size);
+ fragments_event_from_master_.push_back(its_buffer);
+ if (fragments_event_from_master_.size() == someip_tp_test::number_of_fragments) {
+ std::lock_guard<std::mutex> its_lock(all_fragments_received_mutex_);
+ wait_for_all_event_fragments_received_ = false;
+ std::cout << __LINE__ << ": received all event fragments as client --> Finished" << std::endl;
+ all_fragments_received_cond_.notify_one();
+ if (received_responses == 2) {
+ keep_receiving = false;
+ }
+ }
+
+ }
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+ }
+ }
+ }
+ });
+
+ // send SOMEI-TP message fragmented into 6 parts to service:
+ boost::asio::ip::udp::socket::endpoint_type target_service(address_remote_, 30001);
+
+ std::unique_lock<std::mutex> its_lock(all_fragments_received_mutex_);
+ for (const order_e mode : {order_e::ASCENDING, order_e::DESCENDING}) {
+ create_fragments(someip_tp_test::number_of_fragments, someip_tp_test::service.service_id,
+ someip_tp_test::service.instance_id,
+ someip_tp_test::service.method_id,
+ vsomeip::message_type_e::MT_REQUEST,
+ vsomeip::ANY_CLIENT, 0xffff,
+ &fragments_request_to_master_,
+ (test_mode_ == someip_tp_test::test_mode_e::OVERLAP ||
+ test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) ?
+ vsomeip::tp::tp::tp_max_segment_length_ - 160 :
+ vsomeip::tp::tp::tp_max_segment_length_);
+ if (mode == order_e::ASCENDING) {
+ if (test_mode_ == someip_tp_test::test_mode_e::MIXED) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ } else {
+ auto its_indexes = {4, 1, 3, 5, 2, 0};
+ std::cout << __LINE__ << ": using following predefined sequence to send request to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ for (int i : its_indexes) {
+ udp_client_socket.send_to(boost::asio::buffer(*fragments_request_to_master_[i]), target_service);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ } else {
+ auto its_indexes = {0,1,3,5,2,4};
+ std::cout << __LINE__ << ": using following predefined sequence to send request to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ // increase third segment by 16 byte at front and back
+ increase_segment_front_back(fragments_request_to_master_[2], 16);
+ increase_segment_front(fragments_request_to_master_[4], 16);
+ for (int i : its_indexes) {
+ udp_client_socket.send_to(boost::asio::buffer(*fragments_request_to_master_[i]), target_service);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::DUPLICATE) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ for (auto iter = fragments_request_to_master_.begin();
+ iter != fragments_request_to_master_.end(); iter++) {
+ udp_client_socket.send_to(boost::asio::buffer(*(*iter)), target_service);
+ // send insert 2nd fragment twice
+ if (iter == fragments_request_to_master_.begin() + 1) {
+ udp_client_socket.send_to(boost::asio::buffer(*(*iter)), target_service);
+ }
+ }
+ } else {
+ if (test_mode_ == someip_tp_test::test_mode_e::INCOMPLETE) {
+ if (someip_tp_test::number_of_fragments < 3) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // send a request fragment with a different session ID first
+ vsomeip::message_buffer_t msg_incomplete(*fragments_request_to_master_[2]);
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0x33;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0x33;
+ udp_client_socket.send_to(boost::asio::buffer(msg_incomplete), target_service);
+ // send a request from a different src port as well to test cleanup
+ boost::asio::ip::udp::socket udp_client_socket2(io_,
+ boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30004));
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0xcc;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0xcc;
+ udp_client_socket2.send_to(boost::asio::buffer(msg_incomplete), target_service);
+ boost::system::error_code ec;
+ udp_client_socket2.shutdown(boost::asio::socket_base::shutdown_both, ec);
+ udp_client_socket2.close(ec);
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ increase_segment_back(fragments_request_to_master_[1], 16);
+ }
+ for (const auto& fragment : fragments_request_to_master_) {
+ udp_client_socket.send_to(boost::asio::buffer(*fragment), target_service);
+ }
+ }
+ } else if (mode == order_e::DESCENDING) {
+ if (test_mode_ == someip_tp_test::test_mode_e::MIXED) {
+ std::vector<int> its_indexes = create_shuffled_seqeuence(someip_tp_test::number_of_fragments);
+ std::cout << __LINE__ << ": using following random sequence to send request to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ for (int i : its_indexes) {
+ udp_client_socket.send_to(boost::asio::buffer(*fragments_request_to_master_[i]), target_service);
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ } else {
+ auto its_indexes = {5,3,2,4,1,0};
+ std::cout << __LINE__ << ": using following predefined sequence to send request to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ // increase third segment by 16 byte at front and back
+ increase_segment_front_back(fragments_request_to_master_[4], 16);
+ for (int i : its_indexes) {
+ udp_client_socket.send_to(boost::asio::buffer(*fragments_request_to_master_[i]), target_service);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::DUPLICATE) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ for (auto iter = fragments_request_to_master_.rbegin();
+ iter != fragments_request_to_master_.rend(); iter++) {
+ udp_client_socket.send_to(boost::asio::buffer(*(*iter)), target_service);
+ // send insert 2nd last fragment twice
+ if (iter == fragments_request_to_master_.rbegin() + 1) {
+ udp_client_socket.send_to(boost::asio::buffer(*(*iter)), target_service);
+ }
+ }
+ } else {
+ if (test_mode_ == someip_tp_test::test_mode_e::INCOMPLETE) {
+ if (someip_tp_test::number_of_fragments < 4) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // send a request fragment with a different session ID first
+ vsomeip::message_buffer_t msg_incomplete(*fragments_request_to_master_[3]);
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0x77;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0x77;
+ udp_client_socket.send_to(boost::asio::buffer(msg_incomplete), target_service);
+
+ // send a request from a different src port as well to test cleanup
+ boost::asio::ip::udp::socket udp_client_socket2(io_,
+ boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30005));
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0xdd;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0xdd;
+ udp_client_socket2.send_to(boost::asio::buffer(msg_incomplete), target_service);
+ boost::system::error_code ec;
+ udp_client_socket2.shutdown(boost::asio::socket_base::shutdown_both, ec);
+ udp_client_socket2.close(ec);
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (someip_tp_test::number_of_fragments < 5) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // increase second last segment by 16 byte
+ increase_segment_back(fragments_request_to_master_[4], 16);
+ }
+ for (auto iter = fragments_request_to_master_.rbegin(); iter != fragments_request_to_master_.rend(); iter++) {
+ udp_client_socket.send_to(boost::asio::buffer(*(*iter)), target_service);
+ }
+ }
+ }
+ {
+ while (wait_for_all_response_fragments_received_) {
+ if (std::cv_status::timeout ==
+ all_fragments_received_cond_.wait_for(its_lock,
+ std::chrono::seconds(20))) {
+ ADD_FAILURE() << "Didn't receive response to"
+ " fragmented message within time: " << std::uint32_t(mode);
+ return;
+ } else {
+ EXPECT_EQ(someip_tp_test::number_of_fragments, fragments_request_to_master_.size());
+ // create complete message from request
+ if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (mode == ASCENDING) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // decrease second segment by 16 byte
+ decrease_segment_back(fragments_request_to_master_[1], 16);
+ } else if (mode == DESCENDING) {
+ if (someip_tp_test::number_of_fragments < 5) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // decrease fourth segment by 16 byte
+ decrease_segment_back(fragments_request_to_master_[4], 16);
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ // remove the additional inserted bytes which weren't accepted on
+ // test masterside as they were overlapping
+ if (mode == ASCENDING) {
+ decrease_segment_front_back(fragments_request_to_master_[2], 16);
+ decrease_segment_front(fragments_request_to_master_[4], 16);
+ } else {
+ decrease_segment_front_back(fragments_request_to_master_[4], 16);
+ }
+ }
+ vsomeip::message_buffer_t its_request = create_full_message(fragments_request_to_master_);
+ if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP ||
+ test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ EXPECT_EQ(VSOMEIP_FULL_HEADER_SIZE +
+ someip_tp_test::number_of_fragments * (someip_tp_test::max_segment_size - 160),
+ its_request.size());
+ } else {
+ EXPECT_EQ(VSOMEIP_FULL_HEADER_SIZE +
+ someip_tp_test::number_of_fragments * someip_tp_test::max_segment_size,
+ its_request.size());
+ }
+ if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP && mode == ASCENDING) {
+ // response contains the additional 16 bytes of 2nd fragment instead
+ // of beginning of the 3rd fragment
+ for (std::uint32_t i = 0; i < 16; i++) {
+ its_request[VSOMEIP_PAYLOAD_POS + 2 * (someip_tp_test::max_segment_size - 160) + i] = 0xff;
+ }
+ }
+
+ // create complete message from response
+ vsomeip::message_buffer_t its_response = create_full_message(fragments_response_of_master_);
+ if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP ||
+ test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ EXPECT_EQ(VSOMEIP_FULL_HEADER_SIZE +
+ someip_tp_test::number_of_fragments * (someip_tp_test::max_segment_size - 160),
+ its_response.size());
+ } else {
+ EXPECT_EQ(VSOMEIP_FULL_HEADER_SIZE +
+ someip_tp_test::number_of_fragments * someip_tp_test::max_segment_size,
+ its_response.size());
+ }
+ // change message type of response to request again
+ its_response[VSOMEIP_MESSAGE_TYPE_POS] = static_cast<vsomeip::byte_t>(vsomeip::message_type_e::MT_REQUEST);
+ // request and response should now be equal
+ EXPECT_EQ(its_response.size(), its_request.size());
+ EXPECT_EQ(its_response, its_request);
+ EXPECT_EQ(0, std::memcmp(static_cast<void*>(&its_response[0]),
+ static_cast<void*>(&its_request[0]),
+ its_response.size()));
+ fragments_response_of_master_.clear();
+ }
+ }
+ wait_for_all_response_fragments_received_ = true;
+ }
+ fragments_request_to_master_.clear();
+ }
+
+ while (wait_for_all_event_fragments_received_) {
+ if (std::cv_status::timeout ==
+ all_fragments_received_cond_.wait_for(its_lock,
+ std::chrono::seconds(20))) {
+ ADD_FAILURE() << "Didn't receive fragmented event from "
+ " master within time";
+ }
+ }
+ // check if received event is correct
+ {
+ EXPECT_EQ(someip_tp_test::number_of_fragments, fragments_event_from_master_.size());
+ // create complete message from event
+ vsomeip::message_buffer_t its_event = create_full_message(fragments_event_from_master_);
+ vsomeip::session_t its_event_session =
+ VSOMEIP_BYTES_TO_WORD(its_event[VSOMEIP_SESSION_POS_MIN],
+ its_event[VSOMEIP_SESSION_POS_MAX]);
+
+ std::vector<vsomeip::message_buffer_ptr_t> its_cmp_event_fragments;
+ create_fragments(someip_tp_test::number_of_fragments,
+ someip_tp_test::service.service_id,
+ someip_tp_test::service.instance_id,
+ someip_tp_test::service.event_id,
+ vsomeip::message_type_e::MT_NOTIFICATION,
+ 0x0, its_event_session, &its_cmp_event_fragments,
+ (test_mode_ == someip_tp_test::test_mode_e::OVERLAP) ?
+ vsomeip::tp::tp::tp_max_segment_length_ - 160 :
+ vsomeip::tp::tp::tp_max_segment_length_);
+ vsomeip::message_buffer_t its_cmp_event = create_full_message(its_cmp_event_fragments);
+ EXPECT_EQ(its_cmp_event.size(), its_event.size());
+ EXPECT_EQ(its_cmp_event, its_event);
+ EXPECT_EQ(0, std::memcmp(static_cast<void*>(&its_cmp_event[0]),
+ static_cast<void*>(&its_event[0]),
+ its_cmp_event.size()));
+ }
+ its_lock.unlock();
+ udp_client_receive_thread.join();
+ } catch (const std::exception& _e) {
+ ADD_FAILURE() << "catched exception: " << _e.what();
+ }
+ });
+
+ std::mutex all_fragments_received_as_server_mutex_;
+ std::unique_lock<std::mutex> all_fragments_received_as_server_lock(all_fragments_received_as_server_mutex_);
+ std::condition_variable all_fragments_received_as_server_cond_;
+ bool wait_for_all_fragments_received_as_server_(true);
+ std::atomic<std::uint16_t> remote_client_request_port(0);
+
+ std::thread udp_server_send_thread([&]() {
+ // wait until client subscribed
+ if (std::future_status::timeout == remote_client_subscribed.get_future().wait_for(std::chrono::seconds(10))) {
+ ADD_FAILURE() << "Client didn't subscribe within time";
+ return;
+ }
+
+ // send fragmented event to the master
+ boost::asio::ip::udp::socket::endpoint_type master_client(address_remote_, remote_client_subscription_port);
+ for (const order_e mode : {order_e::ASCENDING, order_e::DESCENDING}) {
+ create_fragments(someip_tp_test::number_of_fragments,
+ someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id,
+ someip_tp_test::service_slave.event_id,
+ vsomeip::message_type_e::MT_NOTIFICATION,
+ vsomeip::ANY_CLIENT, 0xffff,
+ &fragments_event_to_master_,
+ (test_mode_ == someip_tp_test::test_mode_e::OVERLAP ||
+ test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) ?
+ vsomeip::tp::tp::tp_max_segment_length_ - 160 :
+ vsomeip::tp::tp::tp_max_segment_length_);
+ if (mode == order_e::ASCENDING) {
+ if (test_mode_ == someip_tp_test::test_mode_e::MIXED) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ } else {
+ auto its_indexes = {2, 3, 5, 1, 4, 0};
+ std::cout << __LINE__ << ": using following predefined sequence to send event to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ for (int i : its_indexes) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragments_event_to_master_[i]), master_client);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ } else {
+ auto its_indexes = {0,2,4,5,1,3};
+ std::cout << __LINE__ << ": using following predefined sequence to send event to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ // increase second segment by 16 byte at front and back
+ increase_segment_front_back(fragments_event_to_master_[1], 16);
+ increase_segment_front(fragments_event_to_master_[3], 16);
+
+ for (int i : its_indexes) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragments_event_to_master_[i]), master_client);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::DUPLICATE) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ for (auto iter = fragments_event_to_master_.begin();
+ iter != fragments_event_to_master_.end(); iter++) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ // send insert 2nd fragment twice
+ if (iter == fragments_event_to_master_.begin() + 1) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ // send oversized fragment as well
+ increase_segment_back(*iter, 4);
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ decrease_segment_back(*iter, 4);
+ }
+ }
+ } else {
+ if (test_mode_ == someip_tp_test::test_mode_e::INCOMPLETE) {
+ if (someip_tp_test::number_of_fragments < 3) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // send an event fragment with a different session ID first
+ vsomeip::message_buffer_t msg_incomplete(*fragments_event_to_master_[2]);
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0x44;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0x44;
+ udp_server_socket.send_to(boost::asio::buffer(msg_incomplete), master_client);
+ // send a request with a different service ID as well to test cleanup
+ msg_incomplete[VSOMEIP_SERVICE_POS_MIN] = 0xdd;
+ msg_incomplete[VSOMEIP_SERVICE_POS_MAX] = 0xdd;
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0xdd;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0xdd;
+ udp_server_socket.send_to(boost::asio::buffer(msg_incomplete), master_client);
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // increase second segment by 16 byte
+ increase_segment_back(fragments_event_to_master_[1], 16);
+
+ // send one oversize message as well
+ std::vector<vsomeip::message_buffer_ptr_t> oversized_event;
+ create_fragments(someip_tp_test::number_of_fragments + 1,
+ someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id,
+ someip_tp_test::service_slave.event_id,
+ vsomeip::message_type_e::MT_NOTIFICATION,
+ vsomeip::ANY_CLIENT, 0xffff,
+ &oversized_event,
+ vsomeip::tp::tp::tp_max_segment_length_);
+ for (const auto& fragment : oversized_event) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragment), master_client);
+ }
+ }
+ for (const auto& fragment : fragments_event_to_master_) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragment), master_client);
+ }
+ }
+ } else if (mode == order_e::DESCENDING) {
+ if (test_mode_ == someip_tp_test::test_mode_e::MIXED) {
+ std::vector<int> its_indexes = create_shuffled_seqeuence(someip_tp_test::number_of_fragments);
+ std::cout << __LINE__ << ": using following random sequence to send event to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ for ( int i : its_indexes) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragments_event_to_master_[i]), master_client);
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ } else {
+ auto its_indexes = {5,3,2,1,0,4};
+ std::cout << __LINE__ << ": using following predefined sequence to send event to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ // increase second last segment by 16 byte at front and back
+ increase_segment_front_back(fragments_event_to_master_[4], 16);
+ // update length
+ *(reinterpret_cast<vsomeip::length_t*>(&((*fragments_event_to_master_[4])[VSOMEIP_LENGTH_POS_MIN]))) =
+ htonl(static_cast<vsomeip::length_t>(fragments_event_to_master_[4]->size() - VSOMEIP_SOMEIP_HEADER_SIZE));
+ for (int i : its_indexes) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragments_event_to_master_[i]), master_client);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::DUPLICATE) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ for (auto iter = fragments_event_to_master_.rbegin();
+ iter != fragments_event_to_master_.rend(); iter++) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ // send insert 2nd last fragment twice
+ if (iter == fragments_event_to_master_.rbegin() + 1) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ }
+ }
+ } else {
+ if (test_mode_ == someip_tp_test::test_mode_e::INCOMPLETE) {
+ if (someip_tp_test::number_of_fragments < 4) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // send an event fragment with a different session ID first
+ vsomeip::message_buffer_t msg_incomplete(*fragments_event_to_master_[3]);
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0x55;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0x55;
+ udp_server_socket.send_to(boost::asio::buffer(msg_incomplete), master_client);
+ // send a request with a different service ID as well to test cleanup
+ msg_incomplete[VSOMEIP_SERVICE_POS_MIN] = 0xbb;
+ msg_incomplete[VSOMEIP_SERVICE_POS_MAX] = 0xbb;
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0xbb;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0xbb;
+ udp_server_socket.send_to(boost::asio::buffer(msg_incomplete), master_client);
+
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (someip_tp_test::number_of_fragments < 5) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // increase second last segment by 16 byte
+ increase_segment_back(fragments_event_to_master_[4], 16);
+ }
+ for (auto iter = fragments_event_to_master_.rbegin(); iter != fragments_event_to_master_.rend(); iter++) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ }
+ }
+ }
+ std::cout << __LINE__ << ": send event to master " << std::uint32_t(mode) << std::endl;
+ }
+
+ for (const order_e mode : {order_e::ASCENDING, order_e::DESCENDING}) {
+ while (wait_for_all_fragments_received_as_server_) {
+ if (std::cv_status::timeout ==
+ all_fragments_received_as_server_cond_.wait_for(all_fragments_received_as_server_lock,
+ std::chrono::seconds(20))) {
+ ADD_FAILURE() << "Didn't receive request from client within time: " << std::uint32_t(mode);
+ return;
+ } else {
+ EXPECT_EQ(someip_tp_test::number_of_fragments, fragments_received_as_server_.size());
+ // create complete message from request of client
+ vsomeip::message_buffer_t its_request = create_full_message(fragments_received_as_server_);
+ if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP ||
+ test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ EXPECT_EQ(VSOMEIP_FULL_HEADER_SIZE +
+ someip_tp_test::number_of_fragments * (someip_tp_test::max_segment_size - 160),
+ its_request.size());
+ } else {
+ EXPECT_EQ(VSOMEIP_FULL_HEADER_SIZE +
+ someip_tp_test::number_of_fragments * someip_tp_test::max_segment_size,
+ its_request.size());
+ }
+ const vsomeip::client_t its_request_client =
+ VSOMEIP_BYTES_TO_WORD(its_request[VSOMEIP_CLIENT_POS_MIN],
+ its_request[VSOMEIP_CLIENT_POS_MAX]);
+ const vsomeip::session_t its_request_session =
+ VSOMEIP_BYTES_TO_WORD(its_request[VSOMEIP_SESSION_POS_MIN],
+ its_request[VSOMEIP_SESSION_POS_MAX]);
+ create_fragments(someip_tp_test::number_of_fragments,
+ someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id,
+ someip_tp_test::service_slave.method_id,
+ vsomeip::message_type_e::MT_RESPONSE,
+ its_request_client,
+ its_request_session,
+ &fragments_response_to_master_,
+ (test_mode_ == someip_tp_test::test_mode_e::OVERLAP ||
+ test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) ?
+ vsomeip::tp::tp::tp_max_segment_length_ - 160:
+ vsomeip::tp::tp::tp_max_segment_length_);
+ // create complete message from response
+ vsomeip::message_buffer_t its_response = create_full_message(fragments_response_to_master_);
+ // change the message type of the response to request for comparison
+ its_response[VSOMEIP_MESSAGE_TYPE_POS] = static_cast<vsomeip::byte_t>(vsomeip::message_type_e::MT_REQUEST);
+
+ EXPECT_EQ(its_response.size(), its_request.size());
+ EXPECT_EQ(its_response, its_request);
+ EXPECT_EQ(0, std::memcmp(static_cast<void*>(&its_response[0]),
+ static_cast<void*>(&its_request[0]),
+ its_response.size()));
+ // send back response
+ fragments_received_as_server_.clear();
+ EXPECT_GT(remote_client_request_port, 0);
+ boost::asio::ip::udp::socket::endpoint_type master_client(address_remote_, remote_client_request_port);
+ if (mode == order_e::ASCENDING) {
+ if (test_mode_ == someip_tp_test::test_mode_e::MIXED) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ } else {
+ auto its_indexes = {4,2,0,1,3,5};
+ std::cout << __LINE__ << ": using following predefined sequence to send back response to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ for (int i : its_indexes) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragments_response_to_master_[i]), master_client);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ } else {
+ auto its_indexes = {0,2,4,3,5,1};
+ std::cout << __LINE__ << ": using following predefined sequence to send response to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ // increase fourth segment by 16 byte at front and back
+ increase_segment_front_back(fragments_response_to_master_[3], 16);
+ increase_segment_front(fragments_response_to_master_[1], 16);
+ for (int i : its_indexes) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragments_response_to_master_[i]), master_client);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::DUPLICATE) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ for (auto iter = fragments_response_to_master_.begin();
+ iter != fragments_response_to_master_.end(); iter++) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ // send 2nd fragment twice
+ if (iter == fragments_response_to_master_.begin() + 1) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ // send a fragment with invalid segment size as well
+ decrease_segment_back(*iter, 16);
+ increase_segment_back(*iter, 7);
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ increase_segment_back(*iter, 9);
+ }
+ }
+ } else {
+ if (test_mode_ == someip_tp_test::test_mode_e::INCOMPLETE) {
+ if (someip_tp_test::number_of_fragments < 5) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // send an event fragment with a different session ID first
+ vsomeip::message_buffer_t msg_incomplete(*fragments_response_to_master_[4]);
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0x99;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0x99;
+ udp_server_socket.send_to(boost::asio::buffer(msg_incomplete), master_client);
+ // send a request with a different service ID as well to test cleanup
+ msg_incomplete[VSOMEIP_SERVICE_POS_MIN] = 0xaa;
+ msg_incomplete[VSOMEIP_SERVICE_POS_MAX] = 0xaa;
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0xaa;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0xaa;
+ udp_server_socket.send_to(boost::asio::buffer(msg_incomplete), master_client);
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // increase second segment by 16 byte
+ increase_segment_back(fragments_response_to_master_[1], 16);
+ }
+ for (const auto& frag : fragments_response_to_master_) {
+ udp_server_socket.send_to(boost::asio::buffer(*frag), master_client);
+ }
+ }
+ } else if (mode == order_e::DESCENDING) {
+ if (test_mode_ == someip_tp_test::test_mode_e::MIXED) {
+ std::vector<int> its_indexes = create_shuffled_seqeuence(someip_tp_test::number_of_fragments);
+ std::cout << __LINE__ << ": using following random sequence to send back response to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ for ( int i : its_indexes) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragments_response_to_master_[i]), master_client);
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) {
+ if (someip_tp_test::number_of_fragments != 6) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ } else {
+ auto its_indexes = {5,3,2,1,4,0};
+ std::cout << __LINE__ << ": using following predefined sequence to send response to master: ";
+ for (auto i : its_indexes) { std::cout << i << ", "; }
+ std::cout << std::endl;
+ // increase fith segment by 16 byte at front and back
+ increase_segment_front_back(fragments_response_to_master_[4], 16);
+ for (int i : its_indexes) {
+ udp_server_socket.send_to(boost::asio::buffer(*fragments_response_to_master_[i]), master_client);
+ }
+ }
+ } else if (test_mode_ == someip_tp_test::test_mode_e::DUPLICATE) {
+ if (someip_tp_test::number_of_fragments < 2) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ for (auto iter = fragments_response_to_master_.rbegin();
+ iter != fragments_response_to_master_.rend(); iter++) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ // send insert 2nd last fragment twice
+ if (iter == fragments_response_to_master_.rbegin() + 1) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ }
+ }
+ } else {
+ if (test_mode_ == someip_tp_test::test_mode_e::INCOMPLETE) {
+ if (someip_tp_test::number_of_fragments < 4) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // send an event fragment with a different session ID first
+ vsomeip::message_buffer_t msg_incomplete(*fragments_response_to_master_[3]);
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0x66;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0x66;
+ udp_server_socket.send_to(boost::asio::buffer(msg_incomplete), master_client);
+ // send a request with a different service ID as well to test cleanup
+ msg_incomplete[VSOMEIP_SERVICE_POS_MIN] = 0xef;
+ msg_incomplete[VSOMEIP_SERVICE_POS_MAX] = 0xef;
+ msg_incomplete[VSOMEIP_SESSION_POS_MIN] = 0xef;
+ msg_incomplete[VSOMEIP_SESSION_POS_MAX] = 0xef;
+ udp_server_socket.send_to(boost::asio::buffer(msg_incomplete), master_client);
+ } else if (test_mode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (someip_tp_test::number_of_fragments < 5) {
+ ADD_FAILURE() << "line: " << __LINE__ << " needs adaption as number_of_fragments changed";
+ return;
+ }
+ // increase second last segment by 16 byte
+ increase_segment_back(fragments_response_to_master_[4], 16);
+ }
+ for (auto iter = fragments_response_to_master_.rbegin();
+ iter != fragments_response_to_master_.rend(); iter++) {
+ udp_server_socket.send_to(boost::asio::buffer(*(*iter)), master_client);
+ }
+ }
+ }
+ }
+ }
+ wait_for_all_fragments_received_as_server_ = true;
+ }
+ });
+
+ std::thread udp_server_receive_thread([&]() {
+ {
+ std::lock_guard<std::mutex> its_lock(udp_sd_socket_mutex);
+ offer_service(&udp_sd_socket);
+ }
+
+ bool keep_receiving(true);
+ std::vector<std::uint8_t> receive_buffer(4096);
+ while (keep_receiving) {
+ boost::system::error_code error;
+ boost::asio::ip::udp::socket::endpoint_type its_remote_endpoint;
+ std::size_t bytes_transferred = udp_server_socket.receive_from(
+ boost::asio::buffer(receive_buffer, receive_buffer.capacity()), its_remote_endpoint, 0, error);
+ if (error) {
+ keep_receiving = false;
+ ADD_FAILURE() << __func__ << " error: " << error.message();
+ return;
+ } else {
+ remote_client_request_port = its_remote_endpoint.port();
+ std::uint32_t its_pos = 0;
+ while (bytes_transferred > 0) {
+ const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG(
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2],
+ receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE;
+ std::cout << __LINE__ << ": received request from master " << its_message_size << std::endl;
+ vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0);
+
+ vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]);
+ vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN],
+ receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]);
+ EXPECT_EQ(someip_tp_test::service_slave.service_id, its_service);
+ EXPECT_EQ(someip_tp_test::service_slave.method_id, its_method);
+ vsomeip::message_impl msg;
+ EXPECT_TRUE(msg.deserialize(&its_deserializer));
+ if (vsomeip::tp::tp::tp_flag_is_set(receive_buffer[its_pos + VSOMEIP_MESSAGE_TYPE_POS])) {
+ auto its_buffer = std::make_shared<vsomeip::message_buffer_t>(&receive_buffer[its_pos], &receive_buffer[its_pos] + its_message_size);
+
+ fragments_received_as_server_.push_back(its_buffer);
+ if (fragments_received_as_server_.size() == someip_tp_test::number_of_fragments) {
+ std::lock_guard<std::mutex> its_lock(all_fragments_received_as_server_mutex_);
+ wait_for_all_fragments_received_as_server_ = false;
+ std::cout << __LINE__ << ": received all fragments as server" << std::endl;
+ all_fragments_received_as_server_cond_.notify_one();
+ static int received_requests = 0;
+ if (++received_requests == 2) {
+ std::cout << __LINE__ << ": received all requests as server --> Finished" << std::endl;
+ keep_receiving = false;
+ }
+ }
+ }
+ its_pos += its_message_size;
+ bytes_transferred -= its_message_size;
+ }
+ }
+ }
+ });
+
+ send_thread.join();
+ sd_receive_thread.join();
+ udp_server_receive_thread.join();
+ udp_server_send_thread.join();
+
+ if (test_mode_ == someip_tp_test::test_mode_e::INCOMPLETE) {
+ std::cout << "Sleeping to let cleanup for unfinished TP message "
+ "trigger on master side..." << std::endl;
+ std::this_thread::sleep_for(std::chrono::seconds(11));
+ }
+ // shutdown the server
+ call_shutdown_method();
+
+ boost::system::error_code ec;
+ udp_sd_socket.shutdown(boost::asio::socket_base::shutdown_both, ec);
+ udp_sd_socket.close(ec);
+ udp_client_socket.shutdown(boost::asio::socket_base::shutdown_both, ec);
+ udp_client_socket.close(ec);
+ udp_server_socket.shutdown(boost::asio::socket_base::shutdown_both, ec);
+ udp_server_socket.close(ec);
+}
+
+#ifndef _WIN32
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ if(argc < 3) {
+ std::cerr << "Please pass an target, local IP address and test mode to this binary like: "
+ << argv[0] << " 10.0.3.1 10.0.3.202 TP_IN_SEQUENCE" << std::endl;
+ std::cerr << "Testmodes are [ IN_SEQUENCE, MIXED, INCOMPLETE, OVERLAP, OVERLAP_FRONT_BACK ]" << std::endl;
+ } else {
+ remote_address = argv[1];
+ local_address = argv[2];
+ std::string its_testmode = argv[3];
+ if (its_testmode == std::string("IN_SEQUENCE")) {
+ ::testing::GTEST_FLAG(filter) = "*send_in_mode/0";
+ } else if (its_testmode == std::string("MIXED")) {
+ ::testing::GTEST_FLAG(filter) = "*send_in_mode/1";
+ } else if (its_testmode == std::string("INCOMPLETE")) {
+ ::testing::GTEST_FLAG(filter) = "*send_in_mode/2";
+ } else if (its_testmode == std::string("DUPLICATE")) {
+ ::testing::GTEST_FLAG(filter) = "*send_in_mode/3";
+ } else if (its_testmode == std::string("OVERLAP")) {
+ ::testing::GTEST_FLAG(filter) = "*send_in_mode/4";
+ } else if (its_testmode == std::string("OVERLAP_FRONT_BACK")) {
+ ::testing::GTEST_FLAG(filter) = "*send_in_mode/5";
+ }
+ }
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/someip_tp_tests/someip_tp_test_service.cpp b/test/someip_tp_tests/someip_tp_test_service.cpp
new file mode 100644
index 0000000..dd94b6c
--- /dev/null
+++ b/test/someip_tp_tests/someip_tp_test_service.cpp
@@ -0,0 +1,412 @@
+// Copyright (C) 2014-2019 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 <chrono>
+#include <condition_variable>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <thread>
+#include <map>
+#include <algorithm>
+#include <atomic>
+#include <future>
+#include <cstring>
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+#include <vsomeip/internal/logger.hpp>
+#include "../../implementation/endpoints/include/tp.hpp"
+
+#include "someip_tp_test_globals.hpp"
+
+class someip_tp_test_service {
+public:
+ someip_tp_test_service(struct someip_tp_test::service_info _service_info, someip_tp_test::test_mode_e _testmode) :
+ service_info_(_service_info),
+ testmode_(_testmode),
+ app_(vsomeip::runtime::get()->create_application("someip_tp_test_service")),
+ wait_until_registered_(true),
+ wait_until_shutdown_method_called_(true),
+ wait_for_slave_subscription_(true),
+ number_notifications_of_slave_(0x0),
+ wait_for_slave_service_available_(true),
+ wait_for_two_responses_of_slave_(true),
+ number_responses_of_slave_(0),
+ wait_for_two_requests_of_slave_(true),
+ number_requests_from_slave_(0),
+ wait_for_two_notifications_of_slave_(true),
+ offer_thread_(std::bind(&someip_tp_test_service::run, this)) {
+ if (!app_->init()) {
+ ADD_FAILURE() << "Couldn't initialize application";
+ return;
+ }
+ app_->register_state_handler(
+ std::bind(&someip_tp_test_service::on_state, this,
+ std::placeholders::_1));
+
+ // offer field
+ std::set<vsomeip::eventgroup_t> its_eventgroups;
+ its_eventgroups.insert(_service_info.eventgroup_id);
+ app_->offer_event(service_info_.service_id, service_info_.instance_id,
+ service_info_.event_id, its_eventgroups,
+ vsomeip::event_type_e::ET_EVENT, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
+
+ app_->register_message_handler(vsomeip::ANY_SERVICE,
+ vsomeip::ANY_INSTANCE, service_info_.shutdown_method_id,
+ std::bind(&someip_tp_test_service::on_shutdown_method_called, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(vsomeip::ANY_SERVICE,
+ vsomeip::ANY_INSTANCE, service_info_.notify_method_id,
+ std::bind(&someip_tp_test_service::on_notify_method_called, this,
+ std::placeholders::_1));
+ app_->register_message_handler(vsomeip::ANY_SERVICE,
+ vsomeip::ANY_INSTANCE, service_info_.method_id,
+ std::bind(&someip_tp_test_service::on_message, this,
+ std::placeholders::_1));
+
+ app_->register_async_subscription_handler(service_info_.service_id,
+ 0x1, service_info_.eventgroup_id,
+ std::bind(&someip_tp_test_service::subscription_handler_async,
+ this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
+ std::placeholders::_4, std::placeholders::_5));
+
+ // request remote service
+ app_->request_service(someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id);
+ its_eventgroups.clear();
+ its_eventgroups.insert(someip_tp_test::service_slave.eventgroup_id);
+ app_->request_event(someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id,
+ someip_tp_test::service_slave.event_id, its_eventgroups,
+ vsomeip::event_type_e::ET_EVENT);
+ app_->register_message_handler(someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id,
+ someip_tp_test::service_slave.event_id,
+ std::bind(&someip_tp_test_service::on_notification, this,
+ std::placeholders::_1));
+ app_->subscribe(someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id,
+ someip_tp_test::service_slave.eventgroup_id, 0x0,
+ someip_tp_test::service_slave.event_id);
+ app_->register_availability_handler(someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id,
+ std::bind(&someip_tp_test_service::on_availability, this,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+ app_->register_message_handler(
+ someip_tp_test::service_slave.service_id,
+ someip_tp_test::service_slave.instance_id,
+ someip_tp_test::service_slave.method_id,
+ std::bind(&someip_tp_test_service::on_response_from_slave, this,
+ std::placeholders::_1));
+ app_->start();
+ }
+
+ ~someip_tp_test_service() {
+ offer_thread_.join();
+ }
+
+ void offer() {
+ app_->offer_service(service_info_.service_id, 0x1);
+ }
+
+ void stop() {
+ app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
+ app_->clear_all_handler();
+ app_->stop();
+ }
+
+ void on_state(vsomeip::state_type_e _state) {
+ VSOMEIP_INFO << "Application " << app_->get_name() << " is "
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ?
+ "registered." : "deregistered.");
+
+ if (_state == vsomeip::state_type_e::ST_REGISTERED) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_registered_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _available) {
+ if (_service == someip_tp_test::service_slave.service_id &&
+ _instance == someip_tp_test::service_slave.instance_id &&
+ _available) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_for_slave_service_available_ = false;
+ condition_.notify_one();
+ VSOMEIP_INFO << "Service available Service/Instance ["
+ << std::setw(4) << std::setfill('0') << std::hex << _service << "/"
+ << std::setw(4) << std::setfill('0') << std::hex << _instance << "]";
+ }
+ }
+
+ void on_message(const std::shared_ptr<vsomeip::message>& _message) {
+ VSOMEIP_INFO << "Received a message with Client/Session ["
+ << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex << _message->get_session()
+ << "] size: " << std::dec << _message->get_payload()->get_length();
+ auto response = vsomeip::runtime::get()->create_response(_message);
+ auto payload = vsomeip::runtime::get()->create_payload(_message->get_payload()->get_data(), _message->get_payload()->get_length());
+ response->set_payload(payload);
+ app_->send(response);
+ if (++number_requests_from_slave_ == 2) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_for_two_requests_of_slave_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_notification(const std::shared_ptr<vsomeip::message>& _message) {
+ VSOMEIP_INFO << "Received a notification with Client/Session ["
+ << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex << _message->get_session()
+ << "] size: " << std::dec << _message->get_payload()->get_length();
+ EXPECT_EQ(someip_tp_test::service_slave.service_id, _message->get_service());
+ EXPECT_EQ(someip_tp_test::service_slave.event_id, _message->get_method());
+ std::vector<vsomeip::byte_t> its_cmp_data =
+ generate_payload(someip_tp_test::number_of_fragments,
+ (testmode_ == someip_tp_test::test_mode_e::OVERLAP
+ || testmode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) ?
+ someip_tp_test::max_segment_size - 160 :
+ someip_tp_test::max_segment_size);
+
+ std::vector<vsomeip::byte_t> its_rcv_data(_message->get_payload()->get_data(),
+ _message->get_payload()->get_data() + _message->get_payload()->get_length());
+ EXPECT_EQ(its_cmp_data.size(), its_rcv_data.size());
+ if (testmode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (number_notifications_of_slave_ == 0) { //ASCENDING with 2nd segment too big
+ for (std::uint32_t i = 0; i < 16; i++) {
+ its_cmp_data[2 * (someip_tp_test::max_segment_size - 160) + i] = 0xff;
+ }
+ } else if (number_notifications_of_slave_ == 1) {
+ // DESCENDING with 2nd last segment too big
+ // no action as successive 4 byte at end of message would
+ // overwrite the beginning of the last segment which was received first
+ }
+ }
+ EXPECT_EQ(its_cmp_data, its_rcv_data);
+ EXPECT_EQ(0, std::memcmp(static_cast<void*>(&its_cmp_data[0]),
+ static_cast<void*>(&its_rcv_data[0]),
+ its_cmp_data.size()));
+ if (++number_notifications_of_slave_ == 2) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_for_two_notifications_of_slave_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
+ app_->send(vsomeip::runtime::get()->create_response(_message));
+ VSOMEIP_WARNING << "************************************************************";
+ VSOMEIP_WARNING << "Shutdown method called -> going down!";
+ VSOMEIP_WARNING << "************************************************************";
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_shutdown_method_called_ = false;
+ condition_.notify_one();
+ }
+
+ void on_notify_method_called(const std::shared_ptr<vsomeip::message> &_message) {
+ (void)_message;
+ std::vector<vsomeip::byte_t> its_data = generate_payload(someip_tp_test::number_of_fragments,
+ (testmode_ == someip_tp_test::test_mode_e::OVERLAP) ?
+ someip_tp_test::max_segment_size - 160 :
+ someip_tp_test::max_segment_size);
+ std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()->create_payload();
+ its_payload->set_data(its_data);
+ app_->notify(service_info_.service_id, service_info_.instance_id,
+ service_info_.event_id, its_payload);
+ VSOMEIP_INFO << __func__ << " send event";
+ notify_method_called_.set_value(true);
+ }
+
+ void send_fragmented_request_to_slave() {
+ auto its_req = vsomeip::runtime::get()->create_request();
+ its_req->set_service(someip_tp_test::service_slave.service_id);
+ its_req->set_instance(someip_tp_test::service_slave.instance_id);
+ its_req->set_method(someip_tp_test::service_slave.method_id);
+ std::vector<vsomeip::byte_t> its_data = generate_payload(someip_tp_test::number_of_fragments,
+ (testmode_ == someip_tp_test::test_mode_e::OVERLAP
+ || testmode_ == someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK) ?
+ someip_tp_test::max_segment_size - 160 :
+ someip_tp_test::max_segment_size);
+ auto its_payload = vsomeip::runtime::get()->create_payload();
+ its_payload->set_data(its_data);
+ its_req->set_payload(its_payload);
+ request_send_to_slave_ = its_req;
+ app_->send(its_req);
+ }
+
+ void on_response_from_slave(const std::shared_ptr<vsomeip::message> &_message) {
+ VSOMEIP_INFO << "Received a response from the slave with Client/Session ["
+ << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex << _message->get_session()
+ << "] size: " << std::dec << _message->get_payload()->get_length();
+ EXPECT_EQ(someip_tp_test::service_slave.service_id, _message->get_service());
+ EXPECT_EQ(someip_tp_test::service_slave.instance_id, _message->get_instance());
+ EXPECT_EQ(someip_tp_test::service_slave.method_id, _message->get_method());
+ std::vector<vsomeip::byte_t> its_resp_payload(_message->get_payload()->get_data(),
+ _message->get_payload()->get_data() + _message->get_payload()->get_length());
+ std::vector<vsomeip::byte_t> its_req_payload(request_send_to_slave_->get_payload()->get_data(),
+ request_send_to_slave_->get_payload()->get_data() + request_send_to_slave_->get_payload()->get_length());
+ if (testmode_ == someip_tp_test::test_mode_e::OVERLAP) {
+ if (number_responses_of_slave_ == 0) { //ASCENDING with 2nd segment too big
+ for (std::uint32_t i = 0; i < 16; i++) {
+ its_req_payload[2 * (someip_tp_test::max_segment_size - 160) + i] = 0xff;
+ }
+ } else if (number_responses_of_slave_ == 1) {
+ // DESCENDING with 2nd last segment too big
+ // no action as successive 4 byte at end of message would
+ // overwrite the beginning of the last segment which was received first
+ }
+ }
+
+ EXPECT_EQ(its_req_payload.size(), its_resp_payload.size());
+ EXPECT_EQ(its_req_payload, its_resp_payload);
+ EXPECT_EQ(0, std::memcmp(static_cast<void*>(&its_req_payload[0]),
+ static_cast<void*>(&its_resp_payload[0]),
+ its_req_payload.size()));
+
+ if (++number_responses_of_slave_ < 2) {
+ send_fragmented_request_to_slave();
+ } else {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_for_two_responses_of_slave_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ std::vector<vsomeip::byte_t> generate_payload(std::uint32_t _number_of_fragments,
+ std::uint32_t _segment_size) {
+ std::vector<vsomeip::byte_t> its_data;
+ for (std::uint32_t i = 0; i < _number_of_fragments; i++) {
+ its_data.resize((i * _segment_size) + _segment_size,
+ static_cast<std::uint8_t>(i));
+ }
+ return its_data;
+ }
+
+ void run() {
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Running";
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (wait_until_registered_) {
+ condition_.wait(its_lock);
+ }
+
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Offering";
+ offer();
+
+ while (wait_for_slave_service_available_) {
+ condition_.wait(its_lock);
+ }
+ send_fragmented_request_to_slave();
+
+ while (wait_for_two_responses_of_slave_) {
+ condition_.wait(its_lock);
+ }
+ EXPECT_EQ(2u, number_responses_of_slave_);
+
+ while (wait_for_two_requests_of_slave_) {
+ condition_.wait(its_lock);
+ }
+ EXPECT_EQ(2u, number_requests_from_slave_);
+
+ while (wait_for_two_notifications_of_slave_) {
+ condition_.wait(its_lock);
+ }
+ EXPECT_EQ(2u, number_notifications_of_slave_);
+
+ while (wait_for_slave_subscription_) {
+ condition_.wait(its_lock);
+ }
+ // slave subscribed --> sent a notification
+ on_notify_method_called(vsomeip::runtime::get()->create_message());
+
+ while (wait_until_shutdown_method_called_) {
+ condition_.wait(its_lock);
+ }
+ stop();
+ }
+
+ void subscription_handler_async(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid,
+ bool _subscribed, const std::function<void(const bool)>& _cbk) {
+ (void)_uid;
+ (void)_gid;
+ VSOMEIP_WARNING << __func__ << " " << std::hex << _client << " subscribed." << _subscribed;
+ static int was_called = 0;
+ was_called++;
+ EXPECT_EQ(1, was_called);
+ EXPECT_TRUE(_subscribed);
+ _cbk(true);
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_for_slave_subscription_ = false;
+ condition_.notify_one();
+ }
+
+
+private:
+ struct someip_tp_test::service_info service_info_;
+ someip_tp_test::test_mode_e testmode_;
+ std::shared_ptr<vsomeip::application> app_;
+
+ bool wait_until_registered_;
+ bool wait_until_shutdown_method_called_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ std::atomic<bool> wait_for_slave_subscription_;
+ std::atomic<std::uint32_t> number_notifications_of_slave_;
+ std::promise<bool> notify_method_called_;
+ bool wait_for_slave_service_available_;
+ bool wait_for_two_responses_of_slave_;
+ std::uint32_t number_responses_of_slave_;
+ bool wait_for_two_requests_of_slave_;
+ std::uint32_t number_requests_from_slave_;
+ bool wait_for_two_notifications_of_slave_;
+ std::shared_ptr<vsomeip::message> request_send_to_slave_;
+ std::thread offer_thread_;
+};
+
+someip_tp_test::test_mode_e its_testmode(someip_tp_test::test_mode_e::IN_SEQUENCE);
+
+TEST(someip_someip_tp_test, echo_requests)
+{
+ someip_tp_test_service its_sample(someip_tp_test::service, its_testmode);
+}
+
+
+#ifndef _WIN32
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ if (argc < 2) {
+ std::cerr << "Please pass a test mode to this binary like: "
+ << argv[0] << " IN_SEQUENCE" << std::endl;
+ std::cerr << "Testmodes are [ IN_SEQUENCE, MIXED, INCOMPLETE, DUPLICATE, OVERLAP, OVERLAP_FRONT_BACK ]" << std::endl;
+ exit(1);
+ }
+
+ std::string its_pased_testmode = argv[1];
+ if (its_pased_testmode == std::string("IN_SEQUENCE")) {
+ its_testmode = someip_tp_test::test_mode_e::IN_SEQUENCE;
+ } else if (its_pased_testmode == std::string("MIXED")) {
+ its_testmode = someip_tp_test::test_mode_e::MIXED;
+ } else if (its_pased_testmode == std::string("INCOMPLETE")) {
+ its_testmode = someip_tp_test::test_mode_e::INCOMPLETE;
+ } else if (its_pased_testmode == std::string("DUPLICATE")) {
+ its_testmode = someip_tp_test::test_mode_e::DUPLICATE;
+ } else if (its_pased_testmode == std::string("OVERLAP")) {
+ its_testmode = someip_tp_test::test_mode_e::OVERLAP;
+ } else if (its_pased_testmode == std::string("OVERLAP_FRONT_BACK")) {
+ its_testmode = someip_tp_test::test_mode_e::OVERLAP_FRONT_BACK;
+ }
+
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh b/test/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh
index c551b55..a9adfe0 100755
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh
+++ b/test/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh
@@ -10,70 +10,47 @@
# the testcase simply executes this script. This script then runs the services
# and checks that all exit successfully.
-if [ $# -lt 2 ]
+if [ $# -lt 1 ]
then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP subscribe_notify_one_test_diff_client_ids_diff_ports_master.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
echo "Please pass a json file to this script."
- echo "For example: $0 UDP subscribe_notify_one_test_diff_client_ids_diff_ports_master.json"
- exit 1
-fi
-
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $1 ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
+ echo "For example: $0 subscribe_notify_one_test_diff_client_ids_diff_ports_master.json"
exit 1
fi
# replace master with slave to be able display the correct json file to be used
# with the slave script
-MASTER_JSON_FILE=$2
+MASTER_JSON_FILE=$1
CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave}
FAIL=0
# Start the services
export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_one
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 1 $1 &
+export VSOMEIP_CONFIGURATION=$MASTER_JSON_FILE
+./subscribe_notify_one_test_service 1 &
export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_two
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 2 $1 &
+export VSOMEIP_CONFIGURATION=$MASTER_JSON_FILE
+./subscribe_notify_one_test_service 2 &
export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_three
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 3 $1 &
+export VSOMEIP_CONFIGURATION=$MASTER_JSON_FILE
+./subscribe_notify_one_test_service 3 &
sleep 1
if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting subscribe_notify_one_test_slave_starter.sh on slave LXC with parameters $1 $CLIENT_JSON_FILE"
- 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/test; ./subscribe_notify_one_test_slave_starter.sh $1 $CLIENT_JSON_FILE\"" &
+ echo "starting subscribe_notify_one_test_slave_starter.sh on slave LXC with parameters $CLIENT_JSON_FILE"
+ 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; ./subscribe_notify_one_test_slave_starter.sh $CLIENT_JSON_FILE\"" &
echo "remote ssh job id: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name snotms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./subscribe_notify_one_test_slave_starter.sh $1 $CLIENT_JSON_FILE" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./subscribe_notify_one_test_slave_starter.sh $CLIENT_JSON_FILE" &
else
cat <<End-of-message
*******************************************************************************
*******************************************************************************
** Please now run:
-** subscribe_notify_one_test_slave_starter.sh $1 $CLIENT_JSON_FILE
+** subscribe_notify_one_test_slave_starter.sh $CLIENT_JSON_FILE
** from an external host to successfully complete this test.
**
** You probably will need to adapt the 'unicast' settings in
@@ -92,11 +69,6 @@ do
wait $job || ((FAIL+=1))
done
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop snotms
- docker rm snotms
-fi
-
# Check if both exited successfully
if [ $FAIL -eq 0 ]
then
diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
index f738b38..923ba1c 100644
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
+++ b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
@@ -17,17 +17,15 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "subscribe_notify_one_test_globals.hpp"
class subscribe_notify_one_test_service {
public:
- subscribe_notify_one_test_service(struct subscribe_notify_one_test::service_info _service_info,
- vsomeip::subscription_type_e _subscription_type) :
+ subscribe_notify_one_test_service(struct subscribe_notify_one_test::service_info _service_info) :
service_info_(_service_info),
- subscription_type_(_subscription_type),
app_(vsomeip::runtime::get()->create_application()),
wait_until_registered_(true),
wait_until_other_services_available_(true),
@@ -51,7 +49,9 @@ public:
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(service_info_.eventgroup_id);
app_->offer_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, false);
+ service_info_.event_id, its_eventgroups, vsomeip::event_type_e::ET_SELECTIVE_EVENT,
+ std::chrono::milliseconds::zero(), false, true, nullptr,
+ vsomeip::reliability_type_e::RT_UNKNOWN);
app_->register_message_handler(service_info_.service_id,
service_info_.instance_id, service_info_.method_id,
@@ -63,7 +63,8 @@ public:
app_->register_subscription_handler(service_info_.service_id,
service_info_.instance_id, service_info_.eventgroup_id,
std::bind(&subscribe_notify_one_test_service::on_subscription, this,
- std::placeholders::_1, std::placeholders::_2));
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, std::placeholders::_4));
// register availability for all other services and request their event.
for(const auto& i : subscribe_notify_one_test::service_infos) {
@@ -81,19 +82,19 @@ public:
std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3));
- app_->request_service(i.service_id, i.instance_id, vsomeip::DEFAULT_MAJOR, vsomeip::DEFAULT_MINOR, true);
+ app_->request_service(i.service_id, i.instance_id, vsomeip::DEFAULT_MAJOR, vsomeip::DEFAULT_MINOR);
auto handler = std::bind(&subscribe_notify_one_test_service::on_subscription_state_change, this,
std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, std::placeholders::_4, std::placeholders::_5);
- app_->register_subscription_status_handler(i.service_id, i.instance_id, i.eventgroup_id, vsomeip::ANY_EVENT, handler, true);
+ app_->register_subscription_status_handler(i.service_id, i.instance_id, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
app_->register_subscription_status_handler(vsomeip::ANY_SERVICE, i.instance_id, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
app_->register_subscription_status_handler(i.service_id, vsomeip::ANY_INSTANCE, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
app_->register_subscription_status_handler(vsomeip::ANY_SERVICE, vsomeip::ANY_INSTANCE, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(i.eventgroup_id);
- app_->request_event(i.service_id, i.instance_id, i.event_id, its_eventgroups, false);
+ app_->request_event(i.service_id, i.instance_id, i.event_id, its_eventgroups, vsomeip::event_type_e::ET_SELECTIVE_EVENT);
other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
other_services_received_notification_[std::make_pair(i.service_id, i.method_id)] = 0;
@@ -112,11 +113,12 @@ public:
}
void stop_offer() {
+ app_->stop_offer_event(service_info_.service_id, service_info_.instance_id, service_info_.event_id);
app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
}
void on_state(vsomeip::state_type_e _state) {
- VSOMEIP_INFO << "Application " << app_->get_name() << " is "
+ VSOMEIP_DEBUG << "Application " << app_->get_name() << " is "
<< (_state == vsomeip::state_type_e::ST_REGISTERED ?
"registered." : "deregistered.");
@@ -134,7 +136,7 @@ public:
if(its_service != other_services_available_.end()) {
if(its_service->second != _is_available) {
its_service->second = true;
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
<< service_info_.service_id << "] Service ["
<< std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
<< "] is available.";
@@ -164,14 +166,18 @@ public:
subscription_state_handler_called_++;
} else {
subscription_error_occured_ = true;
- VSOMEIP_WARNING << std::hex << app_->get_client()
+ VSOMEIP_ERROR << std::hex << app_->get_client()
<< " : on_subscription_state_change: for service " << std::hex
<< _service << " received a subscription error!";
}
+
}
- bool on_subscription(vsomeip::client_t _client, bool _subscribed) {
+ bool on_subscription(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid, bool _subscribed) {
+ (void)_uid;
+ (void)_gid;
std::lock_guard<std::mutex> its_subscribers_lock(subscribers_mutex_);
+
// check if all other services have subscribed:
// -1 for placeholder in array and -1 for the service itself
if (subscribers_.size() == subscribe_notify_one_test::service_infos.size() - 2) {
@@ -187,9 +193,10 @@ public:
VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
<< service_info_.service_id << "] " << "Client: " << _client
<< " subscribed, now have " << std::dec << subscribers_.size()
- << " subscribers" ;
+ << " subscribers. Expecting " << std::dec
+ << subscribe_notify_one_test::service_infos.size() - 2;
- if(subscribers_.size() == subscribe_notify_one_test::service_infos.size() - 2)
+ if (subscribers_.size() == subscribe_notify_one_test::service_infos.size() - 2)
{
// notify the notify thread to start sending out notifications
std::lock_guard<std::mutex> its_lock(notify_mutex_);
@@ -212,7 +219,7 @@ public:
}
void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
+ if (_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
other_services_received_notification_[std::make_pair(_message->get_service(),
_message->get_method())]++;
@@ -229,21 +236,7 @@ public:
<< std::dec << other_services_received_notification_[std::make_pair(_message->get_service(),
_message->get_method())] << ")";
-
- bool notify(false);
- switch(subscription_type_) {
- case vsomeip::subscription_type_e::SU_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_RELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE:
- if (all_notifications_received()) {
- notify = true;
- }
- break;
- }
-
- if(notify) {
+ if (all_notifications_received()) {
std::lock_guard<std::mutex> its_lock(stop_mutex_);
wait_for_stop_ = false;
stop_condition_.notify_one();
@@ -319,7 +312,7 @@ public:
++subscribe_count;
app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_);
+ vsomeip::DEFAULT_MAJOR);
VSOMEIP_DEBUG << "[" << std::hex << service_info_.service_id
<< "] subscribing to Service/Instance/Eventgroup ["
@@ -342,7 +335,7 @@ public:
// 4 * subscribe count cause we installed three additional wild-card handlers
ASSERT_EQ(subscribe_count * 4, subscription_state_handler_called_);
} else {
- VSOMEIP_WARNING << "Subscription state handler check skipped: CallCount="
+ VSOMEIP_ERROR << "Subscription state handler check skipped: CallCount="
<< std::dec << subscription_state_handler_called_;
}
}
@@ -360,9 +353,6 @@ public:
// on the remote node
std::this_thread::sleep_for(std::chrono::milliseconds(500));
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Starting to notify";
-
for(uint32_t i = 0; i < subscribe_notify_one_test::notifications_to_send; i++) {
std::shared_ptr<vsomeip::payload> its_payload =
vsomeip::runtime::get()->create_payload();
@@ -389,7 +379,7 @@ public:
while (wait_for_stop_) {
stop_condition_.wait(its_lock);
}
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
<< service_info_.service_id
<< "] Received notifications from all other services, going down";
@@ -426,8 +416,8 @@ public:
|| (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
continue;
}
- app_->register_subscription_status_handler(i.service_id, i.instance_id,
- i.eventgroup_id, vsomeip::ANY_EVENT, nullptr);
+ app_->unregister_subscription_status_handler(i.service_id, i.instance_id,
+ i.eventgroup_id, vsomeip::ANY_EVENT);
app_->unsubscribe(i.service_id, i.instance_id, i.eventgroup_id);
app_->release_event(i.service_id, i.instance_id, i.event_id);
app_->release_service(i.service_id, i.instance_id);
@@ -439,7 +429,6 @@ public:
private:
subscribe_notify_one_test::service_info service_info_;
- vsomeip::subscription_type_e subscription_type_;
std::shared_ptr<vsomeip::application> app_;
std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_notification_;
@@ -468,45 +457,25 @@ private:
std::mutex subscribers_mutex_;
};
-static int service_number;
-static vsomeip::subscription_type_e subscription_type;
+static unsigned long service_number;
TEST(someip_subscribe_notify_one_test, send_ten_notifications_to_service)
{
subscribe_notify_one_test_service its_sample(
- subscribe_notify_one_test::service_infos[service_number], subscription_type);
+ subscribe_notify_one_test::service_infos[service_number]);
}
#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
- if(argc < 3) {
+ if(argc < 2) {
std::cerr << "Please specify a service number and subscription type, like: " << argv[0] << " 2 UDP" << std::endl;
std::cerr << "Valid service numbers are in the range of [1,6]" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
return 1;
}
- service_number = std::stoi(std::string(argv[1]), nullptr);
-
- if(std::string("TCP_AND_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE;
- } else if(std::string("PREFER_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE;
- } else if(std::string("PREFER_TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_RELIABLE;
- } else if(std::string("UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_UNRELIABLE;
- } else if(std::string("TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE;
- } else {
- std::cerr << "Wrong subscription type passed, exiting" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- return 1;
- }
+ service_number = std::stoul(std::string(argv[1]), nullptr);
return RUN_ALL_TESTS();
}
#endif
diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh b/test/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh
index 47d0b2d..10014ae 100755
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh
+++ b/test/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh
@@ -10,49 +10,25 @@
# the testcase simply executes this script. This script then runs the services
# and checks that all exit successfully.
-if [ $# -lt 2 ]
+if [ $# -lt 1 ]
then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
echo "Please pass a json file to this script."
- echo "For example: $0 UDP subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json"
+ echo "For example: $0 subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json"
exit 1
fi
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $1 ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
-
FAIL=0
# Start the services
export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_four
-export VSOMEIP_CONFIGURATION=$2
+export VSOMEIP_CONFIGURATION=$1
./subscribe_notify_one_test_service 4 $1 &
export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_five
-export VSOMEIP_CONFIGURATION=$2
+export VSOMEIP_CONFIGURATION=$1
./subscribe_notify_one_test_service 5 $1 &
export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_six
-export VSOMEIP_CONFIGURATION=$2
+export VSOMEIP_CONFIGURATION=$1
./subscribe_notify_one_test_service 6 $1 &
# Wait until all applications are finished
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in
index 785bec0..99bf69a 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in
@@ -31,56 +31,29 @@
{
"service":"0x1111",
"instance":"0x0001",
- "unreliable":"30001",
"reliable":
{
"port":"40001",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x2222",
"instance":"0x0001",
- "unreliable":"30002",
"reliable":
{
"port":"40002",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x3333",
"instance":"0x0001",
- "unreliable":"30003",
"reliable":
{
"port":"40003",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
}
],
"routing":"subscribe_notify_test_service_one",
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json.in
new file mode 100644
index 0000000..cb1ff9e
--- /dev/null
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json.in
@@ -0,0 +1,61 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"subscribe_notify_test_service_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"subscribe_notify_test_service_three",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1111",
+ "instance":"0x0001",
+ "unreliable":"30001"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0001",
+ "unreliable":"30002"
+ },
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30003"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json.in
index fa4c5a3..4de283c 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json.in
@@ -31,32 +31,17 @@
{
"service":"0x1111",
"instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
+ "unreliable":"30001"
},
{
"service":"0x1111",
"instance":"0x0002",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
+ "unreliable":"30002"
},
{
"service":"0x1111",
"instance":"0x0003",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
+ "unreliable":"30003"
}
],
"routing":"subscribe_notify_test_service_one",
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp.json.in
index 66f1a83..5dd9299 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp.json.in
@@ -31,32 +31,17 @@
{
"service":"0x2222",
"instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
+ "unreliable":"30004"
},
{
"service":"0x2222",
"instance":"0x0002",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
+ "unreliable":"30005"
},
{
"service":"0x2222",
"instance":"0x0003",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
+ "unreliable":"30006"
}
],
"routing":"subscribe_notify_test_service_four",
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in
index d431acf..628734c 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in
@@ -31,56 +31,29 @@
{
"service":"0x4444",
"instance":"0x0001",
- "unreliable":"30004",
"reliable":
{
"port":"40004",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x5555",
"instance":"0x0001",
- "unreliable":"30005",
"reliable":
{
"port":"40005",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x6666",
"instance":"0x0001",
- "unreliable":"30006",
"reliable":
{
"port":"40006",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
}
],
"routing":"subscribe_notify_test_service_four",
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json.in
new file mode 100644
index 0000000..5b96b0e
--- /dev/null
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json.in
@@ -0,0 +1,61 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"subscribe_notify_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"subscribe_notify_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4444",
+ "instance":"0x0001",
+ "unreliable":"30004"
+ },
+ {
+ "service":"0x5555",
+ "instance":"0x0001",
+ "unreliable":"30005"
+ },
+ {
+ "service":"0x6666",
+ "instance":"0x0001",
+ "unreliable":"30006"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in
index 376642e..3969684 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in
@@ -31,56 +31,29 @@
{
"service":"0x1111",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x2222",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x3333",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
}
],
"routing":"subscribe_notify_test_service_one",
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json.in
new file mode 100644
index 0000000..72b53fc
--- /dev/null
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json.in
@@ -0,0 +1,61 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"subscribe_notify_test_service_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"subscribe_notify_test_service_three",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1111",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in
index a0a4b2c..3f9aa0b 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in
@@ -31,56 +31,29 @@
{
"service":"0x4444",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x5555",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
},
{
"service":"0x6666",
"instance":"0x0001",
- "unreliable":"30000",
"reliable":
{
"port":"40000",
"enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
+ }
}
],
"routing":"subscribe_notify_test_service_four",
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json.in
new file mode 100644
index 0000000..e485690
--- /dev/null
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json.in
@@ -0,0 +1,61 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"subscribe_notify_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"subscribe_notify_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4444",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x5555",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x6666",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in
index 0b0051a..d0ce9cc 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in
@@ -14,7 +14,7 @@
"id" : "0x9999"
}
],
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"service-discovery" :
{
"enable":"true",
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in
index 558a873..318cf3c 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in
@@ -22,7 +22,7 @@
"reliable" : { "port":"30509", "enable-magic-cookies":"false" }
}
],
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"service-discovery" :
{
"enable":"true",
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in
index 1828a7a..fa3e4f5 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in
@@ -22,7 +22,7 @@
"unreliable" : "30509"
}
],
- "routing" : "vsomeipd",
+ "routing" : "routingmanagerd",
"service-discovery" :
{
"enable":"true",
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json
new file mode 100644
index 0000000..e09d807
--- /dev/null
+++ b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json
@@ -0,0 +1,61 @@
+{
+ "unicast":"10.0.3.1",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"subscribe_notify_test_service_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"subscribe_notify_test_service_three",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1111",
+ "instance":"0x0001",
+ "unreliable":"30001"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0001",
+ "unreliable":"30002"
+ },
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30003"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json
new file mode 100644
index 0000000..91e9ef8
--- /dev/null
+++ b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json
@@ -0,0 +1,61 @@
+{
+ "unicast":"10.0.3.1",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"subscribe_notify_test_service_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"subscribe_notify_test_service_three",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1111",
+ "instance":"0x0001",
+ "unreliable":"30001"
+ },
+ {
+ "service":"0x1111",
+ "instance":"0x0002",
+ "unreliable":"30002"
+ },
+ {
+ "service":"0x1111",
+ "instance":"0x0003",
+ "unreliable":"30003"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp.json b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp.json
new file mode 100644
index 0000000..83e6963
--- /dev/null
+++ b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp.json
@@ -0,0 +1,61 @@
+{
+ "unicast":"10.0.3.2",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"subscribe_notify_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"subscribe_notify_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x2222",
+ "instance":"0x0001",
+ "unreliable":"30004"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0002",
+ "unreliable":"30005"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0003",
+ "unreliable":"30006"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json
new file mode 100644
index 0000000..f379642
--- /dev/null
+++ b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json
@@ -0,0 +1,61 @@
+{
+ "unicast":"10.0.3.2",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"subscribe_notify_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"subscribe_notify_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4444",
+ "instance":"0x0001",
+ "unreliable":"30004"
+ },
+ {
+ "service":"0x5555",
+ "instance":"0x0001",
+ "unreliable":"30005"
+ },
+ {
+ "service":"0x6666",
+ "instance":"0x0001",
+ "unreliable":"30006"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json
new file mode 100644
index 0000000..a6dde19
--- /dev/null
+++ b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json
@@ -0,0 +1,61 @@
+{
+ "unicast":"10.0.3.1",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"subscribe_notify_test_service_two",
+ "id":"0x2222"
+ },
+ {
+ "name":"subscribe_notify_test_service_three",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1111",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x2222",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x3333",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json
new file mode 100644
index 0000000..7e65f41
--- /dev/null
+++ b/test/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json
@@ -0,0 +1,61 @@
+{
+ "unicast":"10.0.3.2",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"subscribe_notify_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"subscribe_notify_test_service_five",
+ "id":"0x5555"
+ },
+ {
+ "name":"subscribe_notify_test_service_six",
+ "id":"0x6666"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x4444",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x5555",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ },
+ {
+ "service":"0x6666",
+ "instance":"0x0001",
+ "unreliable":"30000"
+ }
+ ],
+ "routing":"subscribe_notify_test_service_four",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
+ }
+}
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh
index 1e41c8e..9e009b4 100755
--- a/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh
+++ b/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh
@@ -10,71 +10,48 @@
# the testcase simply executes this script. This script then runs the services
# and checks that all exit successfully.
-if [ $# -lt 2 ]
+if [ $# -lt 1 ]
then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_master.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
echo "Please pass a json file to this script."
- echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_master.json"
+ echo "For example: $0 subscribe_notify_test_diff_client_ids_diff_ports_master.json"
echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter"
exit 1
fi
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $1 ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
# replace master with slave to be able display the correct json file to be used
# with the slave script
-MASTER_JSON_FILE=$2
+MASTER_JSON_FILE=$1
CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave}
FAIL=0
# Start the services
export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_one
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 1 $1 $3 &
+export VSOMEIP_CONFIGURATION=$MASTER_JSON_FILE
+./subscribe_notify_test_service 1 $2 &
export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_two
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 2 $1 $3 &
+export VSOMEIP_CONFIGURATION=$MASTER_JSON_FILE
+./subscribe_notify_test_service 2 $2 &
export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_three
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 3 $1 $3 &
+export VSOMEIP_CONFIGURATION=$MASTER_JSON_FILE
+./subscribe_notify_test_service 3 $2 &
sleep 1
if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting subscribe_notify_test_slave_starter.sh on slave LXC with parameters $1 $CLIENT_JSON_FILE $3"
- 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/test; ./subscribe_notify_test_slave_starter.sh $1 $CLIENT_JSON_FILE $3\"" &
+ echo "starting subscribe_notify_test_slave_starter.sh on slave LXC with parameters $CLIENT_JSON_FILE $2"
+ 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; ./subscribe_notify_test_slave_starter.sh $CLIENT_JSON_FILE $2\"" &
echo "remote ssh job id: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name sntms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./subscribe_notify_test_slave_starter.sh $1 $CLIENT_JSON_FILE $3" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./subscribe_notify_test_slave_starter.sh $CLIENT_JSON_FILE $2" &
else
cat <<End-of-message
*******************************************************************************
*******************************************************************************
** Please now run:
-** subscribe_notify_test_slave_starter.sh $1 $CLIENT_JSON_FILE $3
+** subscribe_notify_test_slave_starter.sh $CLIENT_JSON_FILE $2
** from an external host to successfully complete this test.
**
** You probably will need to adapt the 'unicast' settings in
@@ -97,11 +74,6 @@ do
wait $job || ((FAIL+=1))
done
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop sntms
- docker rm sntms
-fi
-
# Check if both exited successfully
if [ $FAIL -eq 0 ]
then
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp
index 8d9f856..1971c1e 100644
--- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp
+++ b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp
@@ -14,7 +14,7 @@
#include <utility>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include <gtest/gtest.h>
@@ -65,17 +65,20 @@ public:
// the service offers three events in two eventgroups
// one of the events is in both eventgroups (info_.event_id + 2)
its_groups.insert(info_.eventgroup_id);
- app_->request_event(info_.service_id, info_.instance_id, info_.event_id, its_groups, true);
app_->request_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id + 2), its_groups, true);
+ info_.event_id, its_groups,
+ vsomeip::event_type_e::ET_FIELD);
+ app_->request_event(info_.service_id, info_.instance_id,
+ static_cast<vsomeip::event_t>(info_.event_id + 2),
+ its_groups, vsomeip::event_type_e::ET_FIELD);
its_groups.erase(info_.eventgroup_id);
its_groups.insert(static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id +1));
app_->request_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id+1), its_groups, true);
+ static_cast<vsomeip::event_t>(info_.event_id+1),
+ its_groups, vsomeip::event_type_e::ET_FIELD);
app_->request_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id+2), its_groups, true);
-
-
+ static_cast<vsomeip::event_t>(info_.event_id+2),
+ its_groups, vsomeip::event_type_e::ET_FIELD);
return true;
}
@@ -154,7 +157,9 @@ public:
std::lock_guard<std::mutex> its_lock(events_mutex_);
received_events_.push_back(_response->get_payload());
if (received_events_.size() > 4) {
- ADD_FAILURE() << "Received too much events";
+ ADD_FAILURE() << "Received too many events ["
+ << std::hex << _response->get_method()
+ << " (" << std::dec << received_events_.size() << ")";
}
number_received_events_[_response->get_method()]++;
events_condition_.notify_one();
@@ -268,7 +273,6 @@ public:
check_received_events_number(its_expected);
its_expected.clear();
-
// set value again
set_field_at_service(0x2);
{
@@ -285,7 +289,6 @@ public:
check_received_events_number(its_expected);
its_expected.clear();
-
// set value again
set_field_at_service(0x3);
{
@@ -366,8 +369,8 @@ int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
if(argc < 2) {
- std::cerr << "Please specify a subscription type, like: " << argv[0] << " UDP" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
+ std::cerr << "Please specify a offer type of the service, like: " << argv[0] << " UDP" << std::endl;
+ std::cerr << "Valid offer types include:" << std::endl;
std::cerr << "[UDP, TCP]" << std::endl;
return 1;
}
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh
index c983369..943ef10 100755
--- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh
+++ b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh
@@ -31,7 +31,7 @@ FAIL=0
export VSOMEIP_CONFIGURATION=$2
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the client
@@ -41,10 +41,10 @@ sleep 1
if [ ! -z "$USE_LXC_TEST" ]; then
echo "starting subscribe_notify_test_slave_starter.sh on slave LXC with parameters $SLAVE_JSON_FILE"
- 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/test; ./subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh $SLAVE_JSON_FILE\"" &
+ 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; ./subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh $SLAVE_JSON_FILE\"" &
echo "remote ssh job id: $!"
elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name sntms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh $SLAVE_JSON_FILE" &
+ docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh $SLAVE_JSON_FILE" &
else
cat <<End-of-message
*******************************************************************************
@@ -73,11 +73,6 @@ wait $PID_CLIENT || FAIL=$(($FAIL+1))
kill $PID_VSOMEIPD
wait $PID_VSOMEIPD || FAIL=$(($FAIL+1))
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop sntms
- docker rm sntms
-fi
-
echo ""
# Check if both exited successfully
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp
index 1d7b0c3..6710892 100644
--- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp
+++ b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp
@@ -14,7 +14,7 @@
#include <atomic>
#include <gtest/gtest.h>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include <vsomeip/vsomeip.hpp>
@@ -68,15 +68,26 @@ public:
// one of the events is in both eventgroups
its_groups.insert(info_.eventgroup_id);
app_->offer_event(info_.service_id, info_.instance_id,
- info_.event_id, its_groups, true);
+ info_.event_id, its_groups, vsomeip::event_type_e::ET_FIELD,
+ std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
app_->offer_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id + 2), its_groups, true);
+ static_cast<vsomeip::event_t>(info_.event_id + 2),
+ its_groups, vsomeip::event_type_e::ET_FIELD,
+ std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
its_groups.erase(info_.eventgroup_id);
its_groups.insert(static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id + 1));
app_->offer_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id + 1), its_groups, true);
+ static_cast<vsomeip::event_t>(info_.event_id + 1),
+ its_groups, vsomeip::event_type_e::ET_FIELD,
+ std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
app_->offer_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id + 2), its_groups, true);
+ static_cast<vsomeip::event_t>(info_.event_id + 2),
+ its_groups, vsomeip::event_type_e::ET_FIELD,
+ std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
payload_ = vsomeip::runtime::get()->create_payload();
return true;
@@ -125,7 +136,7 @@ public:
std::shared_ptr<vsomeip::message> its_response
= vsomeip::runtime::get()->create_response(_message);
its_response->set_payload(payload_);
- app_->send(its_response, true);
+ app_->send(its_response);
{
std::lock_guard<std::mutex> its_lock(shutdown_mutex_);
wait_for_shutdown_ = false;
@@ -138,14 +149,14 @@ public:
= vsomeip::runtime::get()->create_response(_message);
payload_ = _message->get_payload();
its_response->set_payload(payload_);
- app_->send(its_response, true);
+ app_->send(its_response);
app_->notify(info_.service_id, info_.instance_id, info_.event_id, payload_);
app_->notify(info_.service_id, info_.instance_id, static_cast<vsomeip::event_t>(info_.event_id + 1), payload_);
app_->notify(info_.service_id, info_.instance_id, static_cast<vsomeip::event_t>(info_.event_id + 2), payload_);
}
void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message),true);
+ app_->send(vsomeip::runtime::get()->create_response(_message));
}
void wait_for_shutdown() {
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh
index 8138612..aa2784b 100755
--- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh
+++ b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh
@@ -20,7 +20,7 @@ FAIL=0
export VSOMEIP_CONFIGURATION=$1
# start daemon
-../daemon/./vsomeipd &
+../examples/routingmanagerd/./routingmanagerd &
PID_VSOMEIPD=$!
# Start the services
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp b/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
index 968d9ed..6f13d39 100644
--- a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
+++ b/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
@@ -16,7 +16,7 @@
#include <gtest/gtest.h>
#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
+#include <vsomeip/internal/logger.hpp>
#include "subscribe_notify_test_globals.hpp"
@@ -24,11 +24,9 @@
class subscribe_notify_test_service {
public:
subscribe_notify_test_service(struct subscribe_notify_test::service_info _service_info,
- vsomeip::subscription_type_e _subscription_type,
std::array<subscribe_notify_test::service_info, 7> _service_infos) :
service_info_(_service_info),
service_infos_(_service_infos),
- subscription_type_(_subscription_type),
app_(vsomeip::runtime::get()->create_application()),
wait_until_registered_(true),
wait_until_other_services_available_(true),
@@ -44,6 +42,7 @@ public:
ADD_FAILURE() << "Couldn't initialize application";
return;
}
+
app_->register_state_handler(
std::bind(&subscribe_notify_test_service::on_state, this,
std::placeholders::_1));
@@ -60,7 +59,9 @@ public:
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(service_info_.eventgroup_id);
app_->offer_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, true);
+ service_info_.event_id, its_eventgroups,
+ vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
+ false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
// register availability for all other services and request their event.
@@ -84,7 +85,7 @@ public:
std::set<vsomeip::eventgroup_t> its_eventgroups;
its_eventgroups.insert(i.eventgroup_id);
- app_->request_event(i.service_id, i.instance_id, i.event_id, its_eventgroups, true);
+ app_->request_event(i.service_id, i.instance_id, i.event_id, its_eventgroups, vsomeip::event_type_e::ET_FIELD);
other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
other_services_received_notification_[std::make_pair(i.service_id, i.method_id)] = 0;
@@ -95,7 +96,8 @@ public:
app_->register_subscription_handler(service_info_.service_id,
service_info_.instance_id, service_info_.eventgroup_id,
std::bind(&subscribe_notify_test_service::on_subscription, this,
- std::placeholders::_1, std::placeholders::_2));
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, std::placeholders::_4));
app_->start();
}
@@ -110,6 +112,7 @@ public:
}
void stop_offer() {
+ app_->stop_offer_event(service_info_.service_id, service_info_.instance_id, service_info_.event_id);
app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
}
@@ -167,9 +170,12 @@ public:
<< " : on_subscription_state_change: for service " << std::hex
<< _service << " received a subscription error!";
}
- }
+ }
- bool on_subscription(vsomeip::client_t _client, bool _subscribed) {
+ bool on_subscription(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid,
+ bool _subscribed) {
+ (void)_uid;
+ (void)_gid;
std::lock_guard<std::mutex> its_lock(subscribers_mutex_);
static bool notified(false);
if (_subscribed) {
@@ -188,7 +194,7 @@ public:
// -1 for placeholder in array
// divide by two because we only receive once subscription per remote node
// no matter how many clients subscribed to this eventgroup on the remote node
- if(!notified && subscribers_.size() == (service_infos_.size() - 1) / 2 )
+ if (!notified && subscribers_.size() == (service_infos_.size() - 1) / 2 )
{
// notify the notify thread to start sending out notifications
std::lock_guard<std::mutex> its_lock(notify_mutex_);
@@ -225,24 +231,11 @@ public:
<< _message->get_session() << "] from Service/Method ["
<< std::setw(4) << std::setfill('0') << std::hex
<< _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] (now have: "
+ << std::hex << _message->get_method() << "/" << std::dec << _message->get_length() << "] (now have: "
<< std::dec << other_services_received_notification_[std::make_pair(_message->get_service(),
_message->get_method())] << ")";
- bool notify(false);
- switch(subscription_type_) {
- case vsomeip::subscription_type_e::SU_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_RELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE:
- if (all_notifications_received()) {
- notify = true;
- }
- break;
- }
-
- if(notify) {
+ if(all_notifications_received()) {
std::lock_guard<std::mutex> its_lock(stop_mutex_);
wait_for_stop_ = false;
stop_condition_.notify_one();
@@ -317,7 +310,7 @@ public:
}
++subscribe_count;
app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_);
+ vsomeip::DEFAULT_MAJOR);
VSOMEIP_DEBUG << "[" << std::hex << service_info_.service_id
<< "] subscribing to Service/Instance/Eventgroup ["
<< std::setw(4) << std::setfill('0') << std::hex << i.service_id << "/"
@@ -344,7 +337,7 @@ public:
void notify() {
std::unique_lock<std::mutex> its_lock(notify_mutex_);
- while(wait_for_notify_) {
+ while (wait_for_notify_) {
notify_condition_.wait(its_lock);
}
@@ -419,8 +412,8 @@ public:
|| (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
continue;
}
- app_->register_subscription_status_handler(i.service_id, i.instance_id,
- i.eventgroup_id, vsomeip::ANY_EVENT, nullptr);
+ app_->unregister_subscription_status_handler(i.service_id, i.instance_id,
+ i.eventgroup_id, vsomeip::ANY_EVENT);
app_->unsubscribe(i.service_id, i.instance_id, i.eventgroup_id);
app_->release_event(i.service_id, i.instance_id, i.event_id);
app_->release_service(i.service_id, i.instance_id);
@@ -432,7 +425,6 @@ public:
private:
subscribe_notify_test::service_info service_info_;
std::array<subscribe_notify_test::service_info, 7> service_infos_;
- vsomeip::subscription_type_e subscription_type_;
std::shared_ptr<vsomeip::application> app_;
std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_notification_;
@@ -460,8 +452,7 @@ private:
std::mutex subscribers_mutex_;
};
-static int service_number;
-static vsomeip::subscription_type_e subscription_type;
+static unsigned long service_number;
static bool use_same_service_id;
TEST(someip_subscribe_notify_test, send_ten_notifications_to_service)
@@ -469,11 +460,10 @@ TEST(someip_subscribe_notify_test, send_ten_notifications_to_service)
if(use_same_service_id) {
subscribe_notify_test_service its_sample(
subscribe_notify_test::service_infos_same_service_id[service_number],
- subscription_type,
subscribe_notify_test::service_infos_same_service_id);
} else {
subscribe_notify_test_service its_sample(
- subscribe_notify_test::service_infos[service_number], subscription_type,
+ subscribe_notify_test::service_infos[service_number],
subscribe_notify_test::service_infos);
}
}
@@ -482,35 +472,16 @@ TEST(someip_subscribe_notify_test, send_ten_notifications_to_service)
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
- if(argc < 3) {
- std::cerr << "Please specify a service number and subscription type, like: " << argv[0] << " 2 UDP SAME_SERVICE_ID" << std::endl;
+ if(argc < 2) {
+ std::cerr << "Please specify a service number, like: " << argv[0] << " 2 SAME_SERVICE_ID" << std::endl;
std::cerr << "Valid service numbers are in the range of [1,6]" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
std::cerr << "If SAME_SERVICE_ID is specified as third parameter the test is run w/ multiple instances of the same service" << std::endl;
return 1;
}
- service_number = std::stoi(std::string(argv[1]), nullptr);
-
- if(std::string("TCP_AND_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE;
- } else if(std::string("PREFER_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE;
- } else if(std::string("PREFER_TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_RELIABLE;
- } else if(std::string("UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_UNRELIABLE;
- } else if(std::string("TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE;
- } else {
- std::cerr << "Wrong subscription type passed, exiting" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- return 1;
- }
+ service_number = std::stoul(std::string(argv[1]), nullptr);
- if (argc >= 4 && std::string("SAME_SERVICE_ID") == std::string(argv[3])) {
+ if (argc >= 3 && std::string("SAME_SERVICE_ID") == std::string(argv[2])) {
use_same_service_id = true;
} else {
use_same_service_id = false;
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh
index 9865536..20362c7 100755
--- a/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh
+++ b/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh
@@ -10,51 +10,28 @@
# the testcase simply executes this script. This script then runs the services
# and checks that all exit successfully.
-if [ $# -lt 2 ]
+if [ $# -lt 1 ]
then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_slave.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
echo "Please pass a json file to this script."
echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_slave.json"
echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter"
exit 1
fi
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $1 ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
FAIL=0
# Start the services
export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_four
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 4 $1 $3 &
+export VSOMEIP_CONFIGURATION=$1
+./subscribe_notify_test_service 4 $2 &
export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_five
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 5 $1 $3 &
+export VSOMEIP_CONFIGURATION=$1
+./subscribe_notify_test_service 5 $2 &
export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_six
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 6 $1 $3 &
+export VSOMEIP_CONFIGURATION=$1
+./subscribe_notify_test_service 6 $2 &
# Wait until all applications are finished
for job in $(jobs -p)