diff options
Diffstat (limited to 'test')
242 files changed, 0 insertions, 28025 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index fd70df6..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,2832 +0,0 @@ -# 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/. - -cmake_minimum_required (VERSION 2.8.1) - -# Add the gtest header files to the include files -include_directories( - . - ${gtest_SOURCE_DIR}/include -) - -set(TEST_LINK_LIBRARIES gtest) - -# Function to copy files into the build directory (or anywhere else) -# On unixoid systems this function will create symlinks instead -# SOURCE_PATH: Path to the file which should be copied -# DESTINATION_PATH: destination file -# TARGET_TO_DEPEND: The copying of the file will be added as -# a dependency to this target -function(copy_to_builddir SOURCE_PATH DESTINATION_PATH TARGET_TO_DEPEND) - if(${CMAKE_SYSTEM_NAME} MATCHES "Windows" OR NOT ${TEST_SYMLINK_CONFIG_FILES}) - ADD_CUSTOM_COMMAND( - OUTPUT "${DESTINATION_PATH}" - COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${DESTINATION_PATH}" - DEPENDS "${SOURCE_PATH}" - COMMENT "Copying \"${SOURCE_PATH}\" into build directory" - ) - else() - if(${TEST_SYMLINK_CONFIG_FILES_RELATIVE}) - ADD_CUSTOM_COMMAND( - OUTPUT "${DESTINATION_PATH}" - # Create a relative link - COMMAND ln -s -r "${SOURCE_PATH}" "${DESTINATION_PATH}" - DEPENDS "${SOURCE_PATH}" - COMMENT "Symlinking \"${SOURCE_PATH}\" into build directory" - ) - else() - ADD_CUSTOM_COMMAND( - OUTPUT "${DESTINATION_PATH}" - # Create an absolute link - COMMAND ${CMAKE_COMMAND} -E create_symlink "${SOURCE_PATH}" "${DESTINATION_PATH}" - DEPENDS "${SOURCE_PATH}" - COMMENT "Symlinking \"${SOURCE_PATH}\" into build directory" - ) - endif() - endif() - # Add a random number to the end of the string to avoid problems with - # duplicate filenames - set(FILENAME "") - get_filename_component(FILENAME ${SOURCE_PATH} NAME ) - string(RANDOM LENGTH 4 ALPHABET 0123456789 RANDOMNUMBER) - if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") - ADD_CUSTOM_TARGET(copy_${FILENAME}_${RANDOMNUMBER} - DEPENDS "${DESTINATION_PATH}" - ) - ADD_DEPENDENCIES(${TARGET_TO_DEPEND} copy_${FILENAME}_${RANDOMNUMBER}) - else() - ADD_CUSTOM_TARGET(symlink_${FILENAME}_${RANDOMNUMBER} - DEPENDS "${DESTINATION_PATH}" - ) - ADD_DEPENDENCIES(${TARGET_TO_DEPEND} symlink_${FILENAME}_${RANDOMNUMBER}) - endif() -endfunction() - -############################################################################## -# configuration-test -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_CONFIGURATION configuration-test) - - add_executable(${TEST_CONFIGURATION} configuration_tests/configuration-test.cpp) - target_link_libraries(${TEST_CONFIGURATION} - vsomeip - vsomeip-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 - set(TEST_CONFIGURATION_CONFIG_FILE configuration-test.json) - set(TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE configuration-test-deprecated.json) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/configuration_tests/${TEST_CONFIGURATION_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CONFIGURATION_CONFIG_FILE} - ${TEST_CONFIGURATION} - ) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/configuration_tests/${TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE} - ${TEST_CONFIGURATION} - ) -endif() -############################################################################## -# application test -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_APPLICATION application_test) - - add_executable(${TEST_APPLICATION} application_tests/${TEST_APPLICATION}.cpp) - target_link_libraries(${TEST_APPLICATION} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - set(TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE ${TEST_APPLICATION}_single_process.json) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE} - ${TEST_APPLICATION}_single_process - ) - - set(TEST_APPLICATION_CONFIGURATION_FILE ${TEST_APPLICATION}.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE}.in - ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_CONFIGURATION_FILE} - ${TEST_APPLICATION} - ) - - set(TEST_APPLICATION_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_daemon.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}.in - ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} - ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} - ${TEST_APPLICATION} - ) - - set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE ${TEST_APPLICATION}_no_dispatch_threads.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}.in - ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} - ${TEST_APPLICATION} - ) - - set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_no_dispatch_threads_daemon.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}.in - ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} - ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} - ${TEST_APPLICATION} - ) - - set(TEST_APPLICATION_STARTER ${TEST_APPLICATION}_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_STARTER} - ${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} - ${TEST_APPLICATION}_single_process - ) - - set(TEST_APPLICATION_AVAILABILITY_STARTER ${TEST_APPLICATION_AVAILABILITY_NAME}_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_AVAILABILITY_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_AVAILABILITY_STARTER} - ${TEST_APPLICATION_SINGLE_PROCESS_NAME} - ) -endif() -############################################################################## -# magic-cookies-test-client -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_MAGIC_COOKIES_NAME magic_cookies_test) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for client into $BUILDDIR/test - set(TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE ${TEST_MAGIC_COOKIES_CLIENT}.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/conf/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE} - ${TEST_MAGIC_COOKIES_CLIENT} - ) - - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT ${TEST_MAGIC_COOKIES_CLIENT}_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT} - ${TEST_MAGIC_COOKIES_CLIENT} - ) - - set(TEST_MAGIC_COOKIES_SERVICE magic_cookies_test_service) - # Copy config file for service into $BUILDDIR/test - set(TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE ${TEST_MAGIC_COOKIES_SERVICE}.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/conf/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE} - ${TEST_MAGIC_COOKIES_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT ${TEST_MAGIC_COOKIES_SERVICE}_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT} - ${TEST_MAGIC_COOKIES_CLIENT} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_MAGIC_COOKIES_STARTER ${TEST_MAGIC_COOKIES_NAME}_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER} - ${TEST_MAGIC_COOKIES_CLIENT} - ) -endif() -############################################################################## -# someip-header-factory-test -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_HEADER_FACTORY_NAME header_factory_test) - - set(TEST_HEADER_FACTORY header_factory_test) - add_executable(${TEST_HEADER_FACTORY} header_factory_tests/header_factory_test.cpp) - target_link_libraries(${TEST_HEADER_FACTORY} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT} - ${TEST_LINK_LIBRARIES} - ) - - ############################################################################## - # Now comes the second part of the header factory test which consists of ouf - # a client and a service both with settings file and bash scripts to start them - set(TEST_HEADER_FACTORY_CLIENT header_factory_test_client) - add_executable(${TEST_HEADER_FACTORY_CLIENT} header_factory_tests/${TEST_HEADER_FACTORY_CLIENT}.cpp) - target_link_libraries(${TEST_HEADER_FACTORY_CLIENT} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for client into $BUILDDIR/test - set(TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE ${TEST_HEADER_FACTORY_CLIENT}.json) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE} - ${TEST_HEADER_FACTORY_CLIENT} - ) - - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_HEADER_FACTORY_CLIENT_START_SCRIPT ${TEST_HEADER_FACTORY_CLIENT}_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT} - ${TEST_HEADER_FACTORY_CLIENT} - ) - - set(TEST_HEADER_FACTORY_SERVICE header_factory_test_service) - add_executable(${TEST_HEADER_FACTORY_SERVICE} header_factory_tests/${TEST_HEADER_FACTORY_SERVICE}.cpp) - target_link_libraries(${TEST_HEADER_FACTORY_SERVICE} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for service into $BUILDDIR/test - set(TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE ${TEST_HEADER_FACTORY_SERVICE}.json) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE} - ${TEST_HEADER_FACTORY_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_HEADER_FACTORY_SERVICE_START_SCRIPT ${TEST_HEADER_FACTORY_SERVICE}_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT} - ${TEST_HEADER_FACTORY_SERVICE} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_HEADER_FACTORY_STARTER header_factory_test_send_receive_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_STARTER} - ${TEST_HEADER_FACTORY_CLIENT} - ) -endif() -############################################################################## -# routing-test -############################################################################## - -if(NOT ${TESTS_BAT}) - set(TEST_LOCAL_ROUTING_NAME local_routing_test) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for service into $BUILDDIR/test - set(TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_LOCAL_ROUTING_SERVICE}.json) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - ${TEST_LOCAL_ROUTING_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_LOCAL_ROUTING_SERVICE}_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT} - ${TEST_LOCAL_ROUTING_SERVICE} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for client into $BUILDDIR/test - set(TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_LOCAL_ROUTING_CLIENT}.json) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - ${TEST_LOCAL_ROUTING_CLIENT} - ) - - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_LOCAL_ROUTING_CLIENT}_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT} - ${TEST_LOCAL_ROUTING_CLIENT} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh) - configure_file( - ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_LOCAL_ROUTING_STARTER}.in - ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER} - ${TEST_LOCAL_ROUTING_CLIENT} - ) - - ############################################################################## - set(TEST_EXTERNAL_LOCAL_ROUTING_NAME external_local_routing_test) - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for service into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT} - ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} - ) - - # Copy bashscript to start external client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT external_local_routing_test_client_external) - set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT} - ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} - ) - - # Copy config file for client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_ROUTING_STARTER external_local_routing_test_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER} - ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} - ) -else() - set(TEST_LOCAL_ROUTING_NAME local_routing_test) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for service into $BUILDDIR/test - set(TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_LOCAL_ROUTING_SERVICE}.json) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - ${TEST_LOCAL_ROUTING_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_LOCAL_ROUTING_SERVICE}_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT} - ${TEST_LOCAL_ROUTING_SERVICE} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for client into $BUILDDIR/test - set(TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_LOCAL_ROUTING_CLIENT}.json) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - ${TEST_LOCAL_ROUTING_CLIENT} - ) - - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_LOCAL_ROUTING_CLIENT}_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT} - ${TEST_LOCAL_ROUTING_CLIENT} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh) - configure_file( - ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_LOCAL_ROUTING_STARTER}.bat.in - ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER} - ${TEST_LOCAL_ROUTING_CLIENT} - ) -endif() -############################################################################## -# restart_routing-test -############################################################################## - -if(NOT ${TESTS_BAT}) - set(TEST_RESTART_ROUTING_NAME restart_routing_test) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for service into $BUILDDIR/test - set(TEST_RESTART_ROUTING_SERVICE_CONFIG_FILE ${TEST_RESTART_ROUTING_SERVICE}.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_SERVICE_CONFIG_FILE} - ${TEST_RESTART_ROUTING_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_RESTART_ROUTING_SERVICE_START_SCRIPT ${TEST_RESTART_ROUTING_SERVICE}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_SERVICE_START_SCRIPT} - ${TEST_RESTART_ROUTING_SERVICE} - ) - - set(TEST_RESTART_ROUTING_CLIENT restart_routing_test_client) - add_executable(${TEST_RESTART_ROUTING_CLIENT} - restart_routing_tests/${TEST_RESTART_ROUTING_CLIENT}.cpp - ) - target_link_libraries(${TEST_RESTART_ROUTING_CLIENT} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for client into $BUILDDIR/test - set(TEST_RESTART_ROUTING_CLIENT_CONFIG_FILE ${TEST_RESTART_ROUTING_CLIENT}.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_CLIENT_CONFIG_FILE} - ${TEST_RESTART_ROUTING_CLIENT} - ) - - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_RESTART_ROUTING_CLIENT_START_SCRIPT ${TEST_RESTART_ROUTING_CLIENT}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_CLIENT_START_SCRIPT} - ${TEST_RESTART_ROUTING_CLIENT} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_RESTART_ROUTING_STARTER restart_routing_test_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_STARTER} - ${TEST_RESTART_ROUTING_CLIENT} - ) - - # Copy config file for autoconfig into $BUILDDIR/test - set(TEST_RESTART_ROUTING_AUTO_CONFIG_FILE ${TEST_RESTART_ROUTING_NAME}_autoconfig.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_AUTO_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_AUTO_CONFIG_FILE} - ${TEST_RESTART_ROUTING_CLIENT} - ) -endif() - -############################################################################## -# security test -############################################################################## - -if (${TEST_SECURITY}) - if(NOT ${TESTS_BAT}) - set(TEST_SECURITY_NAME security_test) - - set(TEST_SECURITY_SERVICE security_test_service) - add_executable(${TEST_SECURITY_SERVICE} security_tests/${TEST_SECURITY_SERVICE}.cpp) - target_link_libraries(${TEST_SECURITY_SERVICE} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for service into $BUILDDIR/test - set(TEST_SECURITY_SERVICE_CONFIG_FILE ${TEST_SECURITY_NAME}_config.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/security_tests/conf/${TEST_SECURITY_SERVICE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/security_tests/${TEST_SECURITY_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/security_tests/${TEST_SECURITY_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_SERVICE_CONFIG_FILE} - ${TEST_SECURITY_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_SECURITY_SERVICE_START_SCRIPT ${TEST_SECURITY_NAME}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/security_tests/${TEST_SECURITY_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_SERVICE_START_SCRIPT} - ${TEST_SECURITY_SERVICE} - ) - - set(TEST_SECURITY_CLIENT security_test_client) - add_executable(${TEST_SECURITY_CLIENT} - security_tests/${TEST_SECURITY_CLIENT}.cpp - ) - target_link_libraries(${TEST_SECURITY_CLIENT} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - endif() -endif() - -############################################################################## -# payload-test -############################################################################## - -if(NOT ${TESTS_BAT}) - set(TEST_LOCAL_PAYLOAD_NAME local_payload_test) - - set(TEST_PAYLOAD_SERVICE payload_test_service) - add_executable(${TEST_PAYLOAD_SERVICE} payload_tests/${TEST_PAYLOAD_SERVICE}.cpp) - target_link_libraries(${TEST_PAYLOAD_SERVICE} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for service into $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE local_${TEST_PAYLOAD_SERVICE}.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT local_${TEST_PAYLOAD_SERVICE}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_PAYLOAD_SERVICE} - ) - - set(TEST_PAYLOAD_CLIENT payload_test_client) - add_executable(${TEST_PAYLOAD_CLIENT} - payload_tests/${TEST_PAYLOAD_CLIENT}.cpp - payload_tests/stopwatch.cpp - ) - target_link_libraries(${TEST_PAYLOAD_CLIENT} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for client into $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE local_${TEST_PAYLOAD_CLIENT}.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_PAYLOAD_CLIENT} - ) - - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT local_${TEST_PAYLOAD_CLIENT}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT} - ${TEST_PAYLOAD_CLIENT} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_STARTER local_payload_test_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) - - ############################################################################## - set(TEST_EXTERNAL_LOCAL_PAYLOAD_NAME external_local_payload_test) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE external_local_payload_test_service) - - # Copy config file for service into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_PAYLOAD_SERVICE} - ) - - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL external_local_payload_test_client_local) - - # Copy config file for client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_PAYLOAD_CLIENT} - ) - - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT} - ${TEST_PAYLOAD_CLIENT} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME external_local_payload_test_client_local) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) - ############################################################################## - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME external_local_payload_test_client_external) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL external_local_payload_test_client_external) - - # Copy config file for client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} - ${TEST_PAYLOAD_CLIENT} - ) - - # Copy bashscript to start client into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT} - ${TEST_PAYLOAD_CLIENT} - ) - - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL external_local_payload_test_service_client_external) - - # Copy bashscript to start service into $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL}_start.sh) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT} - ${TEST_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) - - ############################################################################## - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME external_local_payload_test_client_local_and_external) - set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) - - ############################################################################## - set(TEST_LOCAL_PAYLOAD_HUGE_NAME local_payload_test_huge_payload) - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_PAYLOAD_HUGE_STARTER ${TEST_LOCAL_PAYLOAD_HUGE_NAME}_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} - ${TEST_PAYLOAD_CLIENT} - ) -endif() - -############################################################################## -# big_payload_test -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_BIG_PAYLOAD_NAME big_payload_test) - - set(TEST_BIG_PAYLOAD_SERVICE big_payload_test_service) - add_executable(${TEST_BIG_PAYLOAD_SERVICE} big_payload_tests/${TEST_BIG_PAYLOAD_SERVICE}.cpp) - target_link_libraries(${TEST_BIG_PAYLOAD_SERVICE} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_queue_limited.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_random.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_limited.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_client.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_CLIENT} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_service.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_tcp_client_limited_general.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_CLIENT} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_tcp_service_limited_general.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_tcp_client_random.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_CLIENT} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_tcp_service_random.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL ${TEST_BIG_PAYLOAD_NAME}_tcp_client_queue_limited_general.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${TEST_BIG_PAYLOAD_CLIENT} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL ${TEST_BIG_PAYLOAD_NAME}_tcp_service_queue_limited_general.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC ${TEST_BIG_PAYLOAD_NAME}_tcp_client_queue_limited_specific.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${TEST_BIG_PAYLOAD_CLIENT} - ) - - # Copy config file for client and service into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC ${TEST_BIG_PAYLOAD_NAME}_tcp_service_queue_limited_specific.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start client local to $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_client_local_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} - ${TEST_BIG_PAYLOAD_CLIENT} - ) - - # Copy bashscript to start service local to $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_service_local_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start client and server $BUILDDIR/test - set(TEST_LOCAL_BIG_PAYLOAD_NAME big_payload_test_local) - set(TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM big_payload_test_local_random) - set(TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED big_payload_test_local_limited) - set(TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED big_payload_test_local_queue_limited) - set(TEST_LOCAL_BIG_PAYLOAD_STARTER ${TEST_LOCAL_BIG_PAYLOAD_NAME}_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start client for external test into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME big_payload_test_external) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM big_payload_test_external_random) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED big_payload_test_external_limited) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL big_payload_test_external_limited_general) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL big_payload_test_external_queue_limited_general) - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC big_payload_test_external_queue_limited_specific) - set(TEST_EXTERNAL_BIG_PAYLOAD_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} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start server for external into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_NAME big_payload_test_external) - set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_service_external_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT} - ${TEST_BIG_PAYLOAD_SERVICE} - ) - - # Copy bashscript to start client for external test into $BUILDDIR/test - set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_client_start.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} - ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT} - ${TEST_BIG_PAYLOAD_CLIENT} - ) -endif() - -############################################################################## -# client id tests -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_CLIENT_ID_NAME client_id_test) - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - set(TEST_CLIENT_ID_UTILITY ${TEST_CLIENT_ID_NAME}_utility) - add_executable(${TEST_CLIENT_ID_UTILITY} - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config files for test into $BUILDDIR/test - set(TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_same_client_ids_same_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_same_client_ids_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_same_client_ids_diff_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE - ${TEST_CLIENT_ID_NAME}_same_client_ids_diff_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) - - set(TEST_CLIENT_ID_UTILITY_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_UTILITY_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY_CONFIG_FILE} - ${TEST_CLIENT_ID_UTILITY} - ) - set(TEST_CLIENT_ID_UTILITY_MASKED_511_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility_masked_511.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_UTILITY_MASKED_511_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY_MASKED_511_CONFIG_FILE} - ${TEST_CLIENT_ID_UTILITY} - ) - - set(TEST_CLIENT_ID_UTILITY_MASKED_4095_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility_masked_4095.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_UTILITY_MASKED_4095_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY_MASKED_4095_CONFIG_FILE} - ${TEST_CLIENT_ID_UTILITY} - ) - - set(TEST_CLIENT_ID_UTILITY_MASKED_127_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility_masked_127.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_UTILITY_MASKED_127_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY_MASKED_127_CONFIG_FILE} - ${TEST_CLIENT_ID_UTILITY} - ) - - # copy starter scripts into builddir - set(TEST_CLIENT_ID_MASTER_STARTER ${TEST_CLIENT_ID_NAME}_master_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} - ${TEST_CLIENT_ID_SERVICE} - ) - set(TEST_CLIENT_ID_SLAVE_STARTER ${TEST_CLIENT_ID_NAME}_slave_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SLAVE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SLAVE_STARTER} - ${TEST_CLIENT_ID_SERVICE} - ) -endif() - -############################################################################## -# subscribe notify tests -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_SUBSCRIBE_NOTIFY_NAME subscribe_notify_test) - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config files for test into $BUILDDIR/test - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_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( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_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( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_same_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_diff_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_diff_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${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) - 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} - @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} - ${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) - 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} - @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} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - # copy starter scripts into builddir - set(TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER ${TEST_SUBSCRIBE_NOTIFY_NAME}_master_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - set(TEST_SUBSCRIBE_NOTIFY_SLAVE_STARTER ${TEST_SUBSCRIBE_NOTIFY_NAME}_slave_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SLAVE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SLAVE_STARTER} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) - - # 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - # client - set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_client) - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_udp_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT} - ) - set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_tcp_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT} - ) - - set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_master_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE} - ) - set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_STARTER - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_slave_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_STARTER} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE} - ) -endif() - -############################################################################## -# subscribe notify one tests -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_SUBSCRIBE_NOTIFY_ONE_NAME subscribe_notify_one_test) - 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 - ${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) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_master_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) - - set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE - ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_slave_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) - - # copy starter scripts into builddir - set(TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_master_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) - set(TEST_SUBSCRIBE_NOTIFY_ONE_SLAVE_STARTER ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_slave_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_SLAVE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_SLAVE_STARTER} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) -endif() - -############################################################################## -# cpu-load-test -############################################################################## - -if(NOT ${TESTS_BAT}) - set(TEST_CPU_LOAD_NAME cpu_load_test) - - set(TEST_CPU_LOAD_SERVICE cpu_load_test_service) - add_executable(${TEST_CPU_LOAD_SERVICE} - cpu_load_tests/${TEST_CPU_LOAD_SERVICE}.cpp - cpu_load_tests/cpu_load_measurer.cpp - ) - target_link_libraries(${TEST_CPU_LOAD_SERVICE} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config files for test into $BUILDDIR/test - set(TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_service_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/conf/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE} - ${TEST_CPU_LOAD_SERVICE} - ) - set(TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_service_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/conf/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE} - ${TEST_CPU_LOAD_SERVICE} - ) - - ############################################################################## - set(TEST_CPU_LOAD_CLIENT cpu_load_test_client) - add_executable(${TEST_CPU_LOAD_CLIENT} - cpu_load_tests/${TEST_CPU_LOAD_CLIENT}.cpp - cpu_load_tests/cpu_load_measurer.cpp - ) - target_link_libraries(${TEST_CPU_LOAD_CLIENT} - vsomeip - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - set(TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_client_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/conf/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE} - ${TEST_CPU_LOAD_CLIENT} - ) - set(TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_client_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/conf/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE} - ${TEST_CPU_LOAD_CLIENT} - ) - - ############################################################################## - # copy starter scripts into builddir - set(TEST_CPU_LOAD_MASTER_STARTER ${TEST_CPU_LOAD_NAME}_master_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_MASTER_STARTER} - ${TEST_CPU_LOAD_SERVICE} - ) - set(TEST_CPU_LOAD_SLAVE_STARTER ${TEST_CPU_LOAD_NAME}_slave_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SLAVE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_SLAVE_STARTER} - ${TEST_CPU_LOAD_SERVICE} - ) -endif() - -############################################################################## -# initial event tests -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_INITIAL_EVENT_NAME initial_event_test) - 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 - ${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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # Copy config files for test into $BUILDDIR/test - set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - # Copy config files for test into $BUILDDIR/test - set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_master_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_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( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_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( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_master_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_slave_tcp.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_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( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_same_client_ids_same_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_same_client_ids_same_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_same_client_ids_diff_ports_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_same_client_ids_diff_ports_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE - ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) - - # copy starter scripts into builddir - set(TEST_INITIAL_EVENT_MASTER_STARTER ${TEST_INITIAL_EVENT_NAME}_master_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} - ${TEST_INITIAL_EVENT_SERVICE} - ) - set(TEST_INITIAL_EVENT_SLAVE_STARTER ${TEST_INITIAL_EVENT_NAME}_slave_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SLAVE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SLAVE_STARTER} - ${TEST_INITIAL_EVENT_SERVICE} - ) -endif() - -############################################################################## -# offer tests -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_OFFER_NAME offer_test) - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - set(TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER ${TEST_OFFER_NAME}_external_sd_msg_sender) - add_executable(${TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER} offer_tests/${TEST_OFFER_NAME}_external_sd_msg_sender.cpp) - target_link_libraries(${TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # client and service for offer test big sd msg - set(TEST_OFFER_BIG_NAME offer_test_big_sd_msg) - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # copy starter scripts into builddir - set(TEST_OFFER_LOCAL_STARTER ${TEST_OFFER_NAME}_local_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_LOCAL_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_LOCAL_STARTER} - ${TEST_OFFER_SERVICE} - ) - - # Copy config file for local test into $BUILDDIR/test - set(TEST_OFFER_LOCAL_CONFIG_FILE ${TEST_OFFER_NAME}_local.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_LOCAL_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_LOCAL_CONFIG_FILE} - ${TEST_OFFER_SERVICE} - ) - - # generate and copy json files into builddir for external test - set(TEST_OFFER_SLAVE_CONFIG_FILE ${TEST_OFFER_NAME}_external_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_SLAVE_CONFIG_FILE} - ${TEST_OFFER_SERVICE} - ) - - set(TEST_OFFER_MASTER_CONFIG_FILE ${TEST_OFFER_NAME}_external_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_MASTER_CONFIG_FILE} - ${TEST_OFFER_SERVICE} - ) - - # generate and copy json files into builddir for big SD message test - set(TEST_OFFER_BIG_SLAVE_CONFIG_FILE ${TEST_OFFER_BIG_NAME}_slave.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE} - ${TEST_OFFER_BIG_SERVICE} - ) - - set(TEST_OFFER_BIG_MASTER_CONFIG_FILE ${TEST_OFFER_BIG_NAME}_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_BIG_MASTER_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_MASTER_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_MASTER_CONFIG_FILE} - ${TEST_OFFER_BIG_SERVICE} - ) - - # Copy starter scripts for external test to $BUILDDIR/test - set(TEST_OFFER_EXTERNAL_MASTER_STARTER ${TEST_OFFER_NAME}_external_master_starter.sh) - configure_file( - ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_EXTERNAL_MASTER_STARTER}.in - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_EXTERNAL_MASTER_STARTER} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_EXTERNAL_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_EXTERNAL_MASTER_STARTER} - ${TEST_OFFER_SERVICE} - ) - set(TEST_OFFER_EXTERNAL_SLAVE_STARTER ${TEST_OFFER_NAME}_external_slave_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_EXTERNAL_SLAVE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_EXTERNAL_SLAVE_STARTER} - ${TEST_OFFER_SERVICE} - ) - - # Copy starter scripts for external test to $BUILDDIR/test - set(TEST_OFFER_BIG_MASTER_STARTER ${TEST_OFFER_BIG_NAME}_master_starter.sh) - configure_file( - ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_BIG_MASTER_STARTER}.in - ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_MASTER_STARTER} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_MASTER_STARTER} - ${TEST_OFFER_BIG_SERVICE} - ) - # Copy starter scripts for external test to $BUILDDIR/test - set(TEST_OFFER_BIG_EXTERNAL_SLAVE_STARTER ${TEST_OFFER_BIG_NAME}_slave_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_EXTERNAL_SLAVE_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_EXTERNAL_SLAVE_STARTER} - ${TEST_OFFER_BIG_SERVICE} - ) -endif() - -############################################################################## -# offered services info tests -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_OFFERED_SERVICES_INFO_NAME offered_services_info_test) - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - 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 - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - ) - - # copy starter scripts into builddir - set(TEST_OFFERED_SERVICES_INFO_LOCAL_STARTER ${TEST_OFFERED_SERVICES_INFO_NAME}_local_starter.sh) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offered_services_info_test/${TEST_OFFERED_SERVICES_INFO_LOCAL_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFERED_SERVICES_INFO_LOCAL_STARTER} - ${TEST_OFFERED_SERVICES_INFO_SERVICE} - ) - - # Copy config file for local test into $BUILDDIR/test - set(TEST_OFFERED_SERVICES_INFO_LOCAL_CONFIG_FILE ${TEST_OFFERED_SERVICES_INFO_NAME}_local.json) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/offered_services_info_test/${TEST_OFFERED_SERVICES_INFO_LOCAL_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_OFFERED_SERVICES_INFO_LOCAL_CONFIG_FILE} - ${TEST_OFFERED_SERVICES_INFO_SERVICE} - ) -endif() - -############################################################################## -# pending subscription tests tests -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_PENDING_SUBSCRIPTION_NAME pending_subscription_test) - 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 - ${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_PENDING_SUBSCRIPTION_CLIENT ${TEST_PENDING_SUBSCRIPTION_NAME}_sd_msg_sender) - add_executable(${TEST_PENDING_SUBSCRIPTION_CLIENT} - pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_NAME}_sd_msg_sender.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 - ${sd_sources} - ) - - target_link_libraries(${TEST_PENDING_SUBSCRIPTION_CLIENT} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - vsomeip - vsomeip-sd - ) - - # copy starter scripts into builddir - set(TEST_PENDING_SUBSCRIPTION_MASTER_STARTER ${TEST_PENDING_SUBSCRIPTION_NAME}_master_starter.sh) - configure_file( - ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/conf/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER}.in - ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} - ${TEST_PENDING_SUBSCRIPTION_SERVICE} - ) - - # Copy config file for local test into $BUILDDIR/test - set(TEST_PENDING_SUBSCRIPTION_CONFIG_FILE ${TEST_PENDING_SUBSCRIPTION_NAME}_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/conf/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE} - ${TEST_PENDING_SUBSCRIPTION_SERVICE} - ) -endif() - -############################################################################## -# malicious data tests -############################################################################## -if(NOT ${TESTS_BAT}) - set(TEST_MALICIOUS_DATA_NAME malicious_data_test) - 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 - ${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_MALICIOUS_DATA_CLIENT ${TEST_MALICIOUS_DATA_NAME}_msg_sender) - add_executable(${TEST_MALICIOUS_DATA_CLIENT} - malicious_data_tests/${TEST_MALICIOUS_DATA_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 - ${sd_sources} - ) - - target_link_libraries(${TEST_MALICIOUS_DATA_CLIENT} - ${Boost_LIBRARIES} - ${DL_LIBRARY} - ${TEST_LINK_LIBRARIES} - vsomeip - vsomeip-sd - ) - - # copy starter scripts into builddir - set(TEST_MALICIOUS_DATA_MASTER_STARTER ${TEST_MALICIOUS_DATA_NAME}_master_starter.sh) - configure_file( - ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/conf/${TEST_MALICIOUS_DATA_MASTER_STARTER}.in - ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/${TEST_MALICIOUS_DATA_MASTER_STARTER} - @ONLY) - copy_to_builddir(${PROJECT_SOURCE_DIR}/test/malicious_data_tests/${TEST_MALICIOUS_DATA_MASTER_STARTER} - ${PROJECT_BINARY_DIR}/test/${TEST_MALICIOUS_DATA_MASTER_STARTER} - ${TEST_MALICIOUS_DATA_SERVICE} - ) - - # Copy config file for local test into $BUILDDIR/test - set(TEST_MALICIOUS_DATA_CONFIG_FILE ${TEST_MALICIOUS_DATA_NAME}_master.json) - configure_file( - ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/conf/${TEST_MALICIOUS_DATA_CONFIG_FILE}.in - ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/${TEST_MALICIOUS_DATA_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/${TEST_MALICIOUS_DATA_CONFIG_FILE} - ${PROJECT_BINARY_DIR}/test/${TEST_MALICIOUS_DATA_CONFIG_FILE} - ${TEST_MALICIOUS_DATA_SERVICE} - ) -endif() - -############################################################################## -# Add for every test a dependency to gtest -############################################################################## - -if(NOT ${TESTS_BAT}) - add_dependencies(${TEST_CONFIGURATION} gtest) - add_dependencies(${TEST_APPLICATION} gtest) - add_dependencies(${TEST_APPLICATION_SINGLE_PROCESS_NAME} gtest) - add_dependencies(${TEST_APPLICATION_AVAILABILITY_NAME} gtest) - add_dependencies(${TEST_MAGIC_COOKIES_CLIENT} gtest) - add_dependencies(${TEST_MAGIC_COOKIES_SERVICE} gtest) - add_dependencies(${TEST_HEADER_FACTORY} gtest) - add_dependencies(${TEST_HEADER_FACTORY_CLIENT} gtest) - add_dependencies(${TEST_HEADER_FACTORY_SERVICE} gtest) - add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest) - add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest) - add_dependencies(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} gtest) - add_dependencies(${TEST_PAYLOAD_SERVICE} gtest) - add_dependencies(${TEST_PAYLOAD_CLIENT} gtest) - add_dependencies(${TEST_BIG_PAYLOAD_SERVICE} gtest) - add_dependencies(${TEST_BIG_PAYLOAD_CLIENT} gtest) - add_dependencies(${TEST_CLIENT_ID_SERVICE} gtest) - add_dependencies(${TEST_CLIENT_ID_UTILITY} gtest) - add_dependencies(${TEST_SUBSCRIBE_NOTIFY_SERVICE} gtest) - add_dependencies(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE} gtest) - add_dependencies(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT} gtest) - add_dependencies(${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} gtest) - add_dependencies(${TEST_CPU_LOAD_SERVICE} gtest) - add_dependencies(${TEST_CPU_LOAD_CLIENT} gtest) - add_dependencies(${TEST_INITIAL_EVENT_SERVICE} gtest) - add_dependencies(${TEST_INITIAL_EVENT_CLIENT} gtest) - add_dependencies(${TEST_INITIAL_EVENT_AVAILABILITY_CHECKER} gtest) - add_dependencies(${TEST_INITIAL_EVENT_STOP_SERVICE} gtest) - add_dependencies(${TEST_OFFER_SERVICE} gtest) - add_dependencies(${TEST_OFFER_CLIENT} gtest) - add_dependencies(${TEST_OFFER_SERVICE_EXTERNAL} gtest) - add_dependencies(${TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER} gtest) - add_dependencies(${TEST_OFFERED_SERVICES_INFO_CLIENT} gtest) - add_dependencies(${TEST_OFFERED_SERVICES_INFO_SERVICE} gtest) - add_dependencies(${TEST_PENDING_SUBSCRIPTION_SERVICE} gtest) - add_dependencies(${TEST_PENDING_SUBSCRIPTION_CLIENT} gtest) - add_dependencies(${TEST_MALICIOUS_DATA_SERVICE} gtest) - add_dependencies(${TEST_MALICIOUS_DATA_CLIENT} gtest) -else() - add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest) - add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest) -endif() - -############################################################################## -# Add tests to the target build_tests -############################################################################## - -if(NOT ${TESTS_BAT}) - add_dependencies(build_tests ${TEST_CONFIGURATION}) - add_dependencies(build_tests ${TEST_APPLICATION}) - add_dependencies(build_tests ${TEST_APPLICATION_SINGLE_PROCESS_NAME}) - add_dependencies(build_tests ${TEST_APPLICATION_AVAILABILITY_NAME}) - add_dependencies(build_tests ${TEST_MAGIC_COOKIES_CLIENT}) - add_dependencies(build_tests ${TEST_MAGIC_COOKIES_SERVICE}) - add_dependencies(build_tests ${TEST_HEADER_FACTORY}) - add_dependencies(build_tests ${TEST_HEADER_FACTORY_CLIENT}) - add_dependencies(build_tests ${TEST_HEADER_FACTORY_SERVICE}) - add_dependencies(build_tests ${TEST_LOCAL_ROUTING_SERVICE}) - add_dependencies(build_tests ${TEST_LOCAL_ROUTING_CLIENT}) - add_dependencies(build_tests ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}) - add_dependencies(build_tests ${TEST_PAYLOAD_SERVICE}) - add_dependencies(build_tests ${TEST_PAYLOAD_CLIENT}) - add_dependencies(build_tests ${TEST_BIG_PAYLOAD_SERVICE}) - add_dependencies(build_tests ${TEST_BIG_PAYLOAD_CLIENT}) - add_dependencies(build_tests ${TEST_CLIENT_ID_SERVICE}) - add_dependencies(build_tests ${TEST_CLIENT_ID_UTILITY}) - add_dependencies(build_tests ${TEST_SUBSCRIBE_NOTIFY_SERVICE}) - add_dependencies(build_tests ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}) - add_dependencies(build_tests ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}) - add_dependencies(build_tests ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}) - add_dependencies(build_tests ${TEST_CPU_LOAD_SERVICE}) - add_dependencies(build_tests ${TEST_CPU_LOAD_CLIENT}) - add_dependencies(build_tests ${TEST_INITIAL_EVENT_SERVICE}) - add_dependencies(build_tests ${TEST_INITIAL_EVENT_CLIENT}) - add_dependencies(build_tests ${TEST_INITIAL_EVENT_AVAILABILITY_CHECKER}) - add_dependencies(build_tests ${TEST_INITIAL_EVENT_STOP_SERVICE}) - add_dependencies(build_tests ${TEST_OFFER_SERVICE}) - add_dependencies(build_tests ${TEST_OFFER_CLIENT}) - add_dependencies(build_tests ${TEST_OFFER_SERVICE_EXTERNAL}) - add_dependencies(build_tests ${TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER}) - add_dependencies(build_tests ${TEST_OFFER_BIG_SERVICE}) - add_dependencies(build_tests ${TEST_OFFER_BIG_CLIENT}) - add_dependencies(build_tests ${TEST_RESTART_ROUTING_SERVICE}) - add_dependencies(build_tests ${TEST_RESTART_ROUTING_CLIENT}) - if (${TEST_SECURITY}) - add_dependencies(build_tests ${TEST_SECURITY_SERVICE}) - add_dependencies(build_tests ${TEST_SECURITY_CLIENT}) - endif() - add_dependencies(build_tests ${TEST_OFFERED_SERVICES_INFO_CLIENT}) - add_dependencies(build_tests ${TEST_OFFERED_SERVICES_INFO_SERVICE}) - add_dependencies(build_tests ${TEST_PENDING_SUBSCRIPTION_SERVICE}) - add_dependencies(build_tests ${TEST_PENDING_SUBSCRIPTION_CLIENT}) - add_dependencies(build_tests ${TEST_MALICIOUS_DATA_SERVICE}) - add_dependencies(build_tests ${TEST_MALICIOUS_DATA_CLIENT}) -else() - add_dependencies(build_tests ${TEST_LOCAL_ROUTING_SERVICE}) - add_dependencies(build_tests ${TEST_LOCAL_ROUTING_CLIENT}) -endif() - - - -############################################################################## -# Add tests -############################################################################## - -if(NOT ${TESTS_BAT}) - add_test(NAME ${TEST_CONFIGURATION} - COMMAND ${TEST_CONFIGURATION} - ) - - # application test - add_test(NAME ${TEST_APPLICATION} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER} - ) - set_tests_properties(${TEST_APPLICATION} PROPERTIES TIMEOUT 80) - add_test(NAME ${TEST_APPLICATION_SINGLE_PROCESS_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_STARTER} - ) - set_tests_properties(${TEST_APPLICATION_SINGLE_PROCESS_NAME} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_APPLICATION_AVAILABILITY_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_AVAILABILITY_STARTER} - ) - set_tests_properties(${TEST_APPLICATION_AVAILABILITY_NAME} PROPERTIES TIMEOUT 120) - - # magic cookies test - add_test(NAME ${TEST_MAGIC_COOKIES_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER} - ) - set_tests_properties(${TEST_MAGIC_COOKIES_NAME} PROPERTIES TIMEOUT 250) - - # Header/Factory tets - add_test(NAME ${TEST_HEADER_FACTORY_NAME} COMMAND ${TEST_HEADER_FACTORY}) - add_test(NAME ${TEST_HEADER_FACTORY_NAME}_send_receive - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_STARTER} - ) - - # Routing tests - add_test(NAME ${TEST_LOCAL_ROUTING_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER} - ) - - add_test(NAME ${TEST_EXTERNAL_LOCAL_ROUTING_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER} - ) - set_tests_properties(${TEST_EXTERNAL_LOCAL_ROUTING_NAME} PROPERTIES TIMEOUT 120) - - # Payload tests - add_test(NAME ${TEST_LOCAL_PAYLOAD_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_STARTER} - ) - add_test(NAME ${TEST_LOCAL_PAYLOAD_HUGE_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} - ) - set_tests_properties(${TEST_LOCAL_PAYLOAD_HUGE_NAME} PROPERTIES TIMEOUT 480) - add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} - ) - add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER} - ) - set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 480) - add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER} - ) - set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 480) - - # big payload tests - add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} - ) - set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} RANDOM - ) - set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} LIMITED - ) - set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} - ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} RANDOM - ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} LIMITED - ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} LIMITEDGENERAL - ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDGENERAL - ) - set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDGENERAL - ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDSPECIFIC - ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC} 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}) - set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_CLIENT_ID_UTILITY} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY}) - set_property(TEST ${TEST_CLIENT_ID_UTILITY} - APPEND PROPERTY ENVIRONMENT - "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_CONFIG_FILE}") - set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_CLIENT_ID_UTILITY}_masked_511 - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY}) - set_property(TEST ${TEST_CLIENT_ID_UTILITY}_masked_511 - APPEND PROPERTY ENVIRONMENT - "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_MASKED_511_CONFIG_FILE}") - set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_CLIENT_ID_UTILITY}_masked_4095 - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY}) - set_property(TEST ${TEST_CLIENT_ID_UTILITY}_masked_4095 - APPEND PROPERTY ENVIRONMENT - "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_MASKED_4095_CONFIG_FILE}") - set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_CLIENT_ID_UTILITY}_masked_127 - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY}) - set_property(TEST ${TEST_CLIENT_ID_UTILITY}_masked_127 - APPEND PROPERTY ENVIRONMENT - "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_MASKED_127_CONFIG_FILE}") - set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120) - - # 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}) - 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}) - 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}) - 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}) - 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}) - 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}) - 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}) - 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) - 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}) - 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 - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_udp PROPERTIES TIMEOUT 120) - - add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_tcp - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_tcp PROPERTIES TIMEOUT 120) - - # 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_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}) - 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_TCP_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} - ) - set_tests_properties(${TEST_CPU_LOAD_NAME} PROPERTIES TIMEOUT 3000) - - # 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}) - 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}) - 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}) - 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}) - 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}) - 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}) - 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}) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - 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) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120) - - # offer tests - add_test(NAME ${TEST_OFFER_NAME}_local - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_LOCAL_STARTER}) - set_tests_properties(${TEST_OFFER_NAME}_local PROPERTIES TIMEOUT 180) - add_test(NAME ${TEST_OFFER_NAME}_external - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_EXTERNAL_MASTER_STARTER}) - set_tests_properties(${TEST_OFFER_NAME}_local PROPERTIES TIMEOUT 360) - 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) - - # Restart-Routing tests - add_test(NAME ${TEST_RESTART_ROUTING_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_STARTER} - ) - if (${TEST_SECURITY}) - # Security tests - add_test(NAME ${TEST_SECURITY_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_SERVICE_START_SCRIPT} - ) - endif() - - # pending subscriptions test - add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_subscribe - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} SUBSCRIBE) - set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_subscribe PROPERTIES TIMEOUT 180) - - add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} SUBSCRIBE_UNSUBSCRIBE) - set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe PROPERTIES TIMEOUT 180) - - add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_unsubscribe - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} UNSUBSCRIBE) - set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_unsubscribe PROPERTIES TIMEOUT 180) - - add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe_nack - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} SUBSCRIBE_UNSUBSCRIBE_NACK) - set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe_nack PROPERTIES TIMEOUT 180) - - # malicious data test - add_test(NAME ${TEST_MALICIOUS_DATA_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MALICIOUS_DATA_MASTER_STARTER}) - set_tests_properties(${TEST_MALICIOUS_DATA_NAME} PROPERTIES TIMEOUT 180) -else() - # Routing tests - add_test(NAME ${TEST_LOCAL_ROUTING_NAME} - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER} - ) -endif() diff --git a/test/application_tests/application_test.cpp b/test/application_tests/application_test.cpp deleted file mode 100644 index 7862528..0000000 --- a/test/application_tests/application_test.cpp +++ /dev/null @@ -1,454 +0,0 @@ -// 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 <thread> -#include <mutex> -#include <condition_variable> -#include <future> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include "someip_test_globals.hpp" - -using namespace vsomeip; - -class someip_application_test: public ::testing::Test { -public: - someip_application_test() : - registered_(false) { - - } -protected: - void SetUp() { - app_ = runtime::get()->create_application("application_test"); - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - - app_->register_state_handler( - std::bind(&someip_application_test::on_state, this, - std::placeholders::_1)); - } - - void on_state(vsomeip::state_type_e _state) { - registered_ = (_state == vsomeip::state_type_e::ST_REGISTERED); - } - - bool registered_; - std::shared_ptr<application> app_; -}; - -/** - * @test Start and stop application - */ -TEST_F(someip_application_test, start_stop_application) -{ - std::promise<bool> its_promise; - std::thread t([&](){ - its_promise.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise.get_future().get()); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - app_->stop(); - t.join(); -} - -/** - * @test Start and stop application multiple times - */ -TEST_F(someip_application_test, start_stop_application_multiple) -{ - for (int i = 0; i < 10; ++i) { - std::promise<bool> its_promise; - std::thread t([&]() { - its_promise.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise.get_future().get()); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - app_->stop(); - t.join(); - } -} - -/** - * @test Start and stop application multiple times and offer a service - */ -TEST_F(someip_application_test, start_stop_application_multiple_offer_service) -{ - for (int i = 0; i < 10; ++i) { - std::promise<bool> its_promise; - std::thread t([&]() { - its_promise.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise.get_future().get()); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - app_->stop(); - t.join(); - } -} - -/** - * @test Try to start an already running application again - */ -TEST_F(someip_application_test, restart_without_stopping) -{ - std::promise<bool> its_promise; - std::thread t([&]() { - its_promise.set_value(true); - app_->start(); - - }); - EXPECT_TRUE(its_promise.get_future().get()); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - VSOMEIP_WARNING << "An error message should appear now"; - // should print error - app_->start(); - app_->stop(); - t.join(); -} - -/** - * @test Try to stop a running application twice - */ -TEST_F(someip_application_test, stop_application_twice) -{ - std::promise<bool> its_promise; - std::thread t([&]() { - its_promise.set_value(true); - app_->start(); - - }); - EXPECT_TRUE(its_promise.get_future().get()); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - app_->stop(); - t.join(); - app_->stop(); -} - -/** - * @test Checks whether watchdog handler is invoked (regularly) also after restarting. - */ -TEST_F(someip_application_test, watchdog_handler) -{ - std::atomic<int> cb_count(0); - auto wd_handler = [&] () { - ++cb_count; - }; - - app_->set_watchdog_handler(std::cref(wd_handler), std::chrono::seconds(1)); - - std::promise<bool> its_promise; - std::thread t([&]() { - its_promise.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise.get_future().get()); - - // wait till watchdog handler has been invoked once - while (0 == cb_count.load()) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - ASSERT_EQ(1, cb_count.load()); - - // clear handler (must not be called again) - app_->set_watchdog_handler(nullptr, std::chrono::seconds::zero()); - - // wait doubled interval (used previously).. - std::this_thread::sleep_for(std::chrono::seconds(2)); - // .. to ensure it was not called again - ASSERT_EQ(1, cb_count.load()); - - // enable handler again - app_->set_watchdog_handler(std::cref(wd_handler), std::chrono::seconds(1)); - - // wait till watchdog handler has been invoked again (2nd time) - while (1 == cb_count.load()) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - - app_->stop(); - t.join(); - - // wait doubled interval (used previously).. - std::this_thread::sleep_for(std::chrono::seconds(2)); - // .. to ensure it was not called after stop() - ASSERT_EQ(2, cb_count.load()); - - // restart application (w/ watchdog handler still set) - std::promise<bool> its_promise2; - std::thread t2([&]() { - its_promise2.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise2.get_future().get()); - - // wait till watchdog handler has been invoked again (3rd time) - while (2 == cb_count.load()) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - ASSERT_EQ(3, cb_count.load()); - - // clear handler again (must not be called again), this time via zero interval - app_->set_watchdog_handler(std::cref(wd_handler), std::chrono::seconds::zero()); - - // wait doubled interval (used previously).. - std::this_thread::sleep_for(std::chrono::seconds(2)); - // .. to ensure it was not called again - ASSERT_EQ(3, cb_count.load()); - - app_->stop(); - t2.join(); -} - -class someip_application_shutdown_test: public ::testing::Test { - -protected: - void SetUp() { - is_registered_ = false; - is_available_ = false; - - app_ = runtime::get()->create_application("application_test"); - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - - app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN, - std::bind(&someip_application_shutdown_test::on_message_shutdown, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&someip_application_shutdown_test::on_state, this, - std::placeholders::_1)); - app_->register_availability_handler( - vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - std::bind(&someip_application_shutdown_test::on_availability, - this, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - - shutdown_thread_ = std::thread(&someip_application_shutdown_test::send_shutdown_message, this); - - app_->start(); - } - - void TearDown() { - shutdown_thread_.join(); - app_->stop(); - } - - void on_state(vsomeip::state_type_e _state) { - if(_state == vsomeip::state_type_e::ST_REGISTERED) - { - std::lock_guard<std::mutex> its_lock(mutex_); - is_registered_ = true; - cv_.notify_one(); - } - } - - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available) { - (void)_service; - (void)_instance; - if(_is_available) { - std::lock_guard<std::mutex> its_lock(mutex_); - is_available_ = _is_available; - cv_.notify_one(); - } - } - - void on_message_shutdown(const std::shared_ptr<message>& _request) - { - (void)_request; - VSOMEIP_INFO << "Shutdown method was called, going down now."; - app_->clear_all_handler(); - app_->stop(); - } - - void send_shutdown_message() { - { - std::unique_lock<std::mutex> its_lock(mutex_); - while(!is_registered_) { - cv_.wait(its_lock); - } - 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); - } - } - - std::shared_ptr<message> r = runtime::get()->create_request(); - r->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID); - r->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID); - r->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN); - app_->send(r); - } - - bool is_registered_; - bool is_available_; - std::shared_ptr<application> app_; - std::condition_variable cv_; - std::mutex mutex_; - std::thread shutdown_thread_; -}; - -class someip_application_exception_test: public ::testing::Test { - -protected: - void SetUp() { - is_registered_ = false; - is_available_ = false; - - app_ = runtime::get()->create_application("application_test"); - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - - app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN, - std::bind(&someip_application_exception_test::on_message_shutdown, this, - std::placeholders::_1)); - app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN+1, - std::bind(&someip_application_exception_test::on_message_exception, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&someip_application_exception_test::on_state, this, - std::placeholders::_1)); - app_->register_availability_handler( - vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - std::bind(&someip_application_exception_test::on_availability, - this, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - - shutdown_thread_ = std::thread(&someip_application_exception_test::send_shutdown_message, this); - - app_->start(); - } - - void TearDown() { - shutdown_thread_.join(); - app_->stop(); - } - - void on_state(vsomeip::state_type_e _state) { - if(_state == vsomeip::state_type_e::ST_REGISTERED) - { - std::lock_guard<std::mutex> its_lock(mutex_); - is_registered_ = true; - cv_.notify_one(); - } - } - - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available) { - (void)_service; - (void)_instance; - if(_is_available) { - std::lock_guard<std::mutex> its_lock(mutex_); - is_available_ = _is_available; - cv_.notify_one(); - } - } - - void on_message_shutdown(const std::shared_ptr<message>& _request) - { - (void)_request; - VSOMEIP_INFO << "Shutdown method was called, going down now."; - app_->clear_all_handler(); - app_->stop(); - } - - void on_message_exception(const std::shared_ptr<message>& _request) - { - (void)_request; - throw std::invalid_argument("something went terribly wrong"); - } - - void send_shutdown_message() { - { - std::unique_lock<std::mutex> its_lock(mutex_); - while(!is_registered_) { - cv_.wait(its_lock); - } - 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); - } - } - - std::shared_ptr<message> r = runtime::get()->create_request(); - // call method which throws exception - r->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID); - 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)); - - - //shutdown test - r->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID); - r->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID); - r->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN); - app_->send(r); - } - - bool is_registered_; - bool is_available_; - std::shared_ptr<application> app_; - std::condition_variable cv_; - std::mutex mutex_; - std::thread shutdown_thread_; -}; - -/** - * @test Stop the application through a method invoked from a dispatcher thread - */ -TEST_F(someip_application_shutdown_test, stop_application_from_dispatcher_thread) { - -} - -/** - * @test Catch unhandled exceptions from invoked handlers - */ -TEST_F(someip_application_exception_test, catch_exception_in_invoked_handler) { - -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif - - - - diff --git a/test/application_tests/application_test_availability.cpp b/test/application_tests/application_test_availability.cpp deleted file mode 100644 index 06fd33e..0000000 --- a/test/application_tests/application_test_availability.cpp +++ /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/. -#include <gtest/gtest.h> - -#include "application_test_client_availability.cpp" -#include "application_test_service.cpp" -#include "application_test_daemon.cpp" - -TEST(someip_application_test_availability, register_availability_handlers) -{ - // start application acting as daemon - application_test_daemon its_daemon; - - // start receiver service - application_test_service its_receiver(application_test::service); - - // start client - application_test_client_availability its_client(application_test::service); - int counter(0); - while (!its_client.all_availability_handlers_called() && counter < 500) { - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - counter++; - } - - //shutdown - its_receiver.stop(); - its_client.stop(); - its_daemon.stop(); -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/application_tests/application_test_availability_starter.sh b/test/application_tests/application_test_availability_starter.sh deleted file mode 100755 index 645e347..0000000 --- a/test/application_tests/application_test_availability_starter.sh +++ /dev/null @@ -1,10 +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/. - -export VSOMEIP_CONFIGURATION=application_test_single_process.json -./application_test_availability - - exit $?
\ No newline at end of file diff --git a/test/application_tests/application_test_client.cpp b/test/application_tests/application_test_client.cpp deleted file mode 100644 index 25f7c09..0000000 --- a/test/application_tests/application_test_client.cpp +++ /dev/null @@ -1,199 +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 <future> -#include <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "application_test_globals.hpp" - -class application_test_client { -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), - received_responses_(0), - sent_requests_(0), - stop_called_(false), - stop_thread_(std::bind(&application_test_client::wait_for_stop, this)), - send_thread_(std::bind(&application_test_client::send, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&application_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind(&application_test_client::on_message, 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(&application_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); - std::promise<bool> its_promise; - application_thread_ = std::thread([&](){ - its_promise.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise.get_future().get()); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - - ~application_test_client() { - send_thread_.join(); - stop_thread_.join(); - application_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) { - VSOMEIP_INFO << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance - << "] is " << (_is_available ? "available":"not available") << "."; - std::lock_guard<std::mutex> its_lock(mutex_); - if(_is_available) { - wait_until_service_available_ = false; - condition_.notify_one(); - } else { - wait_until_service_available_ = true; - condition_.notify_one(); - } - } - - void on_message(const std::shared_ptr<vsomeip::message> &_message) { - ++received_responses_; - EXPECT_EQ(service_info_.service_id, _message->get_service()); - EXPECT_EQ(service_info_.method_id, _message->get_method()); - EXPECT_EQ(service_info_.instance_id, _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() << "]"; - } - - void send() { - std::unique_lock<std::mutex> its_lock(mutex_); - while (wait_until_registered_ && !stop_called_) { - condition_.wait_for(its_lock, std::chrono::milliseconds(100)); - } - - while (wait_until_service_available_ && !stop_called_) { - condition_.wait_for(its_lock, std::chrono::milliseconds(100)); - } - its_lock.unlock(); - its_lock.release(); - - for (;;) { - bool send(false); - { - std::lock_guard<std::mutex> its_lock(mutex_); - send = !wait_until_service_available_; - } - if (send && !stop_called_) { - std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request(); - its_req->set_service(service_info_.service_id); - its_req->set_instance(service_info_.instance_id); - its_req->set_method(service_info_.method_id); - app_->send(its_req); - ++sent_requests_; - VSOMEIP_INFO << "Sent a request to the service!"; - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } else { - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - } - if(stop_called_) { - break; - } - } - } - - 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"; - app_->clear_all_handler(); - app_->stop(); - } - - void stop(bool check) { - stop_called_ = true; - std::lock_guard<std::mutex> its_lock(stop_mutex_); - wait_for_stop_ = false; - VSOMEIP_INFO << "going down. Sent " << sent_requests_ - << " requests and received " << received_responses_ - << " responses. Delta: " << sent_requests_ - received_responses_; - std::uint32_t counter(0); - if (check) { - while(sent_requests_ < received_responses_) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - if(++counter > 50) { - break; - } - } - EXPECT_EQ(sent_requests_, received_responses_); - } - stop_condition_.notify_one(); - } - -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_; - std::mutex mutex_; - std::condition_variable condition_; - - bool wait_for_stop_; - std::mutex stop_mutex_; - std::condition_variable stop_condition_; - - std::atomic<std::uint32_t> received_responses_; - std::atomic<std::uint32_t> sent_requests_; - std::atomic<bool> stop_called_; - - std::thread stop_thread_; - std::thread send_thread_; - std::thread application_thread_; -}; diff --git a/test/application_tests/application_test_client_availability.cpp b/test/application_tests/application_test_client_availability.cpp deleted file mode 100644 index 5148d58..0000000 --- a/test/application_tests/application_test_client_availability.cpp +++ /dev/null @@ -1,203 +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 <future> -#include <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "application_test_globals.hpp" - -class application_test_client_availability { -public: - application_test_client_availability(struct application_test::service_info _service_info) : - service_info_(_service_info), - app_(vsomeip::runtime::get()->create_application("client")), - wait_until_registered_(true), - all_availability_handlers_called_(false), - run_thread_(std::bind(&application_test_client_availability::run, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&application_test_client_availability::on_state, this, - std::placeholders::_1)); - - // register availability handler for every possiblity of - // ANY_SERVICE, ANY_INSTANCE, ANY_MAJOR, ANY_MINOR - for (std::uint32_t i = 0; i < 16; i++) { - vsomeip::service_t its_service = (i & 0x8) ? service_info_.service_id : vsomeip::ANY_SERVICE; - vsomeip::instance_t its_instance = (i & 0x4) ? service_info_.instance_id : vsomeip::ANY_INSTANCE; - vsomeip::major_version_t its_major = (i & 0x2) ? service_info_.major_version : vsomeip::ANY_MAJOR; - vsomeip::minor_version_t its_minor = (i & 0x1) ? service_info_.minor_version : vsomeip::ANY_MINOR; - app_->register_availability_handler(its_service, - its_instance, - std::bind(&application_test_client_availability::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, i), - its_major, its_minor); - VSOMEIP_DEBUG << "Registering: " - << std::setw(4) << std::setfill('0') << std::hex << its_service << "." - << std::setw(4) << std::setfill('0') << std::hex << its_instance << "." - << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)its_major << "." - << std::setw(4) << std::setfill('0') << std::hex << its_minor << "." - << i; - - } - app_->register_availability_handler(service_info_.service_id, - service_info_.instance_id, - std::bind(&application_test_client_availability::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, 16), - service_info_.major_version, vsomeip::DEFAULT_MINOR); - VSOMEIP_DEBUG << "Registering: " - << std::setw(4) << std::setfill('0') << std::hex << service_info_.service_id << "." - << std::setw(4) << std::setfill('0') << std::hex << service_info_.instance_id << "." - << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)service_info_.service_id << "." - << std::setw(4) << std::setfill('0') << std::hex << vsomeip::DEFAULT_MINOR << "." - << 16; - app_->request_service(service_info_.service_id, - service_info_.instance_id); - std::promise<bool> its_promise; - application_thread_ = std::thread([&](){ - its_promise.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise.get_future().get()); - } - - ~application_test_client_availability() { - run_thread_.join(); - application_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, - std::uint32_t _handler_index) - { - VSOMEIP_DEBUG<< "Service [" << std::setw(4) << std::setfill('0') << std::hex - << _service << "." << std::setw(4) << std::setfill('0') << _instance << "] is " - << (_is_available ? "available." : "NOT available.") << ". " - << _handler_index; - if(service_info_.service_id == _service - && service_info_.instance_id == _instance) { - std::lock_guard<std::mutex> its_lock(availability_handler_called_mutex_); - availability_handler_called_[_handler_index] = _is_available; - availability_condition_.notify_one(); - } - } - - void run() { - { - std::unique_lock<std::mutex> its_lock(mutex_); - while (wait_until_registered_) { - condition_.wait(its_lock); - } - } - while(!app_->is_available(service_info_.service_id, - service_info_.instance_id, service_info_.major_version, - service_info_.minor_version)) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - for (std::uint32_t i = 0; i < 16; i++) { - vsomeip::service_t its_service = (i & 0x8) ? service_info_.service_id : vsomeip::ANY_SERVICE; - vsomeip::instance_t its_instance = (i & 0x4) ? service_info_.instance_id : vsomeip::ANY_INSTANCE; - vsomeip::major_version_t its_major = (i & 0x2) ? service_info_.major_version : vsomeip::ANY_MAJOR; - vsomeip::minor_version_t its_minor = (i & 0x1) ? service_info_.minor_version : vsomeip::ANY_MINOR; - - VSOMEIP_DEBUG << "Calling is_available: " - << std::setw(4) << std::setfill('0') << std::hex << its_service << "." - << std::setw(4) << std::setfill('0') << std::hex << its_instance << "." - << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)its_major << "." - << std::setw(4) << std::setfill('0') << std::hex << its_minor; - EXPECT_TRUE(app_->is_available(its_service, its_instance, its_major, its_minor)); - - VSOMEIP_DEBUG << "Calling are_available: " - << std::setw(4) << std::setfill('0') << std::hex << its_service << "." - << std::setw(4) << std::setfill('0') << std::hex << its_instance << "." - << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)its_major << "." - << std::setw(4) << std::setfill('0') << std::hex << its_minor; - vsomeip::application::available_t are_available; - EXPECT_TRUE(app_->are_available(are_available, its_service, its_instance, its_major, its_minor)); - bool found(false); - auto found_service = are_available.find(service_info_.service_id); - if(found_service != are_available.end()) { - auto found_instance = found_service->second.find(service_info_.instance_id); - if(found_instance != found_service->second.end()) { - auto found_major = found_instance->second.find(service_info_.major_version); - if (found_major != found_instance->second.end()) { - if (found_major->second == service_info_.minor_version) { - found = true; - } - } - } - } - EXPECT_TRUE(found); - - } - { - std::unique_lock<std::mutex> its_lock(availability_handler_called_mutex_); - while(!std::all_of(availability_handler_called_.cbegin(), - availability_handler_called_.cend(), - [&](const availability_handler_called_t::value_type &v) { - return v; - })) { - availability_condition_.wait(its_lock); - } - } - VSOMEIP_INFO <<" Everything is available"; - all_availability_handlers_called_ = true; - } - - void stop() { - VSOMEIP_INFO << "going down"; - app_->clear_all_handler(); - app_->stop(); - } - - bool all_availability_handlers_called() const { - return all_availability_handlers_called_; - } - -private: - struct application_test::service_info service_info_; - std::shared_ptr<vsomeip::application> app_; - std::mutex availability_handler_called_mutex_; - std::condition_variable availability_condition_; - typedef std::array<bool, 17> availability_handler_called_t; - availability_handler_called_t availability_handler_called_; - - - bool wait_until_registered_; - std::mutex mutex_; - std::condition_variable condition_; - std::atomic<bool> all_availability_handlers_called_; - std::thread run_thread_; - std::thread application_thread_; -}; diff --git a/test/application_tests/application_test_daemon.cpp b/test/application_tests/application_test_daemon.cpp deleted file mode 100644 index 43876ea..0000000 --- a/test/application_tests/application_test_daemon.cpp +++ /dev/null @@ -1,42 +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 <gtest/gtest.h> -#include <future> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -class application_test_daemon { -public: - application_test_daemon() : - app_(vsomeip::runtime::get()->create_application("daemon")) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - std::promise<bool> its_promise; - application_thread_ = std::thread([&](){ - its_promise.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise.get_future().get()); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - VSOMEIP_INFO << "Daemon starting"; - } - - ~application_test_daemon() { - application_thread_.join(); - } - - void stop() { - VSOMEIP_INFO << "Daemon stopping"; - app_->stop(); - } - -private: - std::shared_ptr<vsomeip::application> app_; - std::thread application_thread_; -}; diff --git a/test/application_tests/application_test_globals.hpp b/test/application_tests/application_test_globals.hpp deleted file mode 100644 index 7caa9db..0000000 --- a/test/application_tests/application_test_globals.hpp +++ /dev/null @@ -1,28 +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 APPLICATION_TEST_GLOBALS_HPP_ -#define APPLICATION_TEST_GLOBALS_HPP_ - -namespace application_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::major_version_t major_version; - vsomeip::minor_version_t minor_version; -}; - - -struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404, 0x2, 0x4711 }; - -static constexpr int number_of_messages_to_send = 150; -} - -#endif /* APPLICATION_TEST_GLOBALS_HPP_ */ diff --git a/test/application_tests/application_test_service.cpp b/test/application_tests/application_test_service.cpp deleted file mode 100644 index 0064fd3..0000000 --- a/test/application_tests/application_test_service.cpp +++ /dev/null @@ -1,130 +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 <future> -#include <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "application_test_globals.hpp" - -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 - // this way the same json file can be reused for all local tests - // including the ones with vsomeipd - 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)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&application_test_service::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.method_id, - std::bind(&application_test_service::on_request, this, - std::placeholders::_1)); - - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.shutdown_method_id, - std::bind(&application_test_service::on_shutdown_method_called, this, - std::placeholders::_1)); - std::promise<bool> its_promise; - application_thread_ = std::thread([&](){ - its_promise.set_value(true); - app_->start(); - }); - EXPECT_TRUE(its_promise.get_future().get()); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - - ~application_test_service() { - offer_thread_.join(); - application_thread_.join(); - } - - - void offer() { - app_->offer_service(service_info_.service_id, service_info_.instance_id, - service_info_.major_version, service_info_.minor_version); - } - - 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_request(const std::shared_ptr<vsomeip::message> &_message) { - app_->send(vsomeip::runtime::get()->create_response(_message)); - VSOMEIP_INFO << "Received a request 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() << "]"; - } - - void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) { - (void)_message; - stop(); - } - - void stop() { - stop_called_ = true; - app_->stop_offer_service(service_info_.service_id, service_info_.instance_id, - service_info_.major_version, service_info_.minor_version); - app_->clear_all_handler(); - app_->stop(); - } - - 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_ && !stop_called_) { - condition_.wait_for(its_lock, std::chrono::milliseconds(100)); - } - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Offering"; - offer(); - } - -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_; - std::condition_variable condition_; - std::atomic<bool> stop_called_; - std::thread offer_thread_; - std::thread application_thread_; -}; diff --git a/test/application_tests/application_test_single_process.cpp b/test/application_tests/application_test_single_process.cpp deleted file mode 100644 index 1d0d4a0..0000000 --- a/test/application_tests/application_test_single_process.cpp +++ /dev/null @@ -1,47 +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 <gtest/gtest.h> -#include "application_test_service.cpp" -#include "application_test_client.cpp" -#include "application_test_daemon.cpp" - -TEST(someip_application_test_single_process, notify_increasing_counter) -{ - // start application acting as daemon (rm_stub) - application_test_daemon its_daemon; - - // start receiver service (rm_proxy) - application_test_service its_receiver(application_test::service); - - // stop the daemon (rm_stub goes away) - its_daemon.stop(); - - // 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) { - // every time the client is restarted it becomes the rm_stub again - application_test_client its_client(application_test::service); - if(var != 9) { - its_client.stop(false); - } else { - // for the last iteration we sleep to make sure the communication - // between the client and the service can be established - std::this_thread::sleep_for(std::chrono::milliseconds(2000)); - its_client.stop(true); - } - } - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - its_receiver.on_shutdown_method_called(vsomeip::runtime::get()->create_message()); -} - - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/application_tests/application_test_single_process.json b/test/application_tests/application_test_single_process.json deleted file mode 100644 index b604d9a..0000000 --- a/test/application_tests/application_test_single_process.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/someip.log" - }, - "dlt":"false" - } -} diff --git a/test/application_tests/application_test_single_process_starter.sh b/test/application_tests/application_test_single_process_starter.sh deleted file mode 100755 index 3919358..0000000 --- a/test/application_tests/application_test_single_process_starter.sh +++ /dev/null @@ -1,23 +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/. - -FAIL=0 - -export VSOMEIP_CONFIGURATION=application_test_single_process.json -./application_test_single_process - -if [ $? -ne 0 ] -then - ((FAIL+=1)) -fi - -# Check if both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/application_tests/application_test_starter.sh b/test/application_tests/application_test_starter.sh deleted file mode 100755 index 3efc1b4..0000000 --- a/test/application_tests/application_test_starter.sh +++ /dev/null @@ -1,61 +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/. - -FAIL=0 - -export VSOMEIP_CONFIGURATION=application_test_no_dispatch_threads.json -./application_test - -if [ $? -ne 0 ] -then - ((FAIL+=1)) -fi - -export VSOMEIP_CONFIGURATION=application_test.json -./application_test - -if [ $? -ne 0 ] -then - ((FAIL+=1)) -fi - -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Now running same tests with vsomeipd -******************************************************************************* -******************************************************************************* -End-of-message -export VSOMEIP_CONFIGURATION=application_test_no_dispatch_threads_daemon.json -../daemon/./vsomeipd & -DAEMON_PID=$! -./application_test -if [ $? -ne 0 ] -then - ((FAIL+=1)) -fi - -kill $DAEMON_PID -wait $DAEMON_PID - -export VSOMEIP_CONFIGURATION=application_test_daemon.json -../daemon/./vsomeipd & -DAEMON_PID=$! -./application_test -if [ $? -ne 0 ] -then - ((FAIL+=1)) -fi - -kill $DAEMON_PID - -# Check if both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/application_tests/conf/application_test.json.in b/test/application_tests/conf/application_test.json.in deleted file mode 100644 index ed5a7fc..0000000 --- a/test/application_tests/conf/application_test.json.in +++ /dev/null @@ -1,38 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/someip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"application_test", - "id":"0x7788", - "num_dispatchers":"5" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678", - "reliable":"30503" - } - ], - "routing":"application_test", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -} diff --git a/test/application_tests/conf/application_test_daemon.json.in b/test/application_tests/conf/application_test_daemon.json.in deleted file mode 100644 index c84adf5..0000000 --- a/test/application_tests/conf/application_test_daemon.json.in +++ /dev/null @@ -1,38 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/someip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"application_test", - "id":"0x7788", - "num_dispatchers":"5" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678", - "reliable":"30503" - } - ], - "routing":"vsomeipd", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -} diff --git a/test/application_tests/conf/application_test_no_dispatch_threads.json.in b/test/application_tests/conf/application_test_no_dispatch_threads.json.in deleted file mode 100644 index 20d0ebd..0000000 --- a/test/application_tests/conf/application_test_no_dispatch_threads.json.in +++ /dev/null @@ -1,37 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/someip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"application_test", - "id":"0x7788" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678", - "reliable":"30503" - } - ], - "routing":"application_test", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -} 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 deleted file mode 100644 index 8dec80e..0000000 --- a/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in +++ /dev/null @@ -1,37 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/someip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"application_test", - "id":"0x7788" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678", - "reliable":"30503" - } - ], - "routing":"vsomeipd", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -} diff --git a/test/big_payload_tests/big_payload_test_client.cpp b/test/big_payload_tests/big_payload_test_client.cpp deleted file mode 100644 index 9b50e79..0000000 --- a/test/big_payload_tests/big_payload_test_client.cpp +++ /dev/null @@ -1,289 +0,0 @@ -// 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 "big_payload_test_client.hpp" -#include "big_payload_test_globals.hpp" - -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), - number_of_messages_to_send_( - test_mode_ == big_payload_test::test_mode::RANDOM ? - big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES_RANDOM : - big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES), - number_of_sent_messages_(0), - number_of_acknowledged_messages_(0), - sender_(std::bind(&big_payload_test_client::run, this)) { - switch (test_mode_) { - case big_payload_test::test_mode::RANDOM: - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_RANDOM; - break; - case big_payload_test::test_mode::LIMITED: - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_LIMITED; - break; - case big_payload_test::test_mode::LIMITED_GENERAL: - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_LIMITED_GENERAL; - break; - case big_payload_test::test_mode::QUEUE_LIMITED_GENERAL: - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_GENERAL; - break; - case big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC: - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_SPECIFIC; - break; - default: - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID; - break; - } -} - -bool big_payload_test_client::init() -{ - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - - app_->register_state_handler( - std::bind(&big_payload_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind(&big_payload_test_client::on_message, this, - std::placeholders::_1)); - - app_->register_availability_handler(service_id_, - big_payload_test::TEST_SERVICE_INSTANCE_ID, - std::bind(&big_payload_test_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - return true; -} - -void big_payload_test_client::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void big_payload_test_client::stop() -{ - VSOMEIP_INFO << "Stopping..."; - 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) { - std::this_thread::sleep_for(std::chrono::milliseconds(3000)); - ASSERT_EQ(number_of_acknowledged_messages_, number_of_messages_to_send_ / 4); - } - app_->clear_all_handler(); - app_->stop(); -} - -void big_payload_test_client::join_sender_thread(){ - sender_.join(); - 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_acknowledged_messages_, number_of_messages_to_send_ / 4); - } else { - ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_); - } -} - -void big_payload_test_client::on_state(vsomeip::state_type_e _state) -{ - if (_state == vsomeip::state_type_e::ST_REGISTERED) { - app_->request_service(service_id_, - big_payload_test::TEST_SERVICE_INSTANCE_ID, false); - } -} - -void big_payload_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 << "." << _instance << "] is " - << (_is_available ? "available." : "NOT available."); - - if(service_id_ == _service - && big_payload_test::TEST_SERVICE_INSTANCE_ID == _instance) - { - if(is_available_ && !_is_available) - { - is_available_ = false; - } - else if(_is_available && !is_available_) - { - is_available_ = true; - send(); - } - } -} - -void big_payload_test_client::on_message(const std::shared_ptr<vsomeip::message>& _response) -{ - VSOMEIP_INFO << "Received a response from Service [" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_session() - << "] size: " << std::dec << _response->get_payload()->get_length(); - static vsomeip::session_t last_session(0); - ASSERT_GT(_response->get_session(), last_session); - last_session = _response->get_session(); - - if(test_mode_ == big_payload_test::test_mode::RANDOM) { - ASSERT_LT(_response->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE_RANDOM); - } else { - ASSERT_EQ(_response->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE); - } - - bool check(true); - vsomeip::length_t len = _response->get_payload()->get_length(); - vsomeip::byte_t* datap = _response->get_payload()->get_data(); - for(unsigned int i = 0; i < len; ++i) { - check = check && datap[i] == big_payload_test::DATA_SERVICE_TO_CLIENT; - } - if(!check) { - GTEST_FATAL_FAILURE_("wrong data transmitted"); - } - number_of_acknowledged_messages_++; - 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_acknowledged_messages_ == number_of_messages_to_send_ / 4) { - send(); - } - } else if ( number_of_acknowledged_messages_ == number_of_messages_to_send_) { - send(); - } -} - -void big_payload_test_client::send() -{ - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); -} - -void big_payload_test_client::run() -{ - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - { - condition_.wait(its_lock); - } - blocked_ = false; - - request_->set_service(service_id_); - request_->set_instance(big_payload_test::TEST_SERVICE_INSTANCE_ID); - request_->set_method(big_payload_test::TEST_SERVICE_METHOD_ID); - - std::srand(static_cast<unsigned int>(std::time(0))); - - std::shared_ptr<vsomeip::payload> its_payload = - vsomeip::runtime::get()->create_payload(); - std::vector<vsomeip::byte_t> its_payload_data; - - 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); - 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 - || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL - || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) { - if (i % 2) { - // try to sent a too big payload for half of the messages - its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE + 3, - 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); - } - } 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); - 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)); - } - 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() - << "] sent a request to Service [" << std::setw(4) - << std::setfill('0') << std::hex << request_->get_service() - << "." << std::setw(4) << std::setfill('0') << std::hex - << request_->get_instance() << "] size: " << std::dec << - request_->get_payload()->get_length(); - number_of_sent_messages_++; - } - while(!blocked_) { - if (std::cv_status::timeout - == condition_.wait_for(its_lock, std::chrono::seconds(120))) { - GTEST_FATAL_FAILURE_("Didn't receive all replies within time"); - } else { - if (test_mode_ == big_payload_test::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_messages_to_send_ / 4, - number_of_acknowledged_messages_); - } else { - ASSERT_EQ(number_of_sent_messages_, - number_of_acknowledged_messages_); - } - } - } - stop(); -} - -static big_payload_test::test_mode test_mode(big_payload_test::test_mode::UNKNOWN); - -TEST(someip_big_payload_test, send_ten_messages_to_service) -{ - bool use_tcp = true; - big_payload_test_client test_client_(use_tcp, test_mode); - if (test_client_.init()) { - test_client_.start(); - test_client_.join_sender_thread(); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if (argc > 1) { - if (std::string("RANDOM") == std::string(argv[1])) { - test_mode = big_payload_test::test_mode::RANDOM; - } else if (std::string("LIMITED") == std::string(argv[1])) { - test_mode = big_payload_test::test_mode::LIMITED; - } else if (std::string("LIMITEDGENERAL") == std::string(argv[1])) { - test_mode = big_payload_test::test_mode::LIMITED_GENERAL; - } else if (std::string("QUEUELIMITEDGENERAL") == std::string(argv[1])) { - 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; - } - } - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/big_payload_tests/big_payload_test_client.hpp b/test/big_payload_tests/big_payload_test_client.hpp deleted file mode 100644 index fb03a8e..0000000 --- a/test/big_payload_tests/big_payload_test_client.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// 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/. - -#ifndef BIGPAYLOADTESTCLIENT_HPP_ -#define BIGPAYLOADTESTCLIENT_HPP_ - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> -#include <atomic> - -#include "big_payload_test_globals.hpp" -#include "../../implementation/logging/include/logger.hpp" - -class big_payload_test_client -{ -public: - big_payload_test_client(bool _use_tcp, big_payload_test::test_mode _random_mode); - bool init(); - void start(); - void stop(); - void join_sender_thread(); - void on_state(vsomeip::state_type_e _state); - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available); - void on_message(const std::shared_ptr<vsomeip::message> &_response); - void send(); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - 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_; - std::uint32_t number_of_messages_to_send_; - std::uint32_t number_of_sent_messages_; - std::atomic<std::uint32_t> number_of_acknowledged_messages_; - std::thread sender_; - vsomeip::service_t service_id_; -}; - -#endif /* BIGPAYLOADTESTCLIENT_HPP_ */ diff --git a/test/big_payload_tests/big_payload_test_client_local_start.sh b/test/big_payload_tests/big_payload_test_client_local_start.sh deleted file mode 100755 index adbf9f4..0000000 --- a/test/big_payload_tests/big_payload_test_client_local_start.sh +++ /dev/null @@ -1,10 +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/. - -# Start the client -export VSOMEIP_APPLICATION_NAME=big_payload_test_client -export VSOMEIP_CONFIGURATION=big_payload_test_local.json -./big_payload_test_client diff --git a/test/big_payload_tests/big_payload_test_client_start.sh b/test/big_payload_tests/big_payload_test_client_start.sh deleted file mode 100755 index 5258ce8..0000000 --- a/test/big_payload_tests/big_payload_test_client_start.sh +++ /dev/null @@ -1,10 +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/. - -# Start the client -export VSOMEIP_APPLICATION_NAME=big_payload_test_client -export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client.json -./big_payload_test_client diff --git a/test/big_payload_tests/big_payload_test_external_starter.sh b/test/big_payload_tests/big_payload_test_external_starter.sh deleted file mode 100755 index 6c04a3d..0000000 --- a/test/big_payload_tests/big_payload_test_external_starter.sh +++ /dev/null @@ -1,85 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit successfully. - -if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "LIMITEDGENERAL" && $1 != "QUEUELIMITEDGENERAL" && $1 != "QUEUELIMITEDSPECIFIC" ]] -then - echo "The only allowed parameter to this script is RANDOM or LIMITED or LIMITEDGENERAL." - echo "Like $0 RANDOM" - exit 1 -fi - -FAIL=0 - -# Start the client -if [[ $# -gt 0 && $1 == "RANDOM" ]]; then - export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client_random.json -elif [[ $# -gt 0 && $1 == "LIMITEDGENERAL" ]]; then - export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client_limited_general.json -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 -else - export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client.json -fi -./big_payload_test_client $1 & -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\"" & - 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"' & - 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" & - 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" & - fi -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** big_payload_test_service_external_start.sh $1 -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** big_payload_test_tcp_service.json and -** big_payload_test_tcp_client.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - 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 diff --git a/test/big_payload_tests/big_payload_test_globals.hpp b/test/big_payload_tests/big_payload_test_globals.hpp deleted file mode 100644 index 5488259..0000000 --- a/test/big_payload_tests/big_payload_test_globals.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// 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/. - -#ifndef BIG_PAYLOAD_TEST_GLOBALS_HPP_ -#define BIG_PAYLOAD_TEST_GLOBALS_HPP_ - -#include <cstdint> - -namespace big_payload_test { - constexpr std::uint32_t BIG_PAYLOAD_SIZE = 1024*600; - 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; - - constexpr std::uint32_t BIG_PAYLOAD_TEST_NUMBER_MESSAGES = 10; - constexpr std::uint32_t BIG_PAYLOAD_TEST_NUMBER_MESSAGES_RANDOM = 50; - - constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID = 0x1234; - constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_LIMITED = 0x1235; - constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_RANDOM = 0x1236; - 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_INSTANCE_ID = 0x1; - constexpr vsomeip::method_t TEST_SERVICE_METHOD_ID = 0x8421; - - enum test_mode { - RANDOM, - LIMITED, - LIMITED_GENERAL, - QUEUE_LIMITED_GENERAL, - QUEUE_LIMITED_SPECIFIC, - UNKNOWN - }; -} - -#endif /* BIG_PAYLOAD_TEST_GLOBALS_HPP_ */ diff --git a/test/big_payload_tests/big_payload_test_local.json b/test/big_payload_tests/big_payload_test_local.json deleted file mode 100644 index aa7b3ea..0000000 --- a/test/big_payload_tests/big_payload_test_local.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"debug", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"big_payload_test_service", - "id":"0x1277" - }, - { - "name":"big_payload_test_client", - "id":"0x1344" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678" - } - ], - "payload-sizes": - [ - { - "unicast":"127.0.0.1", - "ports": - [ - { - "port":"30509", - "max-payload-size":"614400" - } - ] - } - ], - "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/big_payload_test_local_limited.json b/test/big_payload_tests/big_payload_test_local_limited.json deleted file mode 100644 index a711df1..0000000 --- a/test/big_payload_tests/big_payload_test_local_limited.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"error", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"big_payload_test_service", - "id":"0x1277" - }, - { - "name":"big_payload_test_client", - "id":"0x1344" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678" - } - ], - "max-payload-size-local" : "614400", - "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/big_payload_test_local_queue_limited.json b/test/big_payload_tests/big_payload_test_local_queue_limited.json deleted file mode 100644 index 7252680..0000000 --- a/test/big_payload_tests/big_payload_test_local_queue_limited.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"error", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"big_payload_test_service", - "id":"0x1277" - }, - { - "name":"big_payload_test_client", - "id":"0x1344" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678" - } - ], - "endpoint-queue-limit-local" : "614428", - "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/big_payload_test_local_random.json b/test/big_payload_tests/big_payload_test_local_random.json deleted file mode 100644 index b49683e..0000000 --- a/test/big_payload_tests/big_payload_test_local_random.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"debug", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"big_payload_test_service", - "id":"0x1277", - "max_dispatch_time" : "5000" - }, - { - "name":"big_payload_test_client", - "id":"0x1344", - "max_dispatch_time" : "5000" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678" - } - ], - "buffer-shrink-threshold" : "2", - "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/big_payload_test_local_starter.sh b/test/big_payload_tests/big_payload_test_local_starter.sh deleted file mode 100755 index 6439cac..0000000 --- a/test/big_payload_tests/big_payload_test_local_starter.sh +++ /dev/null @@ -1,52 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit successfully. - -if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "QUEUELIMITEDGENERAL" ]] -then - echo "The only allowed parameter to this script is RANDOM or LIMITED or QUEUELIMITEDGENERAL." - echo "Like $0 RANDOM" - exit 1 -fi - - -FAIL=0 - -# Start the service -if [[ $# -gt 0 && $1 == "RANDOM" ]]; then - export VSOMEIP_CONFIGURATION=big_payload_test_local_random.json -elif [[ $# -gt 0 && $1 == "LIMITED" ]]; then - export VSOMEIP_CONFIGURATION=big_payload_test_local_limited.json -elif [[ $# -gt 0 && $1 == "QUEUELIMITEDGENERAL" ]]; then - export VSOMEIP_CONFIGURATION=big_payload_test_local_queue_limited.json -else - export VSOMEIP_CONFIGURATION=big_payload_test_local.json -fi -./big_payload_test_service $1 & - -# Start the client -./big_payload_test_client $1 & - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if client and server both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/big_payload_tests/big_payload_test_service.cpp b/test/big_payload_tests/big_payload_test_service.cpp deleted file mode 100644 index 4031550..0000000 --- a/test/big_payload_tests/big_payload_test_service.cpp +++ /dev/null @@ -1,246 +0,0 @@ -// 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 "big_payload_test_service.hpp" - -#include "big_payload_test_globals.hpp" - -big_payload_test_service::big_payload_test_service(big_payload_test::test_mode _test_mode) : - app_(vsomeip::runtime::get()->create_application("big_payload_test_service")), - is_registered_(false), - blocked_(false), - test_mode_(_test_mode), - number_of_received_messages_(0), - offer_thread_(std::bind(&big_payload_test_service::run, this)) -{ - switch (test_mode_) { - case big_payload_test::test_mode::RANDOM: - expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES_RANDOM; - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_RANDOM; - break; - case big_payload_test::test_mode::LIMITED: - expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2; - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_LIMITED; - break; - case big_payload_test::test_mode::LIMITED_GENERAL: - expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2; - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_LIMITED_GENERAL; - break; - case big_payload_test::test_mode::QUEUE_LIMITED_GENERAL: - expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2; - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_GENERAL; - break; - case big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC: - expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2; - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_SPECIFIC; - break; - default: - expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES; - service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID; - break; - } -} - -bool big_payload_test_service::init() -{ - std::lock_guard<std::mutex> its_lock(mutex_); - std::srand(static_cast<unsigned int>(std::time(0))); - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - app_->register_message_handler(vsomeip::ANY_SERVICE, - big_payload_test::TEST_SERVICE_INSTANCE_ID, - big_payload_test::TEST_SERVICE_METHOD_ID, - std::bind(&big_payload_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&big_payload_test_service::on_state, this, - std::placeholders::_1)); - return true; -} - -void big_payload_test_service::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void big_payload_test_service::stop() -{ - VSOMEIP_INFO << "Stopping..."; - stop_offer(); - app_->clear_all_handler(); - app_->stop(); -} - -void big_payload_test_service::join_offer_thread() -{ - offer_thread_.join(); -} - -void big_payload_test_service::offer() { - app_->offer_service(service_id_, - big_payload_test::TEST_SERVICE_INSTANCE_ID); -} - -void big_payload_test_service::stop_offer() { - app_->stop_offer_service(service_id_, - big_payload_test::TEST_SERVICE_INSTANCE_ID); -} - -void big_payload_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 big_payload_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() << "] 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 + 3, - 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; - condition_.notify_one(); - } -} - -void big_payload_test_service::run() -{ - { - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) { - condition_.wait(its_lock); - } - - offer(); - - // wait for shutdown - blocked_ = false; - while (!blocked_) { - condition_.wait(its_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_); - } - stop(); -} - -static big_payload_test::test_mode test_mode(big_payload_test::test_mode::UNKNOWN); - - -TEST(someip_big_payload_test, receive_ten_messages_and_send_reply) -{ - big_payload_test_service test_service(test_mode); - if (test_service.init()) { - test_service.start(); - test_service.join_offer_thread(); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if (argc > 1) { - if (std::string("RANDOM") == std::string(argv[1])) { - test_mode = big_payload_test::test_mode::RANDOM; - } else if (std::string("LIMITED") == std::string(argv[1])) { - test_mode = big_payload_test::test_mode::LIMITED; - } else if (std::string("LIMITEDGENERAL") == std::string(argv[1])) { - test_mode = big_payload_test::test_mode::LIMITED_GENERAL; - } else if (std::string("QUEUELIMITEDGENERAL") == std::string(argv[1])) { - 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; - } - } - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/big_payload_tests/big_payload_test_service.hpp b/test/big_payload_tests/big_payload_test_service.hpp deleted file mode 100644 index 8db42f7..0000000 --- a/test/big_payload_tests/big_payload_test_service.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// 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/. - -#ifndef BIGPAYLOADTESTSERVICE_HPP_ -#define BIGPAYLOADTESTSERVICE_HPP_ -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> - -#include "big_payload_test_globals.hpp" -#include "../../implementation/logging/include/logger.hpp" - - -class big_payload_test_service -{ -public: - big_payload_test_service(big_payload_test::test_mode _test_mode); - bool init(); - void start(); - void stop(); - void offer(); - void stop_offer(); - void join_offer_thread(); - void on_state(vsomeip::state_type_e _state); - void on_message(const std::shared_ptr<vsomeip::message> &_request); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - big_payload_test::test_mode test_mode_; - std::uint32_t number_of_received_messages_; - std::thread offer_thread_; - std::uint32_t expected_messages_; - vsomeip::service_t service_id_; -}; - -#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 deleted file mode 100755 index de3224c..0000000 --- a/test/big_payload_tests/big_payload_test_service_external_start.sh +++ /dev/null @@ -1,26 +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/. - -if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "LIMITEDGENERAL" && $1 != "QUEUELIMITEDGENERAL" && $1 != "QUEUELIMITEDSPECIFIC" ]] -then - echo "The only allowed parameter to this script is RANDOM, LIMITED, LIMITEDGENERAL, QUEUELIMITEDGENERAL or QUEUELIMITEDSPECIFIC" - echo "Like $0 RANDOM" - exit 1 -fi - -# Start the service -if [[ $# -gt 0 && $1 == "RANDOM" ]]; then - export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service_random.json -elif [[ $# -gt 0 && $1 == "LIMITEDGENERAL" ]]; then - export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service_limited_general.json -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 -else - export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service.json -fi -./big_payload_test_service $1 diff --git a/test/big_payload_tests/big_payload_test_service_local_start.sh b/test/big_payload_tests/big_payload_test_service_local_start.sh deleted file mode 100755 index 299af82..0000000 --- a/test/big_payload_tests/big_payload_test_service_local_start.sh +++ /dev/null @@ -1,10 +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/. - -# Start the service -export VSOMEIP_APPLICATION_NAME=big_payload_test_service -export VSOMEIP_CONFIGURATION=big_payload_test_local.json -./big_payload_test_service diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in deleted file mode 100644 index 0f23a10..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in +++ /dev/null @@ -1,43 +0,0 @@ -{ - "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" - } - ], - "payload-sizes": - [ - { - "unicast":"@TEST_IP_SLAVE@", - "ports": - [ - { - "port":"30509", - "max-payload-size":"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_tcp_client_limited_general.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_limited_general.json.in deleted file mode 100644 index f28efc8..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_client_limited_general.json.in +++ /dev/null @@ -1,31 +0,0 @@ -{ - "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-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_tcp_client_queue_limited_general.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_general.json.in deleted file mode 100644 index a193ab8..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_general.json.in +++ /dev/null @@ -1,31 +0,0 @@ -{ - "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" - } - ], - "endpoint-queue-limit-external" : "614416", - "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_tcp_client_queue_limited_specific.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_specific.json.in deleted file mode 100644 index 79f3486..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_specific.json.in +++ /dev/null @@ -1,43 +0,0 @@ -{ - "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" - } - ], - "endpoint-queue-limits" : - [ - { - "unicast":"@TEST_IP_SLAVE@", - "ports": - [ - { - "port":"30509", - "queue-size-limit":"614416" - } - ] - } - ], - "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_tcp_client_random.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in deleted file mode 100644 index 85cf393..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in +++ /dev/null @@ -1,32 +0,0 @@ -{ - "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_dispatch_time" : "5000" - } - ], - "buffer-shrink-threshold" : "2", - "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_tcp_service.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service.json.in deleted file mode 100644 index 08149bb..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_service.json.in +++ /dev/null @@ -1,81 +0,0 @@ -{ - "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" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1235", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1236", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1237", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - } - ], - "payload-sizes": - [ - { - "unicast":"@TEST_IP_SLAVE@", - "ports": - [ - { - "port":"30509", - "max-payload-size":"614400" - } - ] - } - ], - "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_tcp_service_limited_general.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_limited_general.json.in deleted file mode 100644 index f8414f3..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_service_limited_general.json.in +++ /dev/null @@ -1,69 +0,0 @@ -{ - "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" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1235", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1236", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1237", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - } - ], - "max-payload-size-reliable":"614400", - "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_tcp_service_queue_limited_general.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_general.json.in deleted file mode 100644 index ad5b28c..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_general.json.in +++ /dev/null @@ -1,87 +0,0 @@ -{ - "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" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1235", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1236", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1237", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1238", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1239", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - } - ], - "endpoint-queue-limit-external" : "614416", - "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_tcp_service_queue_limited_specific.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_specific.json.in deleted file mode 100644 index 87bcdaa..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_specific.json.in +++ /dev/null @@ -1,99 +0,0 @@ -{ - "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" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1235", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1236", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1237", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1238", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1239", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - } - ], - "endpoint-queue-limits" : - [ - { - "unicast":"@TEST_IP_SLAVE@", - "ports": - [ - { - "port":"30509", - "queue-size-limit":"614416" - } - ] - } - ], - "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_tcp_service_random.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in deleted file mode 100644 index d583fd1..0000000 --- a/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "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_dispatch_time" : "5000" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1235", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1236", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1237", - "instance":"0x01", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"false" - } - } - ], - "buffer-shrink-threshold" : "2", - "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_globals.hpp b/test/client_id_tests/client_id_test_globals.hpp deleted file mode 100644 index 52dd069..0000000 --- a/test/client_id_tests/client_id_test_globals.hpp +++ /dev/null @@ -1,33 +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 CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_ -#define CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_ - -namespace client_id_test { - -struct service_info { - vsomeip::service_t service_id; - vsomeip::instance_t instance_id; - vsomeip::method_t method_id; -}; - -static constexpr std::array<service_info, 7> service_infos = {{ - // placeholder to be consistent w/ client ids, service ids, app names - { 0xFFFF, 0xFFFF, 0xFFFF }, - // node 1 - { 0x1000, 0x1, 0x1111 }, - { 0x2000, 0x1, 0x2222 }, - { 0x3000, 0x1, 0x3333 }, - // node 2 - { 0x4000, 0x1, 0x4444 }, - { 0x5000, 0x1, 0x5555 }, - { 0x6000, 0x1, 0x6666 } -}}; - -static constexpr int messages_to_send = 10; -} - -#endif /* CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_ */ diff --git a/test/client_id_tests/client_id_test_master_starter.sh b/test/client_id_tests/client_id_test_master_starter.sh deleted file mode 100755 index c0b2a0b..0000000 --- a/test/client_id_tests/client_id_test_master_starter.sh +++ /dev/null @@ -1,85 +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. - -if [ $# -lt 1 ] -then - echo "Please pass a json file to this script." - echo "For example: $0 client_id_test_diff_client_ids_diff_ports_master.json" - exit 1 -fi - -MASTER_JSON_FILE=$1 -CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave} - -FAIL=0 - -# Start the services -export VSOMEIP_APPLICATION_NAME=client_id_test_service_one -export VSOMEIP_CONFIGURATION=$1 -./client_id_test_service 1 & -CLIENT_ID_PIDS[1]=$! - -export VSOMEIP_APPLICATION_NAME=client_id_test_service_two -export VSOMEIP_CONFIGURATION=$1 -./client_id_test_service 2 & -CLIENT_ID_PIDS[2]=$! - -export VSOMEIP_APPLICATION_NAME=client_id_test_service_three -export VSOMEIP_CONFIGURATION=$1 -./client_id_test_service 3 & -CLIENT_ID_PIDS[3]=$! - -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\"" & -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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** client_id_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 -** client_id_test_diff_client_ids_diff_ports_master.json and -** client_id_test_diff_client_ids_diff_ports_slave.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# Wait until client and service are finished -for client_pid in "${CLIENT_ID_PIDS[@]}" -do - if [ -n "$client_pid" ]; then - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait "$client_pid" || ((FAIL+=1)) - fi -done - -if [ ! -z "$USE_DOCKER" ]; then - docker stop citms - docker rm citms -fi - -# Check if both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/client_id_tests/client_id_test_service.cpp b/test/client_id_tests/client_id_test_service.cpp deleted file mode 100644 index 9306bad..0000000 --- a/test/client_id_tests/client_id_test_service.cpp +++ /dev/null @@ -1,266 +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 "client_id_test_globals.hpp" - - -class client_id_test_service { -public: - client_id_test_service(struct client_id_test::service_info _service_info) : - service_info_(_service_info), - app_(vsomeip::runtime::get()->create_application()), - blocked_(false), - offer_thread_(std::bind(&client_id_test_service::run, this)), - stopped_(false), - stop_thread_(std::bind(&client_id_test_service::wait_for_stop, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&client_id_test_service::on_state, this, - std::placeholders::_1)); - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.method_id, - std::bind(&client_id_test_service::on_request, this, - std::placeholders::_1)); - app_->register_message_handler(vsomeip::ANY_SERVICE, - service_info_.instance_id, vsomeip::ANY_METHOD, - std::bind(&client_id_test_service::on_response, this, - std::placeholders::_1)); - - for(const auto& i : client_id_test::service_infos) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) { - continue; - } - app_->request_service(i.service_id, i.instance_id); - app_->register_availability_handler(i.service_id, i.instance_id, - std::bind(&client_id_test_service::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - - other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false; - other_services_received_response_[std::make_pair(i.service_id, i.method_id)] = 0; - } - - app_->start(); - } - - ~client_id_test_service() { - offer_thread_.join(); - stop_thread_.join(); - } - - void offer() { - app_->offer_service(service_info_.service_id, service_info_.instance_id); - } - - void stop_offer() { - 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 " - << (_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_); - blocked_ = true; - condition_.notify_one(); - } - } - - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available) { - if(_is_available) { - VSOMEIP_INFO - << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is " - << (_is_available ? "available." : "NOT available."); - - auto its_service = other_services_available_.find(std::make_pair(_service, _instance)); - if(its_service != other_services_available_.end()) { - its_service->second = true; - } - - 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;})) { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); - } - } - } - - void on_request(const std::shared_ptr<vsomeip::message> &_message) { - if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) { - VSOMEIP_DEBUG - << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id - << "] Received a request 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() << "]"; - std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get() - ->create_response(_message); - app_->send(its_response); - } - } - - void on_response(const std::shared_ptr<vsomeip::message> &_message) { - if(_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { - VSOMEIP_DEBUG - << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id - << "] 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() <<"]"; - other_services_received_response_[std::make_pair(_message->get_service(), - _message->get_method())]++; - - if(std::all_of(other_services_received_response_.cbegin(), - other_services_received_response_.cend(), - [](const std::map<std::pair<vsomeip::service_t, - vsomeip::method_t>, std::uint32_t>::value_type& v) - { return v.second == client_id_test::messages_to_send;})) { - std::lock_guard<std::mutex> its_lock(stop_mutex_); - stopped_ = true; - stop_condition_.notify_one(); - } - } - } - - void run() { - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) { - condition_.wait(its_lock); - } - blocked_ = false; - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Offering"; - offer(); - - - while (!blocked_) { - condition_.wait(its_lock); - } - blocked_ = false; - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Sending"; - // send a message to all other services - for (int var = 0; var < client_id_test::messages_to_send; ++var) { - for(const client_id_test::service_info& i: client_id_test::service_infos) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) { - continue; - } - std::shared_ptr<vsomeip::message> msg = vsomeip::runtime::get()->create_request(); - msg->set_service(i.service_id); - msg->set_instance(i.instance_id); - msg->set_method(i.method_id); - app_->send(msg); - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') - << std::hex << service_info_.service_id - << "] Sending a request to Service/Method [" - << std::setw(4) << std::setfill('0') << std::hex - << i.service_id << "/" << std::setw(4) << std::setfill('0') - << std::hex << i.instance_id <<"]"; - } - } - - while (!blocked_) { - condition_.wait(its_lock); - } - blocked_ = false; - } - - void wait_for_stop() { - std::unique_lock<std::mutex> its_lock(stop_mutex_); - while (!stopped_) { - stop_condition_.wait(its_lock); - } - VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id - << "] Received responses from all other services, going down"; - - // let offer thread exit - { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); - } - - std::this_thread::sleep_for(std::chrono::seconds(3)); - app_->clear_all_handler(); - app_->stop(); - } - -private: - client_id_test::service_info service_info_; - 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_response_; - - bool blocked_; - std::mutex mutex_; - std::condition_variable condition_; - std::thread offer_thread_; - - bool stopped_; - std::mutex stop_mutex_; - std::condition_variable stop_condition_; - std::thread stop_thread_; -}; - -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]); -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl; - std::cerr << "Valid service numbers are in the range of [1,6]" << std::endl; - return 1; - } - service_number = std::stoi(std::string(argv[1]), nullptr); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/client_id_tests/client_id_test_slave_starter.sh b/test/client_id_tests/client_id_test_slave_starter.sh deleted file mode 100755 index 4553521..0000000 --- a/test/client_id_tests/client_id_test_slave_starter.sh +++ /dev/null @@ -1,50 +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. - -if [ $# -lt 1 ] -then - echo "Please pass a json file to this script." - echo "For example: $0 client_id_test_diff_client_ids_diff_ports_slave.json" - exit 1 -fi - -FAIL=0 - -# Start the services -export VSOMEIP_APPLICATION_NAME=client_id_test_service_four -export VSOMEIP_CONFIGURATION=$1 -./client_id_test_service 4 & - -export VSOMEIP_APPLICATION_NAME=client_id_test_service_five -export VSOMEIP_CONFIGURATION=$1 -./client_id_test_service 5 & - -export VSOMEIP_APPLICATION_NAME=client_id_test_service_six -export VSOMEIP_CONFIGURATION=$1 -./client_id_test_service 6 & - - -# Wait until all applications are finished -for job in $(jobs -p) -do - # Fail gets incremented if one of the binaries exits - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/client_id_tests/client_id_test_utility.cpp b/test/client_id_tests/client_id_test_utility.cpp deleted file mode 100644 index 1512146..0000000 --- a/test/client_id_tests/client_id_test_utility.cpp +++ /dev/null @@ -1,474 +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 <gtest/gtest.h> - -#include <unistd.h> // for access() -#include <sstream> - -#include <vsomeip/constants.hpp> - -#include "../../implementation/utility/include/utility.hpp" -#include "../../implementation/configuration/include/configuration.hpp" -#include "../../implementation/plugin/include/plugin_manager.hpp" - -using namespace vsomeip; - -static const std::string APPLICATION_NAME_ROUTING_MANAGER = "vsomeipd"; - -static const std::string APPLICATION_NAME_NOT_PREDEFINED = "test-application-name"; - -vsomeip::client_t CLIENT_ID_ROUTING_MANAGER = 0xFFFF; - -static const std::string APPLICATION_IN_NAME = "client_id_test_utility_service_in"; -static vsomeip::client_t APPLICATION_IN_CLIENT_ID = 0xFFFF; - -static const std::string APPLICATION_IN_NAME_TWO = "client_id_test_utility_service_in_two"; -static vsomeip::client_t APPLICATION_IN_CLIENT_ID_TWO = 0xFFFF; - -static const std::string APPLICATION_OUT_LOW_NAME = "client_id_test_utility_service_out_low"; -static const vsomeip::client_t APPLICATION_OUT_LOW_CLIENT_ID = 0x5911; - -static const std::string APPLICATION_OUT_HIGH_NAME = "client_id_test_utility_service_out_high"; -static const vsomeip::client_t APPLICATION_OUT_HIGH_CLIENT_ID = 0x7411; - -class client_id_utility_test: public ::testing::Test { -public: - client_id_utility_test() : - client_id_routing_manager_(0x0), - diagnosis_(0x0), - diagnosis_mask_(0xFF00), - client_id_base_(0x0) { - - 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) { - configuration_ = std::dynamic_pointer_cast<vsomeip::configuration>(its_plugin); - } - } -protected: - virtual void SetUp() { - 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; - 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_)))); - - 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_)); - } - - 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; - } - } - -protected: - std::shared_ptr<configuration> configuration_; - vsomeip::client_t client_id_routing_manager_; - std::uint16_t diagnosis_; - std::uint16_t diagnosis_mask_; - client_t client_id_base_; -}; - -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); - - utility::release_client_id(its_client_id); -} - -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); - - utility::release_client_id(its_client_id); - utility::release_client_id(its_client_id_2); -} - -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); - - utility::release_client_id(0x4711); - utility::release_client_id(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); - utility::release_client_id(its_client_id_2); -} - -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); - - utility::release_client_id(its_client_id); - utility::release_client_id(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); - 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); - - 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); - } - } - - // release all - for (const client_t c : its_client_ids) { - utility::release_client_id(c); - } -} - -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); -} - -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); -} - -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); - - 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); -} - -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); -} - -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); - - utility::release_client_id(its_client_id); -} - -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); - - 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); -} - -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); -} - -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); - - utility::release_client_id(its_client_id); -} - -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); - - 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); - - utility::release_client_id(its_client_id); - utility::release_client_id(its_client_id_2); -} - -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); -} - - -TEST_F(client_id_utility_test, exhaust_client_id_range_sequential) { - std::vector<client_t> its_client_ids; - - const std::uint16_t max_possible_clients = static_cast<std::uint16_t>(~diagnosis_mask_); - // -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); - - // 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 - 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); - } - } - -TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented) { - std::vector<client_t> its_client_ids; - - // -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_possible_clients = static_cast<std::uint16_t>(~diagnosis_mask_); - 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) { - 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]); - } - } - 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; - } - } - } - - // 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) { - 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); - - // release all - for (const client_t c : its_client_ids) { - utility::release_client_id(c); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/client_id_tests/client_id_test_utility.json b/test/client_id_tests/client_id_test_utility.json deleted file mode 100644 index e928b05..0000000 --- a/test/client_id_tests/client_id_test_utility.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "diagnosis":"0x63", - "applications": - [ - { - "name":"client_id_test_utility_service_in", - "id":"0x6311" - }, - { - "name":"client_id_test_utility_service_in_two", - "id":"0x6312" - }, - { - "name":"client_id_test_utility_service_out_low", - "id":"0x5911" - }, - { - "name":"client_id_test_utility_service_out_high", - "id":"0x7411" - } - ], - "routing":"vsomeipd" -} 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 deleted file mode 100644 index c7c255b..0000000 --- a/test/client_id_tests/client_id_test_utility_masked_127.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "diagnosis":"0x63", - "diagnosis_mask":"0xFF80", - "applications": - [ - { - "name":"client_id_test_utility_service_in", - "id":"0x6311" - }, - { - "name":"client_id_test_utility_service_in_two", - "id":"0x6312" - }, - { - "name":"client_id_test_utility_service_out_low", - "id":"0x5911" - }, - { - "name":"client_id_test_utility_service_out_high", - "id":"0x7411" - } - ], - "routing":"vsomeipd" -} 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 deleted file mode 100644 index dfc42c0..0000000 --- a/test/client_id_tests/client_id_test_utility_masked_4095.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "diagnosis":"0x63", - "diagnosis_mask":"0xF000", - "applications": - [ - { - "name":"client_id_test_utility_service_in", - "id":"0x6011" - }, - { - "name":"client_id_test_utility_service_in_two", - "id":"0x6012" - }, - { - "name":"client_id_test_utility_service_out_low", - "id":"0x5911" - }, - { - "name":"client_id_test_utility_service_out_high", - "id":"0x7411" - } - ], - "routing":"vsomeipd" -} 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 deleted file mode 100644 index 274a5e0..0000000 --- a/test/client_id_tests/client_id_test_utility_masked_511.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "diagnosis":"0x63", - "diagnosis_mask":"0xFE00", - "applications": - [ - { - "name":"client_id_test_utility_service_in", - "id":"0x6211" - }, - { - "name":"client_id_test_utility_service_in_two", - "id":"0x6212" - }, - { - "name":"client_id_test_utility_service_out_low", - "id":"0x5911" - }, - { - "name":"client_id_test_utility_service_out_high", - "id":"0x7411" - } - ], - "routing":"vsomeipd" -} diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in deleted file mode 100644 index a986dd9..0000000 --- a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_one", - "id":"0x1111" - }, - { - "name":"client_id_test_service_two", - "id":"0x2222" - }, - { - "name":"client_id_test_service_three", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x1000", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2000", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3000", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_one", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in deleted file mode 100644 index 596f842..0000000 --- a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_four", - "id":"0x4444" - }, - { - "name":"client_id_test_service_five", - "id":"0x5555" - }, - { - "name":"client_id_test_service_six", - "id":"0x6666" - } - ], - "services": - [ - { - "service":"0x4000", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5000", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6000", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_four", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_master.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_master.json.in deleted file mode 100644 index bb3507b..0000000 --- a/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_master.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_one", - "id":"0x1111" - }, - { - "name":"client_id_test_service_two", - "id":"0x2222" - }, - { - "name":"client_id_test_service_three", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x1000", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2000", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3000", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_one", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_slave.json.in deleted file mode 100644 index a7337e9..0000000 --- a/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_slave.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_four", - "id":"0x4444" - }, - { - "name":"client_id_test_service_five", - "id":"0x5555" - }, - { - "name":"client_id_test_service_six", - "id":"0x6666" - } - ], - "services": - [ - { - "service":"0x4000", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5000", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6000", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_four", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in deleted file mode 100644 index 9f7062f..0000000 --- a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_one", - "id":"0x1111" - }, - { - "name":"client_id_test_service_two", - "id":"0x2222" - }, - { - "name":"client_id_test_service_three", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x1000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_one", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in deleted file mode 100644 index 1aaf2cb..0000000 --- a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_four", - "id":"0x4444" - }, - { - "name":"client_id_test_service_five", - "id":"0x5555" - }, - { - "name":"client_id_test_service_six", - "id":"0x6666" - } - ], - "services": - [ - { - "service":"0x4000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_four", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in deleted file mode 100644 index a986dd9..0000000 --- a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_one", - "id":"0x1111" - }, - { - "name":"client_id_test_service_two", - "id":"0x2222" - }, - { - "name":"client_id_test_service_three", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x1000", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2000", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3000", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_one", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in deleted file mode 100644 index 2acb37b..0000000 --- a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_four", - "id":"0x1111" - }, - { - "name":"client_id_test_service_five", - "id":"0x2222" - }, - { - "name":"client_id_test_service_six", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x4000", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5000", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6000", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_four", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in deleted file mode 100644 index 9f7062f..0000000 --- a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_one", - "id":"0x1111" - }, - { - "name":"client_id_test_service_two", - "id":"0x2222" - }, - { - "name":"client_id_test_service_three", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x1000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_one", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in deleted file mode 100644 index ae534b1..0000000 --- a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in +++ /dev/null @@ -1,70 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"client_id_test_service_four", - "id":"0x1111" - }, - { - "name":"client_id_test_service_five", - "id":"0x2222" - }, - { - "name":"client_id_test_service_six", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x4000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6000", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "routing":"client_id_test_service_four", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/configuration_tests/configuration-test-deprecated.json b/test/configuration_tests/configuration-test-deprecated.json deleted file mode 100644 index 5ffacce..0000000 --- a/test/configuration_tests/configuration-test-deprecated.json +++ /dev/null @@ -1,366 +0,0 @@ -{ - "unicast" : "10.0.2.15", - "diagnosis" : "85", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : { "enable" : "true", "path" : "/home/someip/another-file.log" }, - "dlt" : "false", - "version" : { - "enable" : "false", - "interval" : "15" - } - }, - "watchdog" : - { - "enable" : "true", - "timeout" : "1234", - "allowed_missing_pongs" : "7" - }, - "file-permissions" : - { - "permissions-shm" : "444", - "umask" : "222" - }, - "supports_selective_broadcasts" : - { - "address" : "160.160.160.160" - }, - "tracing" : - { - "enable" : "true", - "sd_enable" : "true", - "channels" : - [ - { - "name" : "testname", - "id" : "testid" - }, - { - "name" : "testname2", - "id" : "testid2" - } - ], - "filters" : - [ - { - "channel" : "testname", - "services" : ["0x1111",2222], - "methods" : ["0x1111",2222], - "clients" : ["0x1111",2222] - }, - { - "channel" : "testname2", - "services" : ["0x3333",4444], - "methods" : ["0x3333",4444], - "clients" : ["0x3333",4444] - } - ] - }, - "applications" : - [ - { - "name" : "my_application", - "id" : "0x7788", - "max_dispatchers" : "25", - "max_dispatch_time" : "1234", - "threads" : "12", - "request_debounce_time" : "5000", - "plugins" : - [ - { - "application_plugin" : "testlibraryname" - }, - { - "intentionally_wrong_plugin" : "wrong" - } - ] - }, - { - "name" : "other_application", - "id" : "0x9933", - "threads" : "0", - "threads" : "256", - "request_debounce_time" : "10001" - } - ], - "servicegroups" : - [ - { - "name" : "default", - "unicast" : "local", - "delays" : - { - "initial" : { "minimum" : "10", "maximum" : "100" }, - "repetition-base" : "200", - "repetition-max" : "7", - "cyclic-offer" : "2132", - "cyclic-request" : "2001", - "ttl" : "5" - }, - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x0022", - "reliable" : { "port" : "30506", "enable-magic-cookies" : "true" }, - "unreliable" : "31000", - "events" : - [ - { - "event" : "0x0778", - "is_field" : "false" - }, - { - "event" : "0x779", - "is_field" : "true" - }, - { - "event" : "0x77A", - "is_field" : "false" - } - ], - "eventgroups" : - [ - { - "eventgroup" : "0x4567", - "multicast" : "225.226.227.228", - "events" : [ "0x778", "0x779" ] - }, - { - "eventgroup" : "0x4569", - "multicast" : "225.227.227.228", - "events" : [ "0x779", "0x77A" ] - }, - { - "eventgroup" : "0x4569", - "multicast" : "225.222.227.228", - "events" : [ "0x778", "0x77A" ] - } - ] - }, - { - "service" : "0x1234", - "instance" : "0x0023", - "reliable" : "30503" - }, - { - "service" : "0x7809", - "instance" : "0x1", - "multicast" : - { - "address" : "224.212.244.225", - "port" : "1234" - }, - "eventgroups" : - [ - { - "eventgroup" : "0x1111", - "threshold" : "8", - "is_multicast" : "true", - "events" : [ "0x778", "0x77A" ] - } - ] - } - ] - }, - { - "name" : "extra", - "unicast" : "local", - "delays" : - { - "initial" : { "minimum" : "10", "maximum" : "100" }, - "repetition-base" : "200", - "repetition-max" : "7", - "cyclic-offer" : "2132", - "cyclic-request" : "2001", - "ttl" : "5" - }, - "services" : - [ - { - "service" : "0x2277", - "instance" : "0x0022", - "reliable" : { "port" : "30505" }, - "unreliable" : "31001" - }, - { - "service" : "0x2266", - "instance" : "0x0022", - "reliable" : "30505", - "unreliable" : "30507" - }, - { - "service" : "0x3333", - "instance" : "0x1" - }, - { - "service" : "0x3555", - "instance" : "0x1", - "protocol" : "other" - } - ] - }, - { - "name" : "remote", - "unicast" : "10.0.2.23", - "services" : - [ - { - "service" : "0x4466", - "instance" : "0x0321", - "reliable" : "30506", - "unreliable" : "30444" - } - ] - } - ], - "internal_services" : - [ - { - "first" : "0xF100", - "last" : "0xF109" - }, - { - "first" : { - "service" : "0xF300", - "instance" : "0x1" - }, - "last" : { - "service" : "0xF300", - "instance" : "0x10" - } - } - ], - "clients" : - [ - { - "reliable_remote_ports" : { "first" : "30500", "last" : "30599" }, - "unreliable_remote_ports" : { "first" : "30500", "last" : "30599" }, - "reliable_client_ports" : { "first" : "30491", "last" : "30499" }, - "unreliable_client_ports" : { "first" : "30491", "last" : "30499" } - }, - { - "reliable_remote_ports" : { "first" : "31500", "last" : "31599" }, - "unreliable_remote_ports" : { "first" : "31500", "last" : "31599" }, - "reliable_client_ports" : { "first" : "31491", "last" : "31499" }, - "unreliable_client_ports" : { "first" : "31491", "last" : "31499" } - }, - { - "reliable_remote_ports" : { "first" : "32500", "last" : "32599" }, - "unreliable_remote_ports" : { "first" : "32500", "last" : "32599" }, - "reliable_client_ports" : { "first" : "32491", "last" : "32499" }, - "unreliable_client_ports" : { "first" : "32491", "last" : "32499" } - }, - { - "service" : "0x8888", - "instance" : "0x1", - "unreliable" : [ "0x11", "0x10" ], - "reliable" : [ "0x11", "0x10" ] - }, - { - "service" : "8888", - "instance" : "1", - "unreliable" : [ 40000, 40001 ], - "reliable" : [ 40000, 40001 ] - } - ], - "max-payload-size-local" : "15000", - "max-payload-size-reliable" : "17000", - "buffer-shrink-threshold" : "11", - "payload-sizes": - [ - { - "unicast":"10.10.10.10", - "ports": - [ - { - "port":"7777", - "max-payload-size":"14999" - } - ] - }, - { - "unicast":"10.10.10.11", - "ports": - [ - { - "port":"7778", - "max-payload-size":"15001" - } - ] - } - ], - "security" : - { - "check_credentials" : "true", - "policies" : - [ - { - "client" : "0x1277", - "credentials" : { "uid" : "1000", "gid" : "1000" }, - "allow" : - { - "offers": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - }, - { - "service" : "0x1235", - "instance" : "0x5678" - } - ] - } - }, - { - "client" : { "first" : "0x1343", "last" : "0x1346" }, - "allow" : - { - "requests": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ] - } - }, - { - "client" : { "first" : "0x1443", "last" : "0x1446" }, - "deny" : - { - "requests": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ], - "offers": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - }, - { - "service" : "0x1235", - "instance" : "0x5678" - } - ] - } - } - ] - }, - "routing" : "my_application", - "service-discovery" : - { - "enable" : "true", - "protocol" : "udp", - "multicast" : "224.212.244.223", - "port" : "30666", - "offer_debounce_time" : "1000" - } -} diff --git a/test/configuration_tests/configuration-test.cpp b/test/configuration_tests/configuration-test.cpp deleted file mode 100644 index f9717c5..0000000 --- a/test/configuration_tests/configuration-test.cpp +++ /dev/null @@ -1,626 +0,0 @@ -// 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 <cstdlib> -#include <iostream> - -#include <gtest/gtest.h> - -#include <vsomeip/constants.hpp> -#include <vsomeip/plugins/application_plugin.hpp> - -#include "../implementation/configuration/include/configuration.hpp" -#include "../implementation/configuration/include/configuration_impl.hpp" -#include "../implementation/logging/include/logger.hpp" - -#include "../implementation/plugin/include/plugin_manager.hpp" - -#define CONFIGURATION_FILE "configuration-test.json" -#define DEPRECATED_CONFIGURATION_FILE "configuration-test-deprecated.json" - -#define EXPECTED_UNICAST_ADDRESS "10.0.2.15" - -#define EXPECTED_HAS_CONSOLE true -#define EXPECTED_HAS_FILE true -#define EXPECTED_HAS_DLT false -#define EXPECTED_LOGLEVEL "debug" -#define EXPECTED_LOGFILE "/home/someip/another-file.log" - -#define EXPECTED_ROUTING_MANAGER_HOST "my_application" - -// Logging -#define EXPECTED_VERSION_LOGGING_ENABLED false -#define EXPECTED_VERSION_LOGGING_INTERVAL 15 - -// Application -#define EXPECTED_APPLICATION_MAX_DISPATCHERS 25 -#define EXPECTED_APPLICATION_MAX_DISPATCH_TIME 1234 -#define EXPECTED_APPLICATION_THREADS 12 -#define EXPECTED_APPLICATION_REQUEST_DEBOUNCE_TIME 5000 - -// Services -#define EXPECTED_UNICAST_ADDRESS_1234_0022 EXPECTED_UNICAST_ADDRESS -#define EXPECTED_RELIABLE_PORT_1234_0022 30506 -#define EXPECTED_UNRELIABLE_PORT_1234_0022 31000 - -#define EXPECTED_UNICAST_ADDRESS_1234_0023 EXPECTED_UNICAST_ADDRESS -#define EXPECTED_RELIABLE_PORT_1234_0023 30503 -#define EXPECTED_UNRELIABLE_PORT_1234_0023 vsomeip::ILLEGAL_PORT - -#define EXPECTED_UNICAST_ADDRESS_2277_0022 EXPECTED_UNICAST_ADDRESS -#define EXPECTED_RELIABLE_PORT_2277_0022 30505 -#define EXPECTED_UNRELIABLE_PORT_2277_0022 31001 - -#define EXPECTED_UNICAST_ADDRESS_2266_0022 EXPECTED_UNICAST_ADDRESS -#define EXPECTED_RELIABLE_PORT_2266_0022 30505 -#define EXPECTED_UNRELIABLE_PORT_2266_0022 30507 - -#define EXPECTED_UNICAST_ADDRESS_4466_0321 "10.0.2.23" -#define EXPECTED_RELIABLE_PORT_4466_0321 30506 -#define EXPECTED_UNRELIABLE_PORT_4466_0321 30444 - -// Service Discovery -#define EXPECTED_SD_ENABLED true -#define EXPECTED_SD_PROTOCOL "udp" -#define EXPECTED_SD_MULTICAST "224.212.244.223" -#define EXPECTED_SD_PORT 30666 - -#define EXPECTED_INITIAL_DELAY_MIN 1234 -#define EXPECTED_INITIAL_DELAY_MAX 2345 -#define EXPECTED_REPETITIONS_BASE_DELAY 4242 -#define EXPECTED_REPETITIONS_MAX 4 -#define EXPECTED_TTL 13 -#define EXPECTED_CYCLIC_OFFER_DELAY 2132 -#define EXPECTED_REQUEST_RESPONSE_DELAY 1111 - -#define EXPECTED_DEPRECATED_INITIAL_DELAY_MIN 10 -#define EXPECTED_DEPRECATED_INITIAL_DELAY_MAX 100 -#define EXPECTED_DEPRECATED_REPETITIONS_BASE_DELAY 200 -#define EXPECTED_DEPRECATED_REPETITIONS_MAX 7 -#define EXPECTED_DEPRECATED_TTL 5 -#define EXPECTED_DEPRECATED_REQUEST_RESPONSE_DELAY 2001 - -template<class T> -::testing::AssertionResult check(const T &_is, const T &_expected, const std::string &_test) { - if (_is == _expected) { - return ::testing::AssertionSuccess() << "Test \"" << _test << "\" succeeded."; - } else { - return ::testing::AssertionFailure() << "Test \"" << _test << "\" failed! (" - << _is << " != " << _expected << ")"; - } -} - -void check_file(const std::string &_config_file, - const std::string &_expected_unicast_address, - bool _expected_has_console, - bool _expected_has_file, - bool _expected_has_dlt, - bool _expected_version_logging_enabled, - uint32_t _expected_version_logging_interval, - uint32_t _expected_application_max_dispatcher, - uint32_t _expected_application_max_dispatch_time, - uint32_t _expected_application_threads, - uint32_t _expected_application_request_debounce_time, - const std::string &_expected_logfile, - const std::string &_expected_loglevel, - const std::string &_expected_unicast_address_1234_0022, - uint16_t _expected_reliable_port_1234_0022, - uint16_t _expected_unreliable_port_1234_0022, - const std::string &_expected_unicast_address_1234_0023, - uint16_t _expected_reliable_port_1234_0023, - uint16_t _expected_unreliable_port_1234_0023, - const std::string &_expected_unicast_address_2277_0022, - uint16_t _expected_reliable_port_2277_0022, - uint16_t _expected_unreliable_port_2277_0022, - const std::string &_expected_unicast_address_2266_0022, - uint16_t _expected_reliable_port_2266_0022, - uint16_t _expected_unreliable_port_2266_0022, - const std::string &_expected_unicast_address_4466_0321, - uint16_t _expected_reliable_port_4466_0321, - uint16_t _expected_unreliable_port_4466_0321, - bool _expected_enabled, - 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, - 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 - 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) { - its_configuration = std::dynamic_pointer_cast<vsomeip::configuration>(its_plugin); - } - - // 1. Did we get a configuration object? - if (0 == its_configuration) { - ADD_FAILURE() << "No configuration object. " - "Either memory overflow or loading error detected!"; - return; - } - - vsomeip::cfg::configuration_impl its_copied_config( - static_cast<vsomeip::cfg::configuration_impl&>(*its_configuration)); - vsomeip::cfg::configuration_impl* its_new_config = - 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 - boost::asio::ip::address its_host_unicast_address - = its_configuration->get_unicast_address(); - EXPECT_TRUE(check<std::string>(its_host_unicast_address.to_string(), - _expected_unicast_address, "UNICAST ADDRESS")); - EXPECT_TRUE(its_configuration->is_v4()); - EXPECT_FALSE(its_configuration->is_v6()); - - // check diagnosis prefix - EXPECT_NE(0x54, its_configuration->get_diagnosis_address()); - EXPECT_EQ(0x55, its_configuration->get_diagnosis_address()); - EXPECT_NE(0x56, its_configuration->get_diagnosis_address()); - - // 4. Check logging - bool has_console = its_configuration->has_console_log(); - bool has_file = its_configuration->has_file_log(); - bool has_dlt = its_configuration->has_dlt_log(); - std::string logfile = its_configuration->get_logfile(); - boost::log::trivial::severity_level loglevel - = its_configuration->get_loglevel(); - bool has_version_logging = its_configuration->log_version(); - std::uint32_t version_logging_interval = its_configuration->get_log_version_interval(); - - EXPECT_TRUE(check<bool>(has_console, _expected_has_console, "HAS CONSOLE")); - EXPECT_TRUE(check<bool>(has_file, _expected_has_file, "HAS FILE")); - EXPECT_TRUE(check<bool>(has_dlt, _expected_has_dlt, "HAS DLT")); - EXPECT_TRUE(check<std::string>(logfile, _expected_logfile, "LOGFILE")); - EXPECT_TRUE(check<std::string>(boost::log::trivial::to_string(loglevel), - _expected_loglevel, "LOGLEVEL")); - EXPECT_TRUE(check<bool>(has_version_logging, _expected_version_logging_enabled, - "VERSION LOGGING")); - EXPECT_TRUE(check<uint32_t>(version_logging_interval, - _expected_version_logging_interval, - "VERSION LOGGING INTERVAL")); - - // watchdog - EXPECT_TRUE(its_configuration->is_watchdog_enabled()); - EXPECT_EQ(1234u, its_configuration->get_watchdog_timeout()); - EXPECT_EQ(7u, its_configuration->get_allowed_missing_pongs()); - - // file permissions - EXPECT_EQ(0444u, its_configuration->get_permissions_shm()); - EXPECT_EQ(0222u, its_configuration->get_umask()); - - // selective broadcasts - EXPECT_TRUE(its_configuration->supports_selective_broadcasts( - boost::asio::ip::address::from_string("160.160.160.160"))); - - // tracing - std::shared_ptr<vsomeip::cfg::trace> its_trace = its_configuration->get_trace(); - EXPECT_TRUE(its_trace->is_enabled_); - EXPECT_TRUE(its_trace->is_sd_enabled_); - EXPECT_EQ(2u, its_trace->channels_.size()); - EXPECT_EQ(2u, its_trace->filter_rules_.size()); - for (const auto &c : its_trace->channels_) { - EXPECT_TRUE(c->name_ == std::string("testname") || c->name_ == std::string("testname2")); - if (c->name_ == std::string("testname")) { - EXPECT_EQ(std::string("testid"), c->id_); - } else if (c->name_ == std::string("testname2")) { - EXPECT_EQ(std::string("testid2"), c->id_); - } - } - for (const auto &f : its_trace->filter_rules_) { - EXPECT_TRUE(f->channel_ == std::string("testname") || f->channel_ == std::string("testname2")); - if (f->channel_ == std::string("testname")) { - EXPECT_EQ(2u, f->services_.size()); - EXPECT_EQ(2u, f->methods_.size()); - EXPECT_EQ(2u, f->clients_.size()); - for (const vsomeip::service_t s : f->services_) { - EXPECT_TRUE(s == vsomeip::service_t(0x1111) || s == vsomeip::service_t(2222)); - } - for (const vsomeip::method_t s : f->methods_) { - EXPECT_TRUE(s == vsomeip::method_t(0x1111) || s == vsomeip::method_t(2222)); - } - for (const vsomeip::client_t s : f->clients_) { - EXPECT_TRUE(s == vsomeip::client_t(0x1111) || s == vsomeip::client_t(2222)); - } - } else if (f->channel_ == std::string("testname2")) { - EXPECT_EQ(2u, f->services_.size()); - EXPECT_EQ(2u, f->methods_.size()); - EXPECT_EQ(2u, f->clients_.size()); - for (const vsomeip::service_t s : f->services_) { - EXPECT_TRUE(s == vsomeip::service_t(0x3333) || s == vsomeip::service_t(4444)); - } - for (const vsomeip::method_t s : f->methods_) { - EXPECT_TRUE(s == vsomeip::method_t(0x3333) || s == vsomeip::method_t(4444)); - } - for (const vsomeip::client_t s : f->clients_) { - EXPECT_TRUE(s == vsomeip::client_t(0x3333) || s == vsomeip::client_t(4444)); - } - } - } - - // Applications - std::size_t max_dispatchers = its_configuration->get_max_dispatchers( - EXPECTED_ROUTING_MANAGER_HOST); - std::size_t max_dispatch_time = its_configuration->get_max_dispatch_time( - EXPECTED_ROUTING_MANAGER_HOST); - std::size_t io_threads = its_configuration->get_io_thread_count( - EXPECTED_ROUTING_MANAGER_HOST); - std::size_t request_time = its_configuration->get_request_debouncing( - EXPECTED_ROUTING_MANAGER_HOST); - - EXPECT_TRUE(check<std::size_t>(max_dispatchers, - _expected_application_max_dispatcher, "MAX DISPATCHERS")); - EXPECT_TRUE(check<std::size_t>(max_dispatch_time, - _expected_application_max_dispatch_time, "MAX DISPATCH TIME")); - EXPECT_TRUE(check<std::size_t>(io_threads, _expected_application_threads, - "IO THREADS")); - EXPECT_TRUE(check<std::size_t>(request_time, - _expected_application_request_debounce_time, "REQUEST DEBOUNCE TIME")); - - EXPECT_EQ(0x9933, its_configuration->get_id("other_application")); - - 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) { - EXPECT_EQ(vsomeip::plugin_type_e::APPLICATION_PLUGIN, plugin.first); - for (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(1u, its_plugin->get_plugin_version()); - - - // 5. Services - std::string its_unicast_address - = its_configuration->get_unicast_address(0x1234, 0x0022); - uint16_t its_reliable_port - = its_configuration->get_reliable_port(0x1234, 0x0022); - uint16_t its_unreliable_port - = its_configuration->get_unreliable_port(0x1234, 0x0022); - - EXPECT_TRUE(check<std::string>(its_unicast_address, - _expected_unicast_address_1234_0022, - "UNICAST_ADDRESS_1234_0022")); - EXPECT_TRUE(check<uint16_t>(its_reliable_port, - _expected_reliable_port_1234_0022, - "RELIABLE_PORT_1234_0022")); - EXPECT_TRUE(check<uint16_t>(its_unreliable_port, - _expected_unreliable_port_1234_0022, - "UNRELIABLE_PORT_1234_0022")); - - its_unicast_address - = its_configuration->get_unicast_address(0x1234, 0x0023); - its_reliable_port - = its_configuration->get_reliable_port(0x1234, 0x0023); - its_unreliable_port - = its_configuration->get_unreliable_port(0x1234, 0x0023); - - EXPECT_TRUE(check<std::string>(its_unicast_address, - _expected_unicast_address_1234_0023, - "UNICAST_ADDRESS_1234_0023")); - EXPECT_TRUE(check<uint16_t>(its_reliable_port, - _expected_reliable_port_1234_0023, - "RELIABLE_PORT_1234_0023")); - EXPECT_TRUE(check<uint16_t>(its_unreliable_port, - _expected_unreliable_port_1234_0023, - "UNRELIABLE_PORT_1234_0023")); - - its_unicast_address - = its_configuration->get_unicast_address(0x2277, 0x0022); - its_reliable_port - = its_configuration->get_reliable_port(0x2277, 0x0022); - its_unreliable_port - = its_configuration->get_unreliable_port(0x2277, 0x0022); - - EXPECT_TRUE(check<std::string>(its_unicast_address, - _expected_unicast_address_2277_0022, - "UNICAST_ADDRESS_2277_0022")); - EXPECT_TRUE(check<uint16_t>(its_reliable_port, - _expected_reliable_port_2277_0022, - "RELIABLE_PORT_2277_0022")); - EXPECT_TRUE(check<uint16_t>(its_unreliable_port, - _expected_unreliable_port_2277_0022, - "UNRELIABLE_PORT_2277_0022")); - - its_unicast_address - = its_configuration->get_unicast_address(0x2266, 0x0022); - its_reliable_port - = its_configuration->get_reliable_port(0x2266, 0x0022); - its_unreliable_port - = its_configuration->get_unreliable_port(0x2266, 0x0022); - - EXPECT_TRUE(check<std::string>(its_unicast_address, - _expected_unicast_address_2266_0022, - "UNICAST_ADDRESS_2266_0022")); - EXPECT_TRUE(check<uint16_t>(its_reliable_port, - _expected_reliable_port_2266_0022, - "RELIABLE_PORT_2266_0022")); - EXPECT_TRUE(check<uint16_t>(its_unreliable_port, - _expected_unreliable_port_2266_0022, - "UNRELIABLE_PORT_2266_0022")); - - its_unicast_address - = its_configuration->get_unicast_address(0x4466, 0x0321); - its_reliable_port - = its_configuration->get_reliable_port(0x4466, 0x0321); - its_unreliable_port - = its_configuration->get_unreliable_port(0x4466, 0x0321); - - EXPECT_TRUE(check<std::string>(its_unicast_address, - _expected_unicast_address_4466_0321, - "UNICAST_ADDRESS_4466_0321")); - EXPECT_TRUE(check<uint16_t>(its_reliable_port, - _expected_reliable_port_4466_0321, - "RELIABLE_PORT_4466_0321")); - EXPECT_TRUE(check<uint16_t>(its_unreliable_port, - _expected_unreliable_port_4466_0321, - "UNRELIABLE_PORT_4466_0321")); - - std::string its_multicast_address; - std::uint16_t its_multicast_port; - its_configuration->get_multicast(0x7809, 0x1, 0x1111, - its_multicast_address, its_multicast_port); - EXPECT_EQ(1234u, its_multicast_port); - EXPECT_EQ(std::string("224.212.244.225"), its_multicast_address); - EXPECT_EQ(8u, its_configuration->get_threshold(0x7809, 0x1, 0x1111)); - - EXPECT_TRUE(its_configuration->is_offered_remote(0x1234,0x0022)); - EXPECT_FALSE(its_configuration->is_offered_remote(0x3333,0x1)); - - EXPECT_TRUE(its_configuration->has_enabled_magic_cookies("10.0.2.15", 30506)); - EXPECT_FALSE(its_configuration->has_enabled_magic_cookies("10.0.2.15", 30503)); - - std::set<std::pair<vsomeip::service_t, vsomeip::instance_t>> its_remote_services = - its_configuration->get_remote_services(); - EXPECT_EQ(1u, its_remote_services.size()); - for (const auto &p : its_remote_services) { - EXPECT_EQ(0x4466, p.first); - EXPECT_EQ(0x321, p.second); - } - - EXPECT_TRUE(its_configuration->is_someip(0x3333,0x1)); - EXPECT_FALSE(its_configuration->is_someip(0x3555,0x1)); - - // Internal services - EXPECT_TRUE(its_configuration->is_local_service(0x1234, 0x0022)); - EXPECT_TRUE(its_configuration->is_local_service(0x3333,0x1)); - // defined range, service level only - EXPECT_FALSE(its_configuration->is_local_service(0xF0FF,0x1)); - EXPECT_TRUE(its_configuration->is_local_service(0xF100,0x1)); - EXPECT_TRUE(its_configuration->is_local_service(0xF101,0x23)); - EXPECT_TRUE(its_configuration->is_local_service(0xF109,0xFFFF)); - EXPECT_FALSE(its_configuration->is_local_service(0xF10a,0x1)); - // defined range, service and instance level - EXPECT_FALSE(its_configuration->is_local_service(0xF2FF,0xFFFF)); - EXPECT_TRUE(its_configuration->is_local_service(0xF300,0x1)); - EXPECT_TRUE(its_configuration->is_local_service(0xF300,0x5)); - EXPECT_TRUE(its_configuration->is_local_service(0xF300,0x10)); - EXPECT_FALSE(its_configuration->is_local_service(0xF300,0x11)); - EXPECT_FALSE(its_configuration->is_local_service(0xF301,0x11)); - - // clients - std::map<bool, std::set<uint16_t>> used_ports; - used_ports[true].insert(0x11); - used_ports[false].insert(0x10); - std::uint16_t port_to_use(0x0); - EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x1, vsomeip::ILLEGAL_PORT, true, used_ports, port_to_use)); - EXPECT_EQ(0x10, port_to_use); - EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x1, vsomeip::ILLEGAL_PORT, false, used_ports, port_to_use)); - EXPECT_EQ(0x11, port_to_use); - - used_ports[true].insert(0x10); - used_ports[false].insert(0x11); - EXPECT_FALSE(its_configuration->get_client_port(0x8888, 0x1, vsomeip::ILLEGAL_PORT, true, used_ports, port_to_use)); - EXPECT_EQ(vsomeip::ILLEGAL_PORT, port_to_use); - EXPECT_FALSE(its_configuration->get_client_port(0x8888, 0x1, vsomeip::ILLEGAL_PORT, false, used_ports, port_to_use)); - EXPECT_EQ(vsomeip::ILLEGAL_PORT, port_to_use); - - - //check for correct client port assignment if service / instance was not configured but a remote port range - used_ports.clear(); - EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7725, true, used_ports, port_to_use)); - EXPECT_EQ(0x771B, port_to_use); - used_ports[true].insert(0x771B); - EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7725, true, used_ports, port_to_use)); - EXPECT_EQ(0x771C, port_to_use); - used_ports[true].insert(0x771C); - EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7B0D, true, used_ports, port_to_use)); - EXPECT_EQ(0x7B03, port_to_use); - used_ports[true].insert(0x7B03); - EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7B0D, true, used_ports, port_to_use)); - EXPECT_EQ(0x7B04, port_to_use); - used_ports[true].insert(0x7B04); - EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7EF4, true, used_ports, port_to_use)); - EXPECT_EQ(0x7EEB, port_to_use); - used_ports[true].insert(0x7EEB); - EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7EF4, true, used_ports, port_to_use)); - EXPECT_EQ(0x7EEC, port_to_use); - used_ports[true].insert(0x7EEC); - used_ports.clear(); - - - // payload sizes - // use 17000 instead of 1500 as configured max-local-payload size will be - // increased to bigger max-reliable-payload-size - std::uint32_t max_local_message_size( - 17000u + 16u + + VSOMEIP_COMMAND_HEADER_SIZE - + sizeof(vsomeip::instance_t) + sizeof(bool) + sizeof(bool) - + sizeof(vsomeip::client_t)); - EXPECT_EQ(max_local_message_size, its_configuration->get_max_message_size_local()); - EXPECT_EQ(11u, its_configuration->get_buffer_shrink_threshold()); - EXPECT_EQ(14999u + 16u, its_configuration->get_max_message_size_reliable("10.10.10.10", 7777)); - EXPECT_EQ(17000u + 16, its_configuration->get_max_message_size_reliable("11.11.11.11", 4711)); - EXPECT_EQ(15001u + 16, its_configuration->get_max_message_size_reliable("10.10.10.11", 7778)); - - // security - EXPECT_TRUE(its_configuration->is_security_enabled()); - EXPECT_TRUE(its_configuration->is_offer_allowed(0x1277, 0x1234, 0x5678)); - 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)); - // 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_TRUE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5678)); - EXPECT_TRUE(its_configuration->is_client_allowed(0x1346, 0x1234, 0x5678)); - EXPECT_FALSE(its_configuration->is_client_allowed(0x1347, 0x1234, 0x5678)); - EXPECT_FALSE(its_configuration->is_client_allowed(0x1342, 0x1234, 0x5678)); - EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5679)); - EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1230, 0x5678)); - // explicitly denied requests - EXPECT_FALSE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5678)); - EXPECT_FALSE(its_configuration->is_client_allowed(0x1446, 0x1234, 0x5678)); - EXPECT_TRUE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5679)); - EXPECT_TRUE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5679)); - EXPECT_FALSE(its_configuration->is_client_allowed(0x1442, 0x1234, 0x5678)); - EXPECT_FALSE(its_configuration->is_client_allowed(0x1447, 0x1234, 0x5678)); - - 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)); - - // 6. Service discovery - bool enabled = its_configuration->is_sd_enabled(); - std::string protocol = its_configuration->get_sd_protocol(); - 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(); - 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(); - int32_t cyclic_offer_delay = its_configuration->get_sd_cyclic_offer_delay(); - int32_t request_response_delay = its_configuration->get_sd_request_response_delay(); - - EXPECT_TRUE(check<bool>(enabled, _expected_enabled, "SD ENABLED")); - EXPECT_TRUE(check<std::string>(protocol, _expected_protocol, "SD PROTOCOL")); - 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<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_EQ(1000u, its_configuration->get_sd_offer_debounce_time()); - - ASSERT_TRUE(vsomeip::plugin_manager::get()->unload_plugin(vsomeip::plugin_type_e::CONFIGURATION_PLUGIN)); -} - -TEST(configuration_test, check_config_file) { - // Check current configuration file format - check_file(CONFIGURATION_FILE, - EXPECTED_UNICAST_ADDRESS, - EXPECTED_HAS_CONSOLE, - EXPECTED_HAS_FILE, - EXPECTED_HAS_DLT, - EXPECTED_VERSION_LOGGING_ENABLED, - EXPECTED_VERSION_LOGGING_INTERVAL, - EXPECTED_APPLICATION_MAX_DISPATCHERS, - EXPECTED_APPLICATION_MAX_DISPATCH_TIME, - EXPECTED_APPLICATION_THREADS, - EXPECTED_APPLICATION_REQUEST_DEBOUNCE_TIME, - EXPECTED_LOGFILE, - EXPECTED_LOGLEVEL, - EXPECTED_UNICAST_ADDRESS_1234_0022, - EXPECTED_RELIABLE_PORT_1234_0022, - EXPECTED_UNRELIABLE_PORT_1234_0022, - EXPECTED_UNICAST_ADDRESS_1234_0023, - EXPECTED_RELIABLE_PORT_1234_0023, - EXPECTED_UNRELIABLE_PORT_1234_0023, - EXPECTED_UNICAST_ADDRESS_2277_0022, - EXPECTED_RELIABLE_PORT_2277_0022, - EXPECTED_UNRELIABLE_PORT_2277_0022, - EXPECTED_UNICAST_ADDRESS_2266_0022, - EXPECTED_RELIABLE_PORT_2266_0022, - EXPECTED_UNRELIABLE_PORT_2266_0022, - EXPECTED_UNICAST_ADDRESS_4466_0321, - EXPECTED_RELIABLE_PORT_4466_0321, - EXPECTED_UNRELIABLE_PORT_4466_0321, - EXPECTED_SD_ENABLED, - EXPECTED_SD_PROTOCOL, - EXPECTED_SD_MULTICAST, - EXPECTED_SD_PORT, - EXPECTED_INITIAL_DELAY_MIN, - EXPECTED_INITIAL_DELAY_MAX, - EXPECTED_REPETITIONS_BASE_DELAY, - EXPECTED_REPETITIONS_MAX, - EXPECTED_TTL, - EXPECTED_CYCLIC_OFFER_DELAY, - EXPECTED_REQUEST_RESPONSE_DELAY); -} - -TEST(configuration_test, check_deprecated_config_file) { - // Check deprecated configuration file format - check_file(DEPRECATED_CONFIGURATION_FILE, - EXPECTED_UNICAST_ADDRESS, - EXPECTED_HAS_CONSOLE, - EXPECTED_HAS_FILE, - EXPECTED_HAS_DLT, - EXPECTED_VERSION_LOGGING_ENABLED, - EXPECTED_VERSION_LOGGING_INTERVAL, - EXPECTED_APPLICATION_MAX_DISPATCHERS, - EXPECTED_APPLICATION_MAX_DISPATCH_TIME, - EXPECTED_APPLICATION_THREADS, - EXPECTED_APPLICATION_REQUEST_DEBOUNCE_TIME, - EXPECTED_LOGFILE, - EXPECTED_LOGLEVEL, - EXPECTED_UNICAST_ADDRESS_1234_0022, - EXPECTED_RELIABLE_PORT_1234_0022, - EXPECTED_UNRELIABLE_PORT_1234_0022, - EXPECTED_UNICAST_ADDRESS_1234_0023, - EXPECTED_RELIABLE_PORT_1234_0023, - EXPECTED_UNRELIABLE_PORT_1234_0023, - EXPECTED_UNICAST_ADDRESS_2277_0022, - EXPECTED_RELIABLE_PORT_2277_0022, - EXPECTED_UNRELIABLE_PORT_2277_0022, - EXPECTED_UNICAST_ADDRESS_2266_0022, - EXPECTED_RELIABLE_PORT_2266_0022, - EXPECTED_UNRELIABLE_PORT_2266_0022, - EXPECTED_UNICAST_ADDRESS_4466_0321, - EXPECTED_RELIABLE_PORT_4466_0321, - EXPECTED_UNRELIABLE_PORT_4466_0321, - EXPECTED_SD_ENABLED, - EXPECTED_SD_PROTOCOL, - EXPECTED_SD_MULTICAST, - EXPECTED_SD_PORT, - EXPECTED_DEPRECATED_INITIAL_DELAY_MIN, - EXPECTED_DEPRECATED_INITIAL_DELAY_MAX, - EXPECTED_DEPRECATED_REPETITIONS_BASE_DELAY, - EXPECTED_DEPRECATED_REPETITIONS_MAX, - EXPECTED_DEPRECATED_TTL, - EXPECTED_CYCLIC_OFFER_DELAY, - EXPECTED_DEPRECATED_REQUEST_RESPONSE_DELAY); -} - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/configuration_tests/configuration-test.json b/test/configuration_tests/configuration-test.json deleted file mode 100644 index 32d11d7..0000000 --- a/test/configuration_tests/configuration-test.json +++ /dev/null @@ -1,336 +0,0 @@ -{ - "unicast" : "10.0.2.15", - "diagnosis" : "0x55", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : { "enable" : "true", "path" : "/home/someip/another-file.log" }, - "dlt" : "false", - "version" : { - "enable" : "false", - "interval" : "15" - } - }, - "watchdog" : - { - "enable" : "true", - "timeout" : "1234", - "allowed_missing_pongs" : "7" - }, - "file-permissions" : - { - "permissions-shm" : "0444", - "umask" : "0222" - }, - "supports_selective_broadcasts" : - { - "address" : "160.160.160.160" - }, - "tracing" : - { - "enable" : "true", - "sd_enable" : "true", - "channels" : - [ - { - "name" : "testname", - "id" : "testid" - }, - { - "name" : "testname2", - "id" : "testid2" - } - ], - "filters" : - [ - { - "channel" : "testname", - "services" : ["0x1111",2222], - "methods" : ["0x1111",2222], - "clients" : ["0x1111",2222] - }, - { - "channel" : "testname2", - "services" : ["0x3333",4444], - "methods" : ["0x3333",4444], - "clients" : ["0x3333",4444] - } - ] - }, - "applications" : - [ - { - "name" : "my_application", - "id" : "0x7788", - "max_dispatchers" : "25", - "max_dispatch_time" : "1234", - "threads" : "12", - "request_debounce_time" : "5000", - "plugins" : - [ - { - "application_plugin" : "testlibraryname" - }, - { - "intentionally_wrong_plugin" : "wrong" - } - ] - }, - { - "name" : "other_application", - "id" : "0x9933", - "threads" : "0", - "threads" : "256", - "request_debounce_time" : "10001" - } - ], - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x0022", - "unicast" : "local", - "reliable" : { "port" : "30506", "enable-magic-cookies" : "true" }, - "unreliable" : "31000", - "events" : - [ - { - "event" : "0x0778", - "is_field" : "false" - }, - { - "event" : "0x779", - "is_field" : "true" - }, - { - "event" : "0x77A", - "is_field" : "false" - } - ], - "eventgroups" : - [ - { - "eventgroup" : "0x4567", - "multicast" : "225.226.227.228", - "events" : [ "0x778", "0x779" ] - }, - { - "eventgroup" : "0x4569", - "multicast" : "225.227.227.228", - "events" : [ "0x779", "0x77A" ] - }, - { - "eventgroup" : "0x4569", - "multicast" : "225.222.227.228", - "events" : [ "0x778", "0x77A" ] - } - ] - }, - { - "service" : "0x1234", - "instance" : "0x0023", - "reliable" : "30503" - }, - { - "service" : "0x2277", - "instance" : "0x0022", - "reliable" : { "port" : "30505" }, - "unreliable" : "31001" - }, - { - "service" : "0x2266", - "instance" : "0x0022", - "reliable" : "30505", - "unreliable" : "30507" - }, - { - "service" : "0x4466", - "instance" : "0x0321", - "unicast" : "10.0.2.23", - "reliable" : "30506", - "unreliable" : "30444" - }, - { - "service" : "0x3333", - "instance" : "0x1" - }, - { - "service" : "0x7809", - "instance" : "0x1", - "multicast" : - { - "address" : "224.212.244.225", - "port" : "1234" - }, - "eventgroups" : - [ - { - "eventgroup" : "0x1111", - "threshold" : "8", - "is_multicast" : "true", - "events" : [ "0x778", "0x77A" ] - } - ] - }, - { - "service" : "0x3555", - "instance" : "0x1", - "protocol" : "other" - } - ], - "internal_services" : - [ - { - "first" : "0xF100", - "last" : "0xF109" - }, - { - "first" : { - "service" : "0xF300", - "instance" : "0x1" - }, - "last" : { - "service" : "0xF300", - "instance" : "0x10" - } - } - ], - "clients" : - [ - { - "reliable_remote_ports" : { "first" : "30500", "last" : "30599" }, - "unreliable_remote_ports" : { "first" : "30500", "last" : "30599" }, - "reliable_client_ports" : { "first" : "30491", "last" : "30499" }, - "unreliable_client_ports" : { "first" : "30491", "last" : "30499" } - }, - { - "reliable_remote_ports" : { "first" : "31500", "last" : "31599" }, - "unreliable_remote_ports" : { "first" : "31500", "last" : "31599" }, - "reliable_client_ports" : { "first" : "31491", "last" : "31499" }, - "unreliable_client_ports" : { "first" : "31491", "last" : "31499" } - }, - { - "reliable_remote_ports" : { "first" : "32500", "last" : "32599" }, - "unreliable_remote_ports" : { "first" : "32500", "last" : "32599" }, - "reliable_client_ports" : { "first" : "32491", "last" : "32499" }, - "unreliable_client_ports" : { "first" : "32491", "last" : "32499" } - }, - { - "service" : "0x8888", - "instance" : "0x1", - "unreliable" : [ "0x11", "0x10" ], - "reliable" : [ "0x11", "0x10" ] - }, - { - "service" : "8888", - "instance" : "1", - "unreliable" : [ 40000, 40001 ], - "reliable" : [ 40000, 40001 ] - } - ], - "max-payload-size-local" : "15000", - "max-payload-size-reliable" : "17000", - "buffer-shrink-threshold" : "11", - "payload-sizes": - [ - { - "unicast":"10.10.10.10", - "ports": - [ - { - "port":"7777", - "max-payload-size":"14999" - } - ] - }, - { - "unicast":"10.10.10.11", - "ports": - [ - { - "port":"7778", - "max-payload-size":"15001" - } - ] - } - ], - "security" : - { - "check_credentials" : "true", - "policies" : - [ - { - "client" : "0x1277", - "credentials" : { "uid" : "1000", "gid" : "1000" }, - "allow" : - { - "offers": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - }, - { - "service" : "0x1235", - "instance" : "0x5678" - } - ] - } - }, - { - "client" : { "first" : "0x1343", "last" : "0x1346" }, - "allow" : - { - "requests": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ] - } - }, - { - "client" : { "first" : "0x1443", "last" : "0x1446" }, - "deny" : - { - "requests": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ], - "offers": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - }, - { - "service" : "0x1235", - "instance" : "0x5678" - } - ] - } - } - ] - }, - "routing" : "my_application", - "service-discovery" : - { - "enable" : "true", - "protocol" : "udp", - "multicast" : "224.212.244.223", - "port" : "30666", - "initial_delay_min" : "1234", - "initial_delay_max" : "2345", - "repetitions_base_delay" : "4242", - "repetitions_max" : "4", - "ttl" : "13", - "cyclic_offer_delay" : "2132", - "request_response_delay" : "1111", - "offer_debounce_time" : "1000" - } -}
\ No newline at end of file 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 deleted file mode 100644 index d623758..0000000 --- a/test/cpu_load_tests/conf/cpu_load_test_client_master.json.in +++ /dev/null @@ -1,32 +0,0 @@ -{ - "unicast" : "@TEST_IP_MASTER@", - "netmask" : "255.255.255.0", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "cpu_load_test_client", - "id" : "0x2222" - } - ], - "routing" : "cpu_load_test_client", - "service-discovery" : - { - "enable" : "true", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} 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 deleted file mode 100644 index 36de379..0000000 --- a/test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in +++ /dev/null @@ -1,32 +0,0 @@ -{ - "unicast" : "@TEST_IP_SLAVE@", - "netmask" : "255.255.255.0", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "cpu_load_test_client", - "id" : "0x2222" - } - ], - "routing" : "cpu_load_test_client", - "service-discovery" : - { - "enable" : "true", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} 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 deleted file mode 100644 index d836650..0000000 --- a/test/cpu_load_tests/conf/cpu_load_test_service_master.json.in +++ /dev/null @@ -1,46 +0,0 @@ -{ - "unicast" : "@TEST_IP_MASTER@", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "cpu_load_test_service", - "id" : "0x1111" - } - ], - - "services" : - [ - { - "service" : "0x1111", - "instance" : "0x1", - "unreliable" : "30510", - "reliable" : - { - "port" : "30510", - "enable-magic-cookies" : "false" - } - } - ], - - "routing" : "cpu_load_test_service", - "service-discovery" : - { - "enable" : "true", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} 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 deleted file mode 100644 index 78e1909..0000000 --- a/test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in +++ /dev/null @@ -1,46 +0,0 @@ -{ - "unicast" : "@TEST_IP_SLAVE@", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "cpu_load_test_service", - "id" : "0x1111" - } - ], - - "services" : - [ - { - "service" : "0x1111", - "instance" : "0x1", - "unreliable" : "30510", - "reliable" : - { - "port" : "30510", - "enable-magic-cookies" : "false" - } - } - ], - - "routing" : "cpu_load_test_service", - "service-discovery" : - { - "enable" : "true", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} diff --git a/test/cpu_load_tests/cpu_load_measurer.cpp b/test/cpu_load_tests/cpu_load_measurer.cpp deleted file mode 100644 index 2261d22..0000000 --- a/test/cpu_load_tests/cpu_load_measurer.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// 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 "cpu_load_measurer.hpp" - -#include <fstream> -#include <string> -#include <iostream> -#include <sstream> -#include <vector> -#include <stdexcept> -#include <cstdio> - -#include <sys/types.h> -#include <unistd.h> - -cpu_load_measurer::~cpu_load_measurer() { -} - -cpu_load_measurer::cpu_load_measurer(std::uint32_t _pid) : - pid_(_pid), - jiffies_complete_start_(0), - jiffies_idle_start_(0), - jiffies_complete_stop_(0), - jiffies_idle_stop_(0), - clock_ticks_(0), - jiffies_passed_pid_start_(0), - jiffies_passed_pid_stop_(0), - cpu_load_pid_(0.0), - cpu_load_overall_(0.0), - cpu_load_pid_wo_idle_(0.0) { -} - -void cpu_load_measurer::start() { - // reset everything - jiffies_complete_start_ = 0; - jiffies_idle_start_ = 0; - jiffies_complete_stop_ = 0; - jiffies_idle_stop_ = 0; - clock_ticks_ = 0; - jiffies_passed_pid_start_ = 0; - jiffies_passed_pid_stop_ = 0; - cpu_load_pid_= 0.0; - cpu_load_overall_ = 0.0; - cpu_load_pid_wo_idle_ = 0.0; - //start - jiffies_complete_start_ = read_proc_stat(&jiffies_idle_start_); - jiffies_passed_pid_start_ = read_proc_pid_stat(); -} - -void cpu_load_measurer::stop() { - jiffies_complete_stop_ = read_proc_stat(&jiffies_idle_stop_); - jiffies_passed_pid_stop_ = read_proc_pid_stat(); - if(jiffies_complete_stop_ < jiffies_complete_start_ || jiffies_passed_pid_stop_ < jiffies_passed_pid_start_) { - std::cerr << "Overflow of values in procfs occured, can't calculate load" << std::endl; - exit(0); - } - cpu_load_pid_ = 100.0 - * static_cast<double>(jiffies_passed_pid_stop_ - - jiffies_passed_pid_start_) - / static_cast<double>(jiffies_complete_stop_ - - jiffies_complete_start_); - cpu_load_overall_ = 100.0 - * static_cast<double>((jiffies_complete_stop_ - jiffies_idle_stop_) - - (jiffies_complete_start_ - jiffies_idle_start_)) - / static_cast<double>(jiffies_complete_stop_ - - jiffies_complete_start_); - cpu_load_pid_wo_idle_ = 100.0 - * static_cast<double>(jiffies_passed_pid_stop_ - - jiffies_passed_pid_start_) - / static_cast<double>((jiffies_complete_stop_ - jiffies_idle_stop_) - - (jiffies_complete_start_ - jiffies_idle_start_)); - -} - -void cpu_load_measurer::print_cpu_load() const { - std::cout << "Used Jiffies complete: " - << jiffies_complete_stop_ - jiffies_complete_start_ << " (worked: " - << (jiffies_complete_stop_ - jiffies_idle_stop_) - - (jiffies_complete_start_ - jiffies_idle_start_) - << " idled: " << jiffies_idle_stop_ - jiffies_idle_start_ - << ")" << std::endl; - std::cout << "Used Jiffies of pid " << pid_ << ": " << jiffies_passed_pid_stop_ - jiffies_passed_pid_start_ << std::endl; - std::cout << "Cpu load pid " << pid_ << " [%]: " << cpu_load_pid_ << std::endl; - std::cout << "Overall cpu load[%]: " << cpu_load_overall_ << std::endl; - std::cout << "Load caused by pid " << pid_ << " of overall cpu load [%]:" << cpu_load_pid_wo_idle_ << std::endl; -} - -double cpu_load_measurer::get_cpu_load() const { - return cpu_load_pid_; -} - -std::uint64_t cpu_load_measurer::read_proc_pid_stat() { - std::string path("/proc/" + std::to_string(pid_) + "/stat"); - FILE* f = std::fopen(path.c_str(), "r"); - if(!f) { - std::perror(std::string("Failed to open " + path).c_str()); - exit(1); - } - // see Table 1-4 Contents of the stat files (as of 2.6.30-rc7) - // at https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/filesystems/proc.txt?id=refs/tags/v3.10.98 - // and man proc (for conversion specifier) - std::uint64_t utime(0); - std::uint64_t stime(0); - std::int64_t cutime(0); - std::int64_t cstime(0); - if (std::fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u " - "%lu %lu %ld %ld", // utime, stime, cutime, cstime - &utime, &stime, &cutime, &cstime) == EOF) { - std::cerr << "Failed to read " + path << std::endl; - exit(1); - } - std::fclose(f); - return utime + stime + cutime + cstime; -} - -std::uint64_t cpu_load_measurer::read_proc_stat(std::uint64_t* _idle) { - FILE* f = std::fopen("/proc/stat", "r"); - if(!f) { - std::perror("Failed to open /proc/stat"); - exit(1); - } - - // see 1.8 Miscellaneous kernel statistics in /proc/stat - // at https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/filesystems/proc.txt?id=refs/tags/v3.10.98 - std::uint64_t user(0); - std::uint64_t nice(0); - std::uint64_t system(0); - std::uint64_t idle(0); - std::uint64_t iowait(0); - std::uint64_t irq(0); - std::uint64_t softirq(0); - std::uint64_t steal(0); - std::uint64_t guest(0); - std::uint64_t guest_nice(0); - if (std::fscanf(f, "%*s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", &user, - &nice, &system, &idle, &iowait, &irq, &softirq, &steal, &guest, - &guest_nice) == EOF) { - std::cerr << "Failed to read /proc/stat" << std::endl; - exit(1); - } - std::fclose(f); - *_idle = idle; - return user + nice + system + idle + iowait + irq + softirq + steal + guest - + guest_nice; -} - -bool cpu_load_measurer::read_clock_ticks() { - long val(::sysconf(_SC_CLK_TCK)); - if(val < 0 && errno == EINVAL) { - std::perror(__func__); - return false; - } - clock_ticks_ = static_cast<std::uint64_t>(val); - return true; -} diff --git a/test/cpu_load_tests/cpu_load_measurer.hpp b/test/cpu_load_tests/cpu_load_measurer.hpp deleted file mode 100644 index dfdcf80..0000000 --- a/test/cpu_load_tests/cpu_load_measurer.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// 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/. - -#pragma once - -#include <cstdint> - -class cpu_load_measurer { -public: - cpu_load_measurer(std::uint32_t _pid); - virtual ~cpu_load_measurer(); - void start(); - void stop(); - void print_cpu_load() const; - double get_cpu_load() const; - -private: - std::uint64_t read_proc_stat(std::uint64_t* _idle); - std::uint64_t read_proc_pid_stat(); - bool read_clock_ticks(); -private: - std::uint32_t pid_; - std::uint64_t jiffies_complete_start_; - std::uint64_t jiffies_idle_start_; - std::uint64_t jiffies_complete_stop_; - std::uint64_t jiffies_idle_stop_; - std::uint64_t clock_ticks_; - std::uint64_t jiffies_passed_pid_start_; - std::uint64_t jiffies_passed_pid_stop_; - double cpu_load_pid_; - double cpu_load_overall_; - double cpu_load_pid_wo_idle_; -}; diff --git a/test/cpu_load_tests/cpu_load_test_client.cpp b/test/cpu_load_tests/cpu_load_test_client.cpp deleted file mode 100644 index 94fd98b..0000000 --- a/test/cpu_load_tests/cpu_load_test_client.cpp +++ /dev/null @@ -1,390 +0,0 @@ -// 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 <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> -#include <iomanip> -#include <numeric> -#include <cmath> // for isfinite -#include <atomic> - -#include "cpu_load_test_globals.hpp" -#include "../../implementation/logging/include/logger.hpp" -#include "cpu_load_measurer.hpp" - -// for getpid -#include <sys/types.h> -#include <unistd.h> - - -enum protocol_e { - PR_UNKNOWN, - PR_TCP, - PR_UDP -}; - -class cpu_load_test_client -{ -public: - cpu_load_test_client(protocol_e _protocol, std::uint32_t _number_of_calls, - std::uint32_t _payload_size, bool _call_service_sync, - bool _shutdown_service) : - protocol_(_protocol), - app_(vsomeip::runtime::get()->create_application("cpu_load_test_client")), - request_(vsomeip::runtime::get()->create_request(protocol_ == protocol_e::PR_TCP)), - call_service_sync_(_call_service_sync), - shutdown_service_at_end_(_shutdown_service), - sliding_window_size_(_number_of_calls), - wait_for_availability_(true), - is_available_(false), - number_of_calls_(_number_of_calls), - number_of_calls_current_(0), - number_of_sent_messages_(0), - number_of_sent_messages_total_(0), - number_of_acknowledged_messages_(0), - payload_size_(_payload_size), - wait_for_all_msg_acknowledged_(true), - initialized_(false), - sender_(std::bind(&cpu_load_test_client::run, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - initialized_ = true; - app_->register_state_handler( - std::bind(&cpu_load_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind(&cpu_load_test_client::on_message, this, - std::placeholders::_1)); - - app_->register_availability_handler(cpu_load_test::service_id, - cpu_load_test::instance_id, - std::bind(&cpu_load_test_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - VSOMEIP_INFO << "Starting..."; - app_->start(); - } - - ~cpu_load_test_client() { - { - std::lock_guard<std::mutex> its_lock(mutex_); - wait_for_availability_ = false; - condition_.notify_one(); - } - { - std::lock_guard<std::mutex> its_lock(all_msg_acknowledged_mutex_); - wait_for_all_msg_acknowledged_ = false; - all_msg_acknowledged_cv_.notify_one(); - } - sender_.join(); - } - -private: - void stop() { - VSOMEIP_INFO << "Stopping..."; - // shutdown the service - if(shutdown_service_at_end_) - { - shutdown_service(); - } - app_->clear_all_handler(); - } - - void on_state(vsomeip::state_type_e _state) { - if(_state == vsomeip::state_type_e::ST_REGISTERED) - { - app_->request_service(cpu_load_test::service_id, - cpu_load_test::instance_id); - } - } - - void 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 << "." << _instance << "] is " - << (_is_available ? "available." : "NOT available."); - - if (cpu_load_test::service_id == _service - && cpu_load_test::instance_id == _instance) { - if (is_available_ && !_is_available) { - is_available_ = false; - } else if (_is_available && !is_available_) { - is_available_ = true; - std::lock_guard<std::mutex> its_lock(mutex_); - wait_for_availability_ = false; - condition_.notify_one(); - } - } - } - void on_message(const std::shared_ptr<vsomeip::message> &_response) { - - number_of_acknowledged_messages_++; - ASSERT_EQ(_response->get_service(), cpu_load_test::service_id); - ASSERT_EQ(_response->get_method(), cpu_load_test::method_id); - if(call_service_sync_) - { - // We notify the sender thread every time a message was acknowledged - std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_); - wait_for_all_msg_acknowledged_ = false; - all_msg_acknowledged_cv_.notify_one(); - } - else - { - // We notify the sender thread only if all sent messages have been acknowledged - if(number_of_acknowledged_messages_ == number_of_calls_current_) - { - std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_); - number_of_acknowledged_messages_ = 0; - wait_for_all_msg_acknowledged_ = false; - all_msg_acknowledged_cv_.notify_one(); - } - else if(number_of_acknowledged_messages_ % sliding_window_size_ == 0) - { - std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_); - wait_for_all_msg_acknowledged_ = false; - all_msg_acknowledged_cv_.notify_one(); - } - } - } - - void run() { - std::unique_lock<std::mutex> its_lock(mutex_); - while (wait_for_availability_) { - condition_.wait(its_lock); - } - - request_->set_service(cpu_load_test::service_id); - request_->set_instance(cpu_load_test::instance_id); - request_->set_method(cpu_load_test::method_id); - std::shared_ptr<vsomeip::payload> payload = vsomeip::runtime::get()->create_payload(); - std::vector<vsomeip::byte_t> payload_data; - payload_data.assign(payload_size_, cpu_load_test::load_test_data); - payload->set_data(payload_data); - request_->set_payload(payload); - - // lock the mutex - for(std::uint32_t i=0; i <= number_of_calls_; i++) { - number_of_calls_current_ = i; - sliding_window_size_ = i; - std::unique_lock<std::mutex> lk(all_msg_acknowledged_mutex_); - call_service_sync_ ? send_messages_sync(lk, i) : send_messages_async(lk, i); - } - const double average_load(std::accumulate(results_.begin(), results_.end(), 0.0) / static_cast<double>(results_.size())); - VSOMEIP_INFO << "Sent: " << number_of_sent_messages_total_ - << " messages in total (excluding control messages). This caused: " - << std::fixed << std::setprecision(2) - << average_load << "% load in average (average of " - << results_.size() << " measurements)."; - - std::vector<double> results_no_zero; - for(const auto &v : results_) { - if(v > 0.0) { - results_no_zero.push_back(v); - } - } - const double average_load_no_zero(std::accumulate(results_no_zero.begin(), results_no_zero.end(), 0.0) / static_cast<double>(results_no_zero.size())); - VSOMEIP_INFO << "Sent: " << number_of_sent_messages_total_ - << " messages in total (excluding control messages). This caused: " - << std::fixed << std::setprecision(2) - << average_load_no_zero << "% load in average, if measured " - << "cpu load was greater zero (average of " - << results_no_zero.size() << " measurements)."; - - wait_for_availability_ = true; - - stop(); - if (initialized_) { - app_->stop(); - } - } - - - void send_messages_sync(std::unique_lock<std::mutex>& lk, std::uint32_t _messages_to_send) { - cpu_load_measurer c(::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); - // wait until the send messages has been acknowledged - while(wait_for_all_msg_acknowledged_) { - all_msg_acknowledged_cv_.wait(lk); - } - wait_for_all_msg_acknowledged_ = true; - } - c.stop(); - send_service_start_measuring(false); - VSOMEIP_DEBUG << "Synchronously sent " << std::setw(4) << std::setfill('0') - << number_of_sent_messages_ << " messages. CPU load [%]: " - << std::fixed << std::setprecision(2) - << (std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0); - results_.push_back(std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0); - - } - - void send_messages_async(std::unique_lock<std::mutex>& lk, std::uint32_t _messages_to_send) { - cpu_load_measurer c(::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); - if((number_of_sent_messages_+1) % sliding_window_size_ == 0) - { - // wait until all send messages have been acknowledged - while(wait_for_all_msg_acknowledged_) { - all_msg_acknowledged_cv_.wait(lk); - } - wait_for_all_msg_acknowledged_ = true; - } - } - c.stop(); - send_service_start_measuring(false); - VSOMEIP_DEBUG << "Asynchronously sent " << std::setw(4) << std::setfill('0') - << number_of_sent_messages_ << " messages. CPU load [%]: " - << std::fixed << std::setprecision(2) - << (std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0); - results_.push_back(std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0); - } - - void send_service_start_measuring(bool _start_measuring) { - std::shared_ptr<vsomeip::message> m = vsomeip::runtime::get()->create_request(protocol_ == protocol_e::PR_TCP); - m->set_service(cpu_load_test::service_id); - m->set_instance(cpu_load_test::instance_id); - _start_measuring ? m->set_method(cpu_load_test::method_id_cpu_measure_start) : m->set_method(cpu_load_test::method_id_cpu_measure_stop); - app_->send(m); - } - - void shutdown_service() { - request_->set_service(cpu_load_test::service_id); - request_->set_instance(cpu_load_test::instance_id); - request_->set_method(cpu_load_test::method_id_shutdown); - app_->send(request_); - } - -private: - protocol_e protocol_; - std::shared_ptr<vsomeip::application> app_; - std::shared_ptr<vsomeip::message> request_; - bool call_service_sync_; - bool shutdown_service_at_end_; - std::uint32_t sliding_window_size_; - std::mutex mutex_; - std::condition_variable condition_; - bool wait_for_availability_; - bool is_available_; - const std::uint32_t number_of_calls_; - std::uint32_t number_of_calls_current_; - std::uint32_t number_of_sent_messages_; - std::uint32_t number_of_sent_messages_total_; - std::uint32_t number_of_acknowledged_messages_; - - std::uint32_t payload_size_; - - bool wait_for_all_msg_acknowledged_; - std::mutex all_msg_acknowledged_mutex_; - std::condition_variable all_msg_acknowledged_cv_; - std::vector<double> results_; - std::atomic<bool> initialized_; - std::thread sender_; -}; - - -// this variables are changed via cmdline parameters -static protocol_e protocol(protocol_e::PR_UNKNOWN); -static std::uint32_t number_of_calls(0); -static std::uint32_t payload_size(40); -static bool call_service_sync(true); -static bool shutdown_service(true); - - -TEST(someip_load_test, send_messages_and_measure_cpu_load) -{ - cpu_load_test_client test_client_(protocol, number_of_calls, payload_size, call_service_sync, shutdown_service); -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - int i = 0; - while (i < argc) { - if(std::string("--protocol") == std::string(argv[i]) - || std::string("-p") == std::string(argv[i])) { - if(std::string("udp") == std::string(argv[i+1]) || - std::string("UDP") == std::string(argv[i+1])) { - protocol = protocol_e::PR_UDP; - i++; - } else if(std::string("tcp") == std::string(argv[i+1]) || - std::string("TCP") == std::string(argv[i+1])) { - protocol = protocol_e::PR_TCP; - i++; - } - } else if(std::string("--calls") == std::string(argv[i]) - || std::string("-c") == std::string(argv[i])) { - try { - number_of_calls = static_cast<std::uint32_t>(std::stoul(std::string(argv[i+1]), nullptr, 10)); - } catch (const std::exception &e) { - std::cerr << "Please specify a valid value for number of calls" << std::endl; - return(EXIT_FAILURE); - } - i++; - } else if(std::string("--mode") == std::string(argv[i]) - || std::string("-m") == std::string(argv[i])) { - if(std::string("sync") == std::string(argv[i+1]) || - std::string("SYNC") == std::string(argv[i+1])) { - call_service_sync = true; - i++; - } else if(std::string("async") == std::string(argv[i+1]) || - std::string("ASYNC") == std::string(argv[i+1])) { - call_service_sync = false; - i++; - } - } else if(std::string("--payload-size") == std::string(argv[i]) - || std::string("-pl") == std::string(argv[i])) { - try { - payload_size = static_cast<std::uint32_t>(std::stoul(std::string(argv[i+1]), nullptr, 10)); - } catch (const std::exception &e) { - std::cerr << "Please specify a valid values for payload size" << std::endl; - return(EXIT_FAILURE); - } - i++; - } else if(std::string("--help") == std::string(argv[i]) - || std::string("-h") == std::string(argv[i])) { - std::cout << "Available options:" << std::endl; - std::cout << "--protocol|-p: valid values TCP or UDP" << std::endl; - std::cout << "--calls|-c: number of message calls to do" << std::endl; - std::cout << "--mode|-m: mode sync or async" << std::endl; - std::cout << "--payload-size|-pl: payload size in Bytes default: 40" << std::endl; - } - i++; - } - - if(protocol == protocol_e::PR_UNKNOWN) { - std::cerr << "Please specify valid protocol mode, see --help" << std::endl; - return(EXIT_FAILURE); - } - if(!number_of_calls) { - std::cerr << "Please specify valid number of calls, see --help" << std::endl; - return(EXIT_FAILURE); - } - - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/cpu_load_tests/cpu_load_test_globals.hpp b/test/cpu_load_tests/cpu_load_test_globals.hpp deleted file mode 100644 index e6897e3..0000000 --- a/test/cpu_load_tests/cpu_load_test_globals.hpp +++ /dev/null @@ -1,18 +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/. - -#pragma once - -namespace cpu_load_test { - -static constexpr vsomeip::service_t service_id(0x1111); -static constexpr vsomeip::instance_t instance_id(0x1); -static constexpr vsomeip::method_t method_id(0x1111); -static constexpr vsomeip::byte_t load_test_data(0xDD); -static constexpr vsomeip::length_t default_payload_length(40); -static constexpr vsomeip::method_t method_id_shutdown(0x7777); -static constexpr vsomeip::method_t method_id_cpu_measure_start(0x8888); -static constexpr vsomeip::method_t method_id_cpu_measure_stop(0x9999); -} diff --git a/test/cpu_load_tests/cpu_load_test_master_starter.sh b/test/cpu_load_tests/cpu_load_test_master_starter.sh deleted file mode 100755 index 50bf007..0000000 --- a/test/cpu_load_tests/cpu_load_test_master_starter.sh +++ /dev/null @@ -1,80 +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=cpu_load_test_client_master.json -./cpu_load_test_client --protocol UDP --calls 1000 & -TEST_CLIENT_PID=$! -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"' & -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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** cpu_load_test_slave_starter.sh -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** cpu_load_test_client_master.json, -** cpu_load_test_service_master.json, -** cpu_load_test_client_client.json and -** cpu_load_test_service_client.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# Fail gets incremented if either client or service exit -# with a non-zero exit code -wait $TEST_CLIENT_PID || FAIL=$(($FAIL+1)) - - -sleep 4 -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Now switching roles and running service on this host (master) -******************************************************************************* -******************************************************************************* -End-of-message - -export VSOMEIP_CONFIGURATION=cpu_load_test_service_master.json -./cpu_load_test_service & -sleep 1 - -# now we can wait to all jobs to finish -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - 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 - exit 0 -else - exit 1 -fi diff --git a/test/cpu_load_tests/cpu_load_test_service.cpp b/test/cpu_load_tests/cpu_load_test_service.cpp deleted file mode 100644 index b0b6ea6..0000000 --- a/test/cpu_load_tests/cpu_load_test_service.cpp +++ /dev/null @@ -1,208 +0,0 @@ -// 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 <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> -#include <numeric> -#include <cmath> // for isfinite - -#include "cpu_load_test_globals.hpp" -#include "../../implementation/logging/include/logger.hpp" -#include "cpu_load_measurer.hpp" - -// for getpid -#include <sys/types.h> -#include <unistd.h> - -class cpu_load_test_service -{ -public: - cpu_load_test_service() : - app_(vsomeip::runtime::get()->create_application("cpu_load_test_service")), - is_registered_(false), - blocked_(false), - number_of_received_messages_(0), - number_of_received_messages_total_(0), - load_measurer_(::getpid()), - offer_thread_(std::bind(&cpu_load_test_service::run, this)) - { - } - - ~cpu_load_test_service() { - { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); - } - offer_thread_.join(); - } - - bool init() - { - std::lock_guard<std::mutex> its_lock(mutex_); - - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - app_->register_message_handler(cpu_load_test::service_id, - cpu_load_test::instance_id, cpu_load_test::method_id, - std::bind(&cpu_load_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_message_handler(cpu_load_test::service_id, - cpu_load_test::instance_id, cpu_load_test::method_id_shutdown, - std::bind(&cpu_load_test_service::on_message_shutdown, this, - std::placeholders::_1)); - app_->register_message_handler(cpu_load_test::service_id, - cpu_load_test::instance_id, cpu_load_test::method_id_cpu_measure_start, - std::bind(&cpu_load_test_service::on_message_start_measuring, this, - std::placeholders::_1)); - app_->register_message_handler(cpu_load_test::service_id, - cpu_load_test::instance_id, cpu_load_test::method_id_cpu_measure_stop, - std::bind(&cpu_load_test_service::on_message_stop_measuring, this, - std::placeholders::_1)); - app_->register_state_handler( - std::bind(&cpu_load_test_service::on_state, this, - std::placeholders::_1)); - return true; - } - - void start() - { - VSOMEIP_INFO << "Starting..."; - app_->start(); - } - - void stop() - { - VSOMEIP_INFO << "Stopping..."; - app_->stop_offer_service(cpu_load_test::service_id, cpu_load_test::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) - { - if(!is_registered_) - { - is_registered_ = true; - blocked_ = true; - // "start" the run method thread - condition_.notify_one(); - } - } - else - { - is_registered_ = false; - } - } - - void on_message(const std::shared_ptr<vsomeip::message>& _request) - { - number_of_received_messages_++; - number_of_received_messages_total_++; - // send response - app_->send(vsomeip::runtime::get()->create_response(_request), true); - } - - void on_message_start_measuring(const std::shared_ptr<vsomeip::message>& _request) - { - (void)_request; - load_measurer_.start(); - } - - void on_message_stop_measuring(const std::shared_ptr<vsomeip::message>& _request) - { - (void)_request; - load_measurer_.stop(); - VSOMEIP_DEBUG << "Received " << std::setw(4) << std::setfill('0') - << number_of_received_messages_ << " messages. CPU load [%]: " - << std::fixed << std::setprecision(2) - << (std::isfinite(load_measurer_.get_cpu_load()) ? load_measurer_.get_cpu_load() : 0.0); - results_.push_back(std::isfinite(load_measurer_.get_cpu_load()) ? load_measurer_.get_cpu_load() : 0.0); - number_of_received_messages_ = 0; - } - - void on_message_shutdown( - const std::shared_ptr<vsomeip::message>& _request) - { - (void)_request; - VSOMEIP_INFO << "Shutdown method was called, going down now."; - const double average_load(std::accumulate(results_.begin(), results_.end(), 0.0) / static_cast<double>(results_.size())); - VSOMEIP_INFO << "Received: " << number_of_received_messages_total_ - << " in total (excluding control messages). This caused: " - << std::fixed << std::setprecision(2) - << average_load << "% load in average (average of " - << results_.size() << " measurements)."; - - std::vector<double> results_no_zero; - for(const auto &v : results_) { - if(v > 0.0) { - results_no_zero.push_back(v); - } - } - const double average_load_no_zero(std::accumulate(results_no_zero.begin(), results_no_zero.end(), 0.0) / static_cast<double>(results_no_zero.size())); - VSOMEIP_INFO << "Sent: " << number_of_received_messages_total_ - << " messages in total (excluding control messages). This caused: " - << std::fixed << std::setprecision(2) - << average_load_no_zero << "% load in average, if measured cpu load " - << "was greater zero (average of " - << results_no_zero.size() << " measurements)."; - stop(); - } - - void run() - { - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) { - condition_.wait(its_lock); - } - - app_->offer_service(cpu_load_test::service_id, cpu_load_test::instance_id); - } - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - std::uint32_t number_of_received_messages_; - std::uint32_t number_of_received_messages_total_; - cpu_load_measurer load_measurer_; - std::vector<double> results_; - std::thread offer_thread_; -}; - - -TEST(someip_payload_test, send_response_for_every_request) -{ - cpu_load_test_service test_service; - if (test_service.init()) { - test_service.start(); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/cpu_load_tests/cpu_load_test_slave_starter.sh b/test/cpu_load_tests/cpu_load_test_slave_starter.sh deleted file mode 100755 index 83ef19d..0000000 --- a/test/cpu_load_tests/cpu_load_test_slave_starter.sh +++ /dev/null @@ -1,52 +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=cpu_load_test_service_slave.json -./cpu_load_test_service & - -# Wait until all applications are finished -for job in $(jobs -p) -do - # Fail gets incremented if one of the binaries exits - # with a non-zero exit code - wait $job || FAIL=$(($FAIL+1)) -done - -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Now switching roles and running client on this host (slave) -******************************************************************************* -******************************************************************************* -End-of-message - -sleep 4 -export VSOMEIP_CONFIGURATION=cpu_load_test_client_slave.json -./cpu_load_test_client --protocol UDP --calls 1000 & - -for job in $(jobs -p) -do - # Fail gets incremented if one of the binaries exits - # with a non-zero exit code - wait $job || FAIL=$(($FAIL+1)) -done - - -# Check if both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/header_factory_tests/header_factory_test.cpp b/test/header_factory_tests/header_factory_test.cpp deleted file mode 100644 index bcd1ef3..0000000 --- a/test/header_factory_tests/header_factory_test.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// 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 <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include "../someip_test_globals.hpp" - -class someip_header_factory_test: public ::testing::Test -{ -protected: - std::shared_ptr<vsomeip::message> request_; - std::shared_ptr<vsomeip::message> response_; - std::shared_ptr<vsomeip::message> notification_; - std::shared_ptr<vsomeip::application> app_; - std::shared_ptr<vsomeip::message> message_; - - vsomeip::service_t service_id_ = vsomeip_test::TEST_SERVICE_SERVICE_ID; - vsomeip::method_t method_id_ = vsomeip_test::TEST_SERVICE_METHOD_ID; - vsomeip::instance_t instance_id_ = vsomeip_test::TEST_SERVICE_INSTANCE_ID; - vsomeip::interface_version_t interface_version_ = 0x01; - vsomeip::client_t client_id_ = vsomeip_test::TEST_CLIENT_CLIENT_ID; - vsomeip::session_t session_id_ = vsomeip_test::TEST_INITIAL_SESSION_ID; -}; - -TEST_F(someip_header_factory_test, create_request_test) -{ - ASSERT_TRUE(request_.get() == nullptr); - request_ = vsomeip::runtime::get()->create_request(); - - // check that returned shared_ptr is not null - ASSERT_TRUE(request_.get() != nullptr); - - // Check the protocol version - // this shall be set to 0x01 according to the spec. TR_SOMEIP_00052 - ASSERT_EQ(request_->get_protocol_version(), 0x01); - // Check the message type - // this shall be 0x00 (REQUEST) according to the spec. TR_SOMEIP_00055 - ASSERT_EQ(request_->get_message_type(), vsomeip::message_type_e::MT_REQUEST); - // Check the return code - // this shall be 0x00 (E_OK) according to the spec. TR_SOMEIP_00058 - ASSERT_EQ(request_->get_return_code(), vsomeip::return_code_e::E_OK); - -} - -TEST_F(someip_header_factory_test, create_request_and_response_test) -{ - ASSERT_TRUE(request_.get() == nullptr); - request_ = vsomeip::runtime::get()->create_request(); - // check that returned shared_ptr is not null - ASSERT_TRUE(request_.get() != nullptr); - - request_->set_service(service_id_); - request_->set_method(method_id_); - request_->set_interface_version(interface_version_); - // set the request_id (client_id + session_id). This normally is set by the - // application_impl::send() if a request is send, we set it here to test the - // correct initialization of the response - request_->set_client(client_id_); - request_->set_session(session_id_); - - ASSERT_TRUE(response_.get() == nullptr); - response_ = vsomeip::runtime::get()->create_response(request_); - // check that returned shared_ptr is not null - ASSERT_TRUE(response_.get() != nullptr); - - ASSERT_EQ(response_->get_service(), request_->get_service()); - ASSERT_EQ(response_->get_method(), request_->get_method()); - ASSERT_EQ(response_->get_session(), request_->get_session()); - - // length? --> gets only set if a payload is added - - ASSERT_EQ(response_->get_protocol_version(), request_->get_protocol_version()); - ASSERT_EQ(response_->get_interface_version(), request_->get_interface_version()); - - // Check the message type - // this shall be 0x00 (REQUEST) according to the spec. TR_SOMEIP_00055 - ASSERT_EQ(request_->get_message_type(), vsomeip::message_type_e::MT_REQUEST); - - // Check the message type - // this shall be 0x80 (RESPONSE) according to the spec. TR_SOMEIP_00055 - ASSERT_EQ(response_->get_message_type(), vsomeip::message_type_e::MT_RESPONSE); - - // Check the return code - // this shall be 0x00 (E_OK) according to the spec. TR_SOMEIP_00058 - // and TR_SOMEIP_00191 - ASSERT_EQ(response_->get_return_code(), vsomeip::return_code_e::E_OK); - -} - -TEST_F(someip_header_factory_test, create_notification_test) -{ - ASSERT_TRUE(notification_.get() == nullptr); - notification_ = vsomeip::runtime::get()->create_notification(); - - // check that returned shared_ptr is not null - ASSERT_TRUE(notification_.get() != nullptr); - - // Check the protocol version - // this shall be set to 0x01 according to the spec. TR_SOMEIP_00052 - ASSERT_EQ(notification_->get_protocol_version(), 0x01); - // Check the message type - // this shall be 0x02 (NOTIFICATION) according to the spec. TR_SOMEIP_00055 - ASSERT_EQ(notification_->get_message_type(), vsomeip::message_type_e::MT_NOTIFICATION); - // Check the return code - // this shall be 0x00 (E_OK) according to the spec. TR_SOMEIP_00058 - ASSERT_EQ(notification_->get_return_code(), vsomeip::return_code_e::E_OK); -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/header_factory_tests/header_factory_test_client.cpp b/test/header_factory_tests/header_factory_test_client.cpp deleted file mode 100644 index 90cfef5..0000000 --- a/test/header_factory_tests/header_factory_test_client.cpp +++ /dev/null @@ -1,171 +0,0 @@ -// 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 "header_factory_test_client.hpp" - -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), - number_of_sent_messages_(0), - number_of_acknowledged_messages_(0), - sender_(std::bind(&header_factory_test_client::run, this)) -{ -} - -bool header_factory_test_client::init() -{ - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - - app_->register_state_handler( - std::bind(&header_factory_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD, - std::bind(&header_factory_test_client::on_message, this, - std::placeholders::_1)); - - app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - std::bind(&header_factory_test_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - return true; -} - -void header_factory_test_client::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void header_factory_test_client::stop() -{ - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); -} - -void header_factory_test_client::join_sender_thread(){ - sender_.join(); - - ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_); -} - -void header_factory_test_client::on_state(vsomeip::state_type_e _state) -{ - if(_state == vsomeip::state_type_e::ST_REGISTERED) - { - app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); - } -} - -void header_factory_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 << "." << _instance << "] is " - << (_is_available ? "available." : "NOT available."); - - if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service - && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) - { - if(is_available_ && !_is_available) - { - is_available_ = false; - } - else if(_is_available && !is_available_) - { - is_available_ = true; - send(); - } - } -} - -void header_factory_test_client::on_message(const std::shared_ptr<vsomeip::message>& _response) -{ - VSOMEIP_INFO << "Received a response from Service [" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_session() << "]"; - number_of_acknowledged_messages_++; - ASSERT_EQ(_response->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID); - ASSERT_EQ(_response->get_instance(), vsomeip_test::TEST_SERVICE_INSTANCE_ID); - ASSERT_EQ(_response->get_session(), - static_cast<vsomeip::session_t>(number_of_acknowledged_messages_)); - if(number_of_acknowledged_messages_ == number_of_messages_to_send_) { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); - } -} - -void header_factory_test_client::send() -{ - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); -} - -void header_factory_test_client::run() -{ - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - { - condition_.wait(its_lock); - } - blocked_ = false; - 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); - - for (uint32_t i = 0; i < number_of_messages_to_send_; i++) - { - app_->send(request_, true); - 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() - << "] sent a request to Service [" << std::setw(4) - << std::setfill('0') << std::hex << request_->get_service() - << "." << std::setw(4) << std::setfill('0') << std::hex - << request_->get_instance() << "]"; - number_of_sent_messages_++; - } - // wait until all messages have been acknowledged - while (!blocked_) - { - condition_.wait(its_lock); - } - stop(); -} - -TEST(someip_header_factory_test, send_message_ten_times_test) -{ - bool use_tcp = false; - header_factory_test_client test_client_(use_tcp); - if (test_client_.init()) { - test_client_.start(); - test_client_.join_sender_thread(); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/header_factory_tests/header_factory_test_client.hpp b/test/header_factory_tests/header_factory_test_client.hpp deleted file mode 100644 index eb62191..0000000 --- a/test/header_factory_tests/header_factory_test_client.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// 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/. - -#ifndef HEADERFACTORYTESTCLIENT_HPP_ -#define HEADERFACTORYTESTCLIENT_HPP_ - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> - -#include "../someip_test_globals.hpp" - -class header_factory_test_client -{ -public: - header_factory_test_client(bool _use_tcp); - bool init(); - void start(); - void stop(); - void join_sender_thread(); - void on_state(vsomeip::state_type_e _state); - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available); - void on_message(const std::shared_ptr<vsomeip::message> &_response); - void send(); - void run(); - -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_; - std::uint32_t number_of_sent_messages_; - std::uint32_t number_of_acknowledged_messages_; - std::thread sender_; -}; - -#endif /* HEADERFACTORYTESTCLIENT_HPP_ */ diff --git a/test/header_factory_tests/header_factory_test_client.json b/test/header_factory_tests/header_factory_test_client.json deleted file mode 100644 index 71bc75b..0000000 --- a/test/header_factory_tests/header_factory_test_client.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "netmask" : "255.255.255.0", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "true", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "true" - }, - - "applications" : - [ - { - "name" : "header_factory_test_client", - "id" : "0x1343" - } - ], - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678", - "unreliable" : "30509", - "events" : - [ - { - "event" : "0x0777", - "is_field" : "true" - }, - - { - "event" : "0x0778", - "is_field" : "false" - }, - - { - "event" : "0x0779", - "is_field" : "true" - } - ], - - "eventgroups" : - [ - { - "eventgroup" : "0x4455", - "events" : - [ - "0x777", - "0x778" - ] - }, - - { - "eventgroup" : "0x4465", - "events" : - [ - "0x778", - "0x779" - ], - - "is_multicast" : "true" - }, - - { - "eventgroup" : "0x4555", - "events" : - [ - "0x777", - "0x779" - ] - } - ] - } - ], - - "routing" : "header_factory_test_service", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30491", - "protocol" : "udp", - "initial_delay_min" : "10", - "initial_delay_max" : "100", - "repetitions_base_delay" : "200", - "repetitions_max" : "3", - "ttl" : "3", - "cyclic_offer_delay" : "2000", - "request_response_delay" : "1500" - } -}
\ No newline at end of file diff --git a/test/header_factory_tests/header_factory_test_client_start.sh b/test/header_factory_tests/header_factory_test_client_start.sh deleted file mode 100755 index 4e9c1ed..0000000 --- a/test/header_factory_tests/header_factory_test_client_start.sh +++ /dev/null @@ -1,8 +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/. -export VSOMEIP_APPLICATION_NAME=header_factory_test_client -export VSOMEIP_CONFIGURATION=header_factory_test_client.json -./header_factory_test_client diff --git a/test/header_factory_tests/header_factory_test_send_receive_starter.sh b/test/header_factory_tests/header_factory_test_send_receive_starter.sh deleted file mode 100755 index 5d1d780..0000000 --- a/test/header_factory_tests/header_factory_test_send_receive_starter.sh +++ /dev/null @@ -1,39 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -# Start the service -export VSOMEIP_APPLICATION_NAME=header_factory_test_service -export VSOMEIP_CONFIGURATION=header_factory_test_service.json -./header_factory_test_service & -sleep 1; - -# Start the client -export VSOMEIP_APPLICATION_NAME=header_factory_test_client -export VSOMEIP_CONFIGURATION=header_factory_test_client.json -./header_factory_test_client & - -# Wait until client and service are finished -FAIL=0 -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if client and server both exited sucessfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/header_factory_tests/header_factory_test_service.cpp b/test/header_factory_tests/header_factory_test_service.cpp deleted file mode 100644 index 12527ed..0000000 --- a/test/header_factory_tests/header_factory_test_service.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// 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 "header_factory_test_service.hpp" - -#include <cstdlib> - -header_factory_test_service::header_factory_test_service(bool _use_static_routing) : - app_(vsomeip::runtime::get()->create_application()), - is_registered_(false), - use_static_routing_(_use_static_routing), - blocked_(false), - number_of_received_messages_(0), - offer_thread_(std::bind(&header_factory_test_service::run, this)) -{ -} - -bool header_factory_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(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID, - std::bind(&header_factory_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&header_factory_test_service::on_state, this, - std::placeholders::_1)); - - VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF"); - return true; -} - -void header_factory_test_service::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void header_factory_test_service::stop() -{ - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); - std::thread t([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));}); - t.join(); -} - -void header_factory_test_service::join_offer_thread() -{ - offer_thread_.join(); -} - -void header_factory_test_service::offer() -{ - app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void header_factory_test_service::stop_offer() -{ - app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void header_factory_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 header_factory_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() << "]"; - - number_of_received_messages_++; - - ASSERT_EQ(_request->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID); - ASSERT_EQ(_request->get_method(), vsomeip_test::TEST_SERVICE_METHOD_ID); - - // Check the protocol version this shall be set to 0x01 according to the spec. - // TR_SOMEIP_00052 - ASSERT_EQ(_request->get_protocol_version(), 0x01); - // Check the message type this shall be 0xx (REQUEST) according to the spec. - // TR_SOMEIP_00055 - ASSERT_EQ(_request->get_message_type(), vsomeip::message_type_e::MT_REQUEST); - - // check the session id. - ASSERT_EQ(_request->get_session(), static_cast<vsomeip::session_t>(number_of_received_messages_)); - - - // send response - std::shared_ptr<vsomeip::message> its_response = - vsomeip::runtime::get()->create_response(_request); - - app_->send(its_response, true); - - if(number_of_received_messages_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND) - { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ =true; - condition_.notify_one(); - } - ASSERT_LT(number_of_received_messages_, - vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1); -} - -void header_factory_test_service::run() -{ - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - condition_.wait(its_lock); - - blocked_ = false; - if(use_static_routing_) - { - offer(); - } - while (!blocked_) - condition_.wait(its_lock); - - std::thread t([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));}); - t.join(); - app_->stop(); -} - -TEST(someip_header_factory_test, reveice_message_ten_times_test) -{ - bool use_static_routing = true; - header_factory_test_service test_service(use_static_routing); - 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/header_factory_tests/header_factory_test_service.hpp b/test/header_factory_tests/header_factory_test_service.hpp deleted file mode 100644 index 32e49e5..0000000 --- a/test/header_factory_tests/header_factory_test_service.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// 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/. - -#ifndef HEADERFACTORYTESTSERVICE_HPP_ -#define HEADERFACTORYTESTSERVICE_HPP_ -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> - -#include "../someip_test_globals.hpp" - -class header_factory_test_service -{ -public: - header_factory_test_service(bool _use_static_routing); - bool init(); - void start(); - void stop(); - void offer(); - void stop_offer(); - void join_offer_thread(); - void on_state(vsomeip::state_type_e _state); - void on_message(const std::shared_ptr<vsomeip::message> &_request); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - bool use_static_routing_; - - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - std::uint32_t number_of_received_messages_; - std::thread offer_thread_; -}; - -#endif /* HEADERFACTORYTESTSERVICE_HPP_ */ diff --git a/test/header_factory_tests/header_factory_test_service.json b/test/header_factory_tests/header_factory_test_service.json deleted file mode 100644 index a99d0a2..0000000 --- a/test/header_factory_tests/header_factory_test_service.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "header_factory_test_service", - "id" : "0x1277" - } - ], - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678", - "unreliable" : "30509", - "multicast" : - { - "address" : "224.225.226.233", - "port" : "32344" - }, - - "events" : - [ - { - "event" : "0x0777", - "is_field" : "true", - "update-cycle" : 2000 - }, - - { - "event" : "0x0778", - "is_field" : "true", - "update-cycle" : 0 - }, - - { - "event" : "0x0779", - "is_field" : "true" - } - ], - - "eventgroups" : - [ - { - "eventgroup" : "0x4455", - "events" : - [ - "0x777", - "0x778" - ] - }, - - { - "eventgroup" : "0x4465", - "events" : - [ - "0x778", - "0x779" - ], - - "is_multicast" : "true" - }, - - { - "eventgroup" : "0x4555", - "events" : - [ - "0x777", - "0x779" - ] - } - ] - } - ], - - "routing" : "header_factory_test_service", - - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp", - "initial_delay_min" : "10", - "initial_delay_max" : "100", - "repetitions_base_delay" : "200", - "repetitions_max" : "3", - "ttl" : "3", - "cyclic_offer_delay" : "2000", - "request_response_delay" : "1500" - } -}
\ No newline at end of file diff --git a/test/header_factory_tests/header_factory_test_service_start.sh b/test/header_factory_tests/header_factory_test_service_start.sh deleted file mode 100755 index e123a46..0000000 --- a/test/header_factory_tests/header_factory_test_service_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=header_factory_test_service -export VSOMEIP_CONFIGURATION=header_factory_test_service.json -./header_factory_test_service diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in deleted file mode 100644 index d7b5c7b..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in +++ /dev/null @@ -1,81 +0,0 @@ -{ - "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":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - }, - { - "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_diff_ports_master_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in deleted file mode 100644 index 7cb35fb..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in +++ /dev/null @@ -1,165 +0,0 @@ -{ - "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":"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", - "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/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in deleted file mode 100644 index 6445025..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in +++ /dev/null @@ -1,81 +0,0 @@ -{ - "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":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1111", - "instance":"0x0002", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1111", - "instance":"0x0003", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - }, - { - "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_diff_ports_same_service_id_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in deleted file mode 100644 index c5dddc3..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in +++ /dev/null @@ -1,82 +0,0 @@ -{ - "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":"0x2222", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0002", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0003", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - }, - { - "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/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in deleted file mode 100644 index 3e7e286..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in +++ /dev/null @@ -1,82 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - }, - { - "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/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 deleted file mode 100644 index 320e2a3..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in +++ /dev/null @@ -1,166 +0,0 @@ -{ - "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", - "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", - "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_partial_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in deleted file mode 100644 index f168fae..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in +++ /dev/null @@ -1,81 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - }, - { - "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_partial_same_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in deleted file mode 100644 index 30206a2..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in +++ /dev/null @@ -1,82 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - }, - { - "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/conf/initial_event_test_diff_client_ids_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in deleted file mode 100644 index 785e651..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in +++ /dev/null @@ -1,81 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "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_master_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in deleted file mode 100644 index 7336aa2..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in +++ /dev/null @@ -1,165 +0,0 @@ -{ - "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", - "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", - "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.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in deleted file mode 100644 index cfbdac4..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in +++ /dev/null @@ -1,82 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "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/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 deleted file mode 100644 index f22ad4e..0000000 --- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in +++ /dev/null @@ -1,166 +0,0 @@ -{ - "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", - "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", - "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/conf/initial_event_test_same_client_ids_diff_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in deleted file mode 100644 index d7b5c7b..0000000 --- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in +++ /dev/null @@ -1,81 +0,0 @@ -{ - "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":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - }, - { - "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_same_client_ids_diff_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in deleted file mode 100644 index facc51a..0000000 --- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in +++ /dev/null @@ -1,82 +0,0 @@ -{ - "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":"0x1111" - }, - { - "name":"initial_event_test_service_five", - "id":"0x2222" - }, - { - "name":"initial_event_test_service_six", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x4444", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - }, - { - "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/conf/initial_event_test_same_client_ids_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in deleted file mode 100644 index 785e651..0000000 --- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in +++ /dev/null @@ -1,81 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "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_same_client_ids_same_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in deleted file mode 100644 index 97b5d9f..0000000 --- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in +++ /dev/null @@ -1,82 +0,0 @@ -{ - "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":"0x1111" - }, - { - "name":"initial_event_test_service_five", - "id":"0x2222" - }, - { - "name":"initial_event_test_service_six", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x4444", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "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 deleted file mode 100644 index 719d6d3..0000000 --- a/test/initial_event_tests/initial_event_test_availability_checker.cpp +++ /dev/null @@ -1,164 +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 "initial_event_test_globals.hpp" - - -class initial_event_test_availability_checker { -public: - initial_event_test_availability_checker(int _client_number, - std::array<initial_event_test::service_info, 7> _service_infos) : - client_number_(_client_number), - 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()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&initial_event_test_availability_checker::on_state, this, - std::placeholders::_1)); - - // register availability for all other services and request their event. - for(const auto& i : service_infos_) { - if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) { - continue; - } - other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false; - app_->register_availability_handler(i.service_id, i.instance_id, - std::bind(&initial_event_test_availability_checker::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - app_->request_service(i.service_id, i.instance_id); - } - - app_->start(); - } - - ~initial_event_test_availability_checker() { - 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) { - auto its_service = other_services_available_.find(std::make_pair(_service, _instance)); - if(its_service != other_services_available_.end()) { - if(its_service->second != _is_available) { - its_service->second = true; - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is available."; - - } - } - - 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;})) { - - 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 << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] all services are available. Going down"; - app_->clear_all_handler(); - app_->stop(); - } - -private: - int client_number_; - std::array<initial_event_test::service_info, 7> service_infos_; - std::shared_ptr<vsomeip::application> app_; - 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_; - - bool wait_for_stop_; - std::mutex stop_mutex_; - std::condition_variable stop_condition_; - std::thread stop_thread_; -}; - -static int client_number; -static bool use_same_service_id; - -TEST(someip_initial_event_test, wait_for_availability_and_exit) -{ - if(use_same_service_id) { - initial_event_test_availability_checker its_sample(client_number, - initial_event_test::service_infos_same_service_id); - } else { - initial_event_test_availability_checker its_sample(client_number, - initial_event_test::service_infos); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cerr << "Please specify a client number and subscription type, like: " << argv[0] << " 2 SAME_SERVICE_ID" << std::endl; - std::cerr << "Valid client numbers are from 0 to 0xFFFF" << 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; - } - - client_number = std::stoi(std::string(argv[1]), nullptr); - - if (argc >= 3 && std::string("SAME_SERVICE_ID") == std::string(argv[2])) { - use_same_service_id = true; - } else { - use_same_service_id = false; - } - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/initial_event_tests/initial_event_test_client.cpp b/test/initial_event_tests/initial_event_test_client.cpp deleted file mode 100644 index 22940eb..0000000 --- a/test/initial_event_tests/initial_event_test_client.cpp +++ /dev/null @@ -1,457 +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> - -#ifndef _WIN32 -#include <signal.h> -#endif - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "initial_event_test_globals.hpp" -class initial_event_test_client; -static initial_event_test_client* the_client; -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, - 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) : - client_number_(_client_number), - service_infos_(_service_infos), - subscription_type_(_subscription_type), - 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), - initial_event_strict_checking_(_initial_event_strict_checking), - dont_exit_(_dont_exit), - stop_thread_(std::bind(&initial_event_test_client::wait_for_stop, 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(&initial_event_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind(&initial_event_test_client::on_message, this, - std::placeholders::_1)); - - // register availability for all other services and request their event. - for(const auto& i : service_infos_) { - if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) { - continue; - } - app_->register_availability_handler(i.service_id, i.instance_id, - std::bind(&initial_event_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); - 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); - } - - other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false; - for (std::uint32_t j = 0; j < events_to_subscribe_; j++ ) { - other_services_received_notification_[std::make_pair(i.service_id, i.method_id + j)] = 0; - } - 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_); - } 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_, - static_cast<vsomeip::event_t>(i.event_id + j)); - } - } - } - } - - app_->start(); - } - - ~initial_event_test_client() { - 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) { - auto its_service = other_services_available_.find(std::make_pair(_service, _instance)); - if(its_service != other_services_available_.end()) { - if(its_service->second != _is_available) { - its_service->second = true; - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is available."; - - } - } - - 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 << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] all services are available."; - if (subscribe_on_available_) { - for(const auto& i : service_infos_) { - if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) { - continue; - } - if (events_to_subscribe_ == 1 ) { - app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id, - vsomeip::DEFAULT_MAJOR, subscription_type_); - } 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_, - static_cast<vsomeip::event_t>(i.event_id + j)); - } - } - } - } - } - } - } - - 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 << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] " - << "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(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(notify && !dont_exit_) { - std::lock_guard<std::mutex> its_lock(stop_mutex_); - wait_for_stop_ = false; - stop_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 == initial_event_test::notifications_to_send) { - return true; - } else { - if (v.second >= initial_event_test::notifications_to_send) { - VSOMEIP_WARNING - << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] " - << " 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"; - if (initial_event_strict_checking_) { - ADD_FAILURE() << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] " - << " 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; - } - return initial_event_strict_checking_ ? false : true; - - } else { - return false; - } - } - } - ); - } - - bool all_notifications_received_tcp_and_udp() { - std::uint32_t received_twice(0); - std::uint32_t received_normal(0); - for(const auto &v : other_services_received_notification_) { - if (!initial_event_strict_checking_ && - v.second > initial_event_test::notifications_to_send * 2) { - VSOMEIP_WARNING - << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] " - << " 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 - << ". This is caused by StopSubscribe/Subscribe messages and/or" - << " service offered via UDP and TCP"; - received_twice++; - } else if (initial_event_strict_checking_ && - v.second > initial_event_test::notifications_to_send * 2) { - ADD_FAILURE() << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] " - << " 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; - } else if (v.second == initial_event_test::notifications_to_send * 2) { - received_twice++; - } else if(v.second == initial_event_test::notifications_to_send) { - received_normal++; - } - } - - if( received_twice == ((service_infos_.size() - 1) * events_to_subscribe_)/ 2 - && received_normal == ((service_infos_.size() - 1) * events_to_subscribe_)/ 2) { - // 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 - << client_number_ << "] " - << "Received notifications:" - << " Normal: " << received_normal - << " Twice: " << received_twice; - return true; - } else if (initial_event_strict_checking_ && ( - received_twice > ((service_infos_.size() - 1) * events_to_subscribe_)/ 2)) { - ADD_FAILURE() << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] " - << " Received too much initial events twice: " << received_twice; - } else if (received_normal == (events_to_subscribe_ * (service_infos_.size() - 1))) { - return true; - } - return false; - } - - void handle_signal(int _signum) { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] 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 << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ - << "] Received notifications from all services, 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_->clear_all_handler(); - app_->stop(); - } - -private: - int client_number_; - std::array<initial_event_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_; - - bool wait_until_registered_; - bool wait_until_other_services_available_; - std::mutex mutex_; - std::condition_variable condition_; - - bool wait_for_stop_; - - bool subscribe_on_available_; - std::uint32_t events_to_subscribe_; - bool initial_event_strict_checking_; - bool dont_exit_; - - std::mutex stop_mutex_; - std::condition_variable stop_condition_; - std::thread stop_thread_; -}; - -static int client_number; -static vsomeip::subscription_type_e subscription_type; -static bool use_same_service_id; -static bool subscribe_on_available; -static std::uint32_t subscribe_multiple_events; -static bool initial_event_strict_checking; -static bool dont_exit; - -extern "C" void signal_handler(int signum) { - the_client->handle_signal(signum); -} - -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); - } else { - initial_event_test_client its_sample(client_number, subscription_type, - initial_event_test::service_infos, subscribe_on_available, - subscribe_multiple_events, initial_event_strict_checking, dont_exit); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::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; - 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 << " - 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; - std::cerr << " - STRICT_CHECKING flag. If set the test will only successfully finish if exactly the number of initial events were received (and not more). Default false" << std::endl; - std::cerr << " - DONT_EXIT flag. If set the test will not exit if all notifications have been received. Default false" << std::endl; - return 1; - } - - 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; - use_same_service_id = false; - subscribe_multiple_events = 1; - dont_exit = false; - if (argc > 3) { - for (int i = 3; 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])) { - subscribe_on_available = false; - } else if (std::string("SAME_SERVICE_ID") == std::string(argv[i])) { - use_same_service_id = true; - } else if (std::string("MULTIPLE_EVENTS") == std::string(argv[i])) { - subscribe_multiple_events = 5; - } else if (std::string("STRICT_CHECKING") == std::string(argv[i])) { - initial_event_strict_checking = true; - } else if (std::string("DONT_EXIT") == std::string(argv[i])) { - dont_exit = true; - } - } - } - - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/initial_event_tests/initial_event_test_globals.hpp b/test/initial_event_tests/initial_event_test_globals.hpp deleted file mode 100644 index ce69ea9..0000000 --- a/test/initial_event_tests/initial_event_test_globals.hpp +++ /dev/null @@ -1,51 +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 SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ -#define SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ - -namespace initial_event_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, 7> service_infos = {{ - // placeholder to be consistent w/ client ids, service ids, app names - { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }, - // node 1 - { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 }, - { 0x2222, 0x1, 0x2222, 0x2222, 0x2000 }, - { 0x3333, 0x1, 0x3333, 0x3333, 0x3000 }, - // node 2 - { 0x4444, 0x1, 0x4444, 0x4444, 0x4000 }, - { 0x5555, 0x1, 0x5555, 0x5555, 0x5000 }, - { 0x6666, 0x1, 0x6666, 0x6666, 0x6000 } -}}; - -static constexpr std::array<service_info, 7> service_infos_same_service_id = {{ - // placeholder to be consistent w/ client ids, service ids, app names - { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }, - // node 1 - { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 }, - { 0x1111, 0x2, 0x2222, 0x2222, 0x2000 }, - { 0x1111, 0x3, 0x3333, 0x3333, 0x3000 }, - // node 2 - { 0x2222, 0x1, 0x4444, 0x4444, 0x4000 }, - { 0x2222, 0x2, 0x5555, 0x5555, 0x5000 }, - { 0x2222, 0x3, 0x6666, 0x6666, 0x6000 } -}}; - -static constexpr service_info stop_service_master = { 0x8888, 0x1, 0x8888, 0x0, 0x0 }; -static constexpr service_info stop_service_slave = { 0x9999, 0x1, 0x9999, 0x0, 0x0 }; - -static constexpr int notifications_to_send = 1; -} - -#endif /* SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ */ diff --git a/test/initial_event_tests/initial_event_test_master_starter.sh b/test/initial_event_tests/initial_event_test_master_starter.sh deleted file mode 100755 index 9eee669..0000000 --- a/test/initial_event_tests/initial_event_test_master_starter.sh +++ /dev/null @@ -1,161 +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. - -if [ $# -lt 2 ] -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 "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter" - exit 1 -fi - -PASSED_SUBSCRIPTION_TYPE=$1 -PASSED_JSON_FILE=$2 -# Remove processed options from $@ -shift 2 -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\"" & -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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** initial_event_test_diff_client_ids_diff_ports_master.json and -** initial_event_test_diff_client_ids_diff_ports_slave.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi -} - -# replace master with slave to be able display the correct json file to be used -# with the slave script -MASTER_JSON_FILE=$PASSED_JSON_FILE -CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave} - -FAIL=0 - -# Start the services -export VSOMEIP_CONFIGURATION=$PASSED_JSON_FILE - -export VSOMEIP_APPLICATION_NAME=initial_event_test_service_one -./initial_event_test_service 1 $REMAINING_OPTIONS & -PID_SERVICE_ONE=$! - -export VSOMEIP_APPLICATION_NAME=initial_event_test_service_two -./initial_event_test_service 2 $REMAINING_OPTIONS & -PID_SERVICE_TWO=$! - -export VSOMEIP_APPLICATION_NAME=initial_event_test_service_three -./initial_event_test_service 3 $REMAINING_OPTIONS & -PID_SERVICE_THREE=$! - -unset VSOMEIP_APPLICATION_NAME - -# Array for client pids -CLIENT_PIDS=() - -# Start first client which subscribes remotely -./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE DONT_EXIT $REMAINING_OPTIONS & -FIRST_PID=$! - -# Start availability checker in order to wait until the services on the remote -# were started as well -./initial_event_test_availability_checker 1234 $REMAINING_OPTIONS & -PID_AVAILABILITY_CHECKER=$! - -sleep 1 - -print_starter_message - - -# wait until the services on the remote node were started as well -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 & - CLIENT_PIDS+=($!) -done - -# 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 - -# wait until all clients exited on slave side -./initial_event_test_stop_service MASTER & -PID_STOP_SERVICE=$! -wait $PID_STOP_SERVICE - -# shutdown the first client -kill $FIRST_PID -wait $FIRST_PID || FAIL=$(($FAIL+1)) - -# shutdown the services -kill $PID_SERVICE_THREE -kill $PID_SERVICE_TWO -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 - exit 0 -else - exit 1 -fi diff --git a/test/initial_event_tests/initial_event_test_service.cpp b/test/initial_event_tests/initial_event_test_service.cpp deleted file mode 100644 index 037149e..0000000 --- a/test/initial_event_tests/initial_event_test_service.cpp +++ /dev/null @@ -1,150 +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 "initial_event_test_globals.hpp" - - -class initial_event_test_service { -public: - initial_event_test_service(struct initial_event_test::service_info _service_info, - std::uint32_t _events_to_offer) : - service_info_(_service_info), - app_(vsomeip::runtime::get()->create_application()), - wait_until_registered_(true), - events_to_offer_(_events_to_offer), - offer_thread_(std::bind(&initial_event_test_service::run, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&initial_event_test_service::on_state, this, - std::placeholders::_1)); - - // offer field - std::set<vsomeip::eventgroup_t> its_eventgroups; - 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); - } - - // 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>((service_info_.service_id & 0xFF00) >> 8), - static_cast<vsomeip::byte_t>((service_info_.service_id & 0xFF))}; - its_payload->set_data(its_data, 2); - for (std::uint16_t i = 0; i < events_to_offer_; i++) { - app_->notify(service_info_.service_id, service_info_.instance_id, - static_cast<vsomeip::event_t>(service_info_.event_id + i), its_payload); - } - - app_->start(); - } - - ~initial_event_test_service() { - offer_thread_.join(); - } - - void offer() { - app_->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 " - << (_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 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(); - } - -private: - initial_event_test::service_info service_info_; - 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 int service_number; -static bool use_same_service_id; -static std::uint32_t offer_multiple_events; - -TEST(someip_initial_event_test, set_field_once) -{ - if(use_same_service_id) { - initial_event_test_service its_sample( - initial_event_test::service_infos_same_service_id[service_number], offer_multiple_events); - } else { - initial_event_test_service its_sample( - initial_event_test::service_infos[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,6]" << std::endl; - std::cerr << "After the service number one/multiple of these flags can be specified:"; - 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 offer to multiple events in the eventgroup, default false" << std::endl; - return 1; - } - - service_number = std::stoi(std::string(argv[1]), nullptr); - - offer_multiple_events = 1; - use_same_service_id = false; - - if (argc > 2) { - for (int i = 2; i < argc; i++) { - if (std::string("SAME_SERVICE_ID") == std::string(argv[i])) { - use_same_service_id = true; - } else if (std::string("MULTIPLE_EVENTS") == std::string(argv[i])) { - offer_multiple_events = 5; - } - } - } - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/initial_event_tests/initial_event_test_slave_starter.sh b/test/initial_event_tests/initial_event_test_slave_starter.sh deleted file mode 100755 index 69e96f7..0000000 --- a/test/initial_event_tests/initial_event_test_slave_starter.sh +++ /dev/null @@ -1,121 +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. - -if [ $# -lt 2 ] -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" - exit 1 -fi - -PASSED_SUBSCRIPTION_TYPE=$1 -PASSED_JSON_FILE=$2 -# Remove processed options from $@ -shift 2 -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 - -# Start the services -export VSOMEIP_APPLICATION_NAME=initial_event_test_service_four -./initial_event_test_service 4 $REMAINING_OPTIONS & -PID_SERVICE_FOUR=$! - -export VSOMEIP_APPLICATION_NAME=initial_event_test_service_five -./initial_event_test_service 5 $REMAINING_OPTIONS & -PID_SERVICE_FIVE=$! - -export VSOMEIP_APPLICATION_NAME=initial_event_test_service_six -./initial_event_test_service 6 $REMAINING_OPTIONS & -PID_SERVICE_SIX=$! - -unset VSOMEIP_APPLICATION_NAME - -# Array for client pids -CLIENT_PIDS=() - -# Start first client which subscribes remotely -./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE DONT_EXIT $REMAINING_OPTIONS & -FIRST_PID=$! - -# Start availability checker in order to wait until the services on the remote -# were started as well -./initial_event_test_availability_checker 1234 $REMAINING_OPTIONS & -PID_AVAILABILITY_CHECKER=$! - -# wait until the services on the remote node were started as well -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 & - CLIENT_PIDS+=($!) -done - -# 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 - -# wait until all clients exited on master side -./initial_event_test_stop_service SLAVE & -PID_STOP_SERVICE=$! -wait $PID_STOP_SERVICE - -# shutdown the first client -kill $FIRST_PID -wait $FIRST_PID || FAIL=$(($FAIL+1)) - -# shutdown the services -kill $PID_SERVICE_SIX -kill $PID_SERVICE_FIVE -kill $PID_SERVICE_FOUR - -sleep 1 -echo "" - -# Check if both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/initial_event_tests/initial_event_test_stop_service.cpp b/test/initial_event_tests/initial_event_test_stop_service.cpp deleted file mode 100644 index 8f32fbc..0000000 --- a/test/initial_event_tests/initial_event_test_stop_service.cpp +++ /dev/null @@ -1,274 +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 <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "initial_event_test_globals.hpp" - - -class initial_event_test_stop_service { -public: - initial_event_test_stop_service(struct initial_event_test::service_info _service_info, bool _is_master) : - service_info_(_service_info), - is_master_(_is_master), - app_(vsomeip::runtime::get()->create_application()), - wait_until_registered_(true), - wait_until_stop_service_other_node_available_(true), - wait_until_shutdown_method_called_(true), - offer_thread_(std::bind(&initial_event_test_stop_service::run, this)), - wait_for_stop_(true), - stop_thread_(std::bind(&initial_event_test_stop_service::wait_for_stop, this)), - called_other_node_(false) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&initial_event_test_stop_service::on_state, this, - std::placeholders::_1)); - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.method_id, - std::bind(&initial_event_test_stop_service::on_shutdown_method_called, this, - std::placeholders::_1)); - - // register availability for all other services and request their event. - if (is_master_) { - app_->request_service( - initial_event_test::stop_service_slave.service_id, - initial_event_test::stop_service_slave.instance_id); - app_->register_availability_handler( - initial_event_test::stop_service_slave.service_id, - initial_event_test::stop_service_slave.instance_id, - std::bind(&initial_event_test_stop_service::on_availability, - this, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - } else { - app_->request_service( - initial_event_test::stop_service_master.service_id, - initial_event_test::stop_service_master.instance_id); - app_->register_availability_handler( - initial_event_test::stop_service_master.service_id, - initial_event_test::stop_service_master.instance_id, - std::bind(&initial_event_test_stop_service::on_availability, - this, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - } - app_->start(); - } - - ~initial_event_test_stop_service() { - offer_thread_.join(); - stop_thread_.join(); - } - - void offer() { - if (is_master_) { - app_->offer_service( - initial_event_test::stop_service_master.service_id, - initial_event_test::stop_service_master.instance_id); - } else { - app_->offer_service( - initial_event_test::stop_service_slave.service_id, - initial_event_test::stop_service_slave.instance_id); - } - } - - void stop_offer() { - if (is_master_) { - app_->stop_offer_service( - initial_event_test::stop_service_master.service_id, - initial_event_test::stop_service_master.instance_id); - } else { - app_->stop_offer_service( - initial_event_test::stop_service_slave.service_id, - initial_event_test::stop_service_slave.instance_id); - } - } - - 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) { - bool notify(false); - if(_is_available) { - VSOMEIP_INFO << "[" << 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."; - if(is_master_) { - if(_service == initial_event_test::stop_service_slave.service_id - && _instance == initial_event_test::stop_service_slave.instance_id) { - notify = true; - } - } else { - if(_service == initial_event_test::stop_service_master.service_id - && _instance == initial_event_test::stop_service_master.instance_id) { - notify = true; - } - } - } - if (notify) { - std::lock_guard<std::mutex> its_lock(availability_mutex_); - wait_until_stop_service_other_node_available_ = false; - availability_condition_.notify_one(); - } - } - - void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) { - if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST_NO_RETURN) { - VSOMEIP_DEBUG << "Received a request 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() << "] shutdown method called"; - - std::lock_guard<std::mutex> its_lock(stop_mutex_); - 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_) { - condition_.wait(its_lock); - } - } - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Offering"; - offer(); - - { - std::unique_lock<std::mutex> its_availability_lock(availability_mutex_); - while (wait_until_stop_service_other_node_available_) { - availability_condition_.wait(its_availability_lock); - } - } - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Calling shutdown method on remote side"; - - std::shared_ptr<vsomeip::message> msg(vsomeip::runtime::get()->create_request()); - msg->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN); - if(is_master_) { - msg->set_service(initial_event_test::stop_service_slave.service_id); - msg->set_instance(initial_event_test::stop_service_slave.instance_id); - msg->set_method(initial_event_test::stop_service_slave.method_id); - } else { - msg->set_service(initial_event_test::stop_service_master.service_id); - msg->set_instance(initial_event_test::stop_service_master.instance_id); - msg->set_method(initial_event_test::stop_service_master.method_id); - } - app_->send(msg); - called_other_node_ = true; - { - std::unique_lock<std::mutex> its_lock(mutex_); - while (wait_until_shutdown_method_called_) { - condition_.wait(its_lock); - } - } - } - - void wait_for_stop() { - 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 - << service_info_.service_id - << "] shutdown method was called, going down"; - while(!called_other_node_) { - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - } - // let offer thread exit - { - std::lock_guard<std::mutex> its_lock(mutex_); - wait_until_shutdown_method_called_ = false; - condition_.notify_one(); - } - app_->clear_all_handler(); - app_->stop(); - } - -private: - initial_event_test::service_info service_info_; - bool is_master_; - 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_stop_service_other_node_available_; - bool wait_until_shutdown_method_called_; - std::mutex mutex_; - std::condition_variable condition_; - std::thread offer_thread_; - - std::mutex availability_mutex_; - std::condition_variable availability_condition_; - - std::atomic<bool> wait_for_stop_; - std::mutex stop_mutex_; - std::condition_variable stop_condition_; - std::thread stop_thread_; - - std::atomic<bool> called_other_node_; -}; - -static bool is_master = false; - -TEST(someip_initial_event_test, wait_for_stop_method_to_be_called) -{ - if(is_master) { - initial_event_test_stop_service its_sample(initial_event_test::stop_service_master, is_master); - } else { - initial_event_test_stop_service its_sample(initial_event_test::stop_service_slave, is_master); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cerr << "Please specify a valid type, like: " << argv[0] << " MASTER" << std::endl; - std::cerr << "Valid types are in the range of [MASTER,SLAVE]" << std::endl; - return 1; - } - - if (argc >= 2 && std::string("MASTER") == std::string(argv[1])) { - is_master = true; - } else if (argc >= 2 && std::string("SLAVE") == std::string(argv[1])){ - is_master = false; - } - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in b/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in deleted file mode 100644 index bcb2e29..0000000 --- a/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in +++ /dev/null @@ -1,85 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "netmask":"255.255.255.0", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"true", - "path":"/var/log/vsomeip.log" - }, - "dlt":"true" - }, - "applications": - [ - { - "name":"magic_cookies_test_client", - "id":"0x1343" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678", - "unicast":"@TEST_IP_MASTER@", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"true" - }, - "events": - [ - { - "event":"0x0777", - "is_field":"true" - }, - { - "event":"0x0778", - "is_field":"false" - }, - { - "event":"0x0779", - "is_field":"true" - } - ], - "eventgroups": - [ - { - "eventgroup":"0x4455", - "events": - [ - "0x777", - "0x778" - ] - }, - { - "eventgroup":"0x4465", - "events": - [ - "0x778", - "0x779" - ] - }, - { - "eventgroup":"0x4555", - "events": - [ - "0x777", - "0x779" - ] - } - ] - } - ], - "routing":"magic_cookies_test_client", - "service-discovery": - { - "enable":"false", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -} diff --git a/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in b/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in deleted file mode 100644 index 0e53c24..0000000 --- a/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in +++ /dev/null @@ -1,88 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"debug", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"magic_cookies_test_service", - "id":"0x1277" - } - ], - "services": - [ - { - "service":"0x1234", - "instance":"0x5678", - "reliable": - { - "port":"30509", - "enable-magic-cookies":"true" - }, - "events": - [ - { - "event":"0x0777", - "is_field":"false", - "is_reliable":"true", - "update-cycle":"2000" - }, - { - "event":"0x0778", - "is_field":"true", - "is_reliable":"true", - "update-cycle":"0" - }, - { - "event":"0x0779", - "is_field":"false", - "is_reliable":"true" - } - ], - "eventgroups": - [ - { - "eventgroup":"0x4455", - "events": - [ - "0x777", - "0x778" - ] - }, - { - "eventgroup":"0x4465", - "events": - [ - "0x778", - "0x779" - ] - }, - { - "eventgroup":"0x4555", - "events": - [ - "0x777", - "0x779" - ] - } - ] - } - ], - "routing":"magic_cookies_test_service", - "service-discovery": - { - "enable":"false", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp" - } -} diff --git a/test/magic_cookies_tests/magic_cookies_test_client.cpp b/test/magic_cookies_tests/magic_cookies_test_client.cpp deleted file mode 100644 index 4be0889..0000000 --- a/test/magic_cookies_tests/magic_cookies_test_client.cpp +++ /dev/null @@ -1,248 +0,0 @@ -// 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 <chrono> -#include <condition_variable> -#include <iomanip> -#include <memory> -#include <thread> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include "../someip_test_globals.hpp" -#include "../implementation/runtime/include/application_impl.hpp" -#include "../implementation/routing/include/routing_manager.hpp" - -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), - received_responses_(0), - received_errors_(0), - wait_for_replies_(true), - runner_(std::bind(&magic_cookies_test_client::run, this)) { - } - - void init() { - VSOMEIP_INFO << "Initializing..."; - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - exit(EXIT_FAILURE); - } - - app_->register_state_handler( - std::bind( - &magic_cookies_test_client::on_state, - this, - std::placeholders::_1)); - - app_->register_message_handler( - vsomeip::ANY_SERVICE, vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD, - std::bind(&magic_cookies_test_client::on_message, - this, - std::placeholders::_1)); - - 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)); - } - - void start() { - VSOMEIP_INFO << "Starting..."; - app_->start(); - } - - void stop() { - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); - } - - void on_state(vsomeip::state_type_e _state) { - if (_state == vsomeip::state_type_e::ST_REGISTERED) { - 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); - } - } - - void 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 << "." << _instance - << "] is " - << (_is_available ? "available." : "NOT available."); - - if (vsomeip_test::TEST_SERVICE_SERVICE_ID == _service && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) { - static bool is_available = false; - if (is_available && !_is_available) is_available = false; - else if (_is_available && !is_available) { - is_available = true; - std::lock_guard< std::mutex > its_lock(mutex_); - is_blocked_ = true; - condition_.notify_one(); - } - } - } - - void on_message(const std::shared_ptr< vsomeip::message > &_response) { - if (_response->get_return_code() == vsomeip::return_code_e::E_OK) { - VSOMEIP_INFO << "Received a response from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() - << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() - << "]"; - received_responses_++; - } else if (_response->get_return_code() == vsomeip::return_code_e::E_MALFORMED_MESSAGE) { - VSOMEIP_INFO << "Received an error message from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() - << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() - << "]"; - received_errors_++; - } - if (received_errors_ == sent_messages_bad_ - && received_responses_ == sent_messages_good_) { - std::lock_guard<std::mutex> its_lock(mutex_); - wait_for_replies_ = false; - condition_.notify_one(); - } - } - - void join() { - runner_.join(); - } - - void run() { - std::unique_lock< std::mutex > its_lock(mutex_); - while (!is_blocked_) { - if (std::cv_status::timeout == - condition_.wait_for(its_lock, std::chrono::milliseconds(5000))) { - GTEST_NONFATAL_FAILURE_("Service didn't become available within 5s."); - break; - } - } - VSOMEIP_INFO << "Running..."; - - vsomeip::routing_manager *its_routing = app_->get_routing_manager(); - - vsomeip::byte_t its_good_payload_data[] = { - 0x12, 0x34, 0x84, 0x21, - 0x00, 0x00, 0x00, 0x11, - 0x13, 0x43, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 - }; - - vsomeip::byte_t its_bad_payload_data[] = { - 0x12, 0x34, 0x84, 0x21, - 0x00, 0x00, 0x01, 0x23, - 0x13, 0x43, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 - }; - - // 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - - while (wait_for_replies_) { - if(std::cv_status::timeout == - condition_.wait_for(its_lock, std::chrono::milliseconds(5000))) { - GTEST_NONFATAL_FAILURE_("Didn't receive all replies/errors in time"); - break; - } - } - EXPECT_EQ(sent_messages_good_, received_responses_); - EXPECT_EQ(sent_messages_bad_, received_errors_); - stop(); - } - -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_; - std::atomic<std::uint32_t> received_responses_; - std::atomic<std::uint32_t> received_errors_; - bool wait_for_replies_; - std::thread runner_; -}; - -TEST(someip_magic_cookies_test, send_good_and_bad_messages) -{ - magic_cookies_test_client its_client; - its_client.init(); - its_client.start(); - its_client.join(); -} - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - - diff --git a/test/magic_cookies_tests/magic_cookies_test_client_start.sh b/test/magic_cookies_tests/magic_cookies_test_client_start.sh deleted file mode 100755 index 45f4d3c..0000000 --- a/test/magic_cookies_tests/magic_cookies_test_client_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=magic_cookies_test_client -export VSOMEIP_CONFIGURATION=magic_cookies_test_client.json -./magic_cookies_test_client diff --git a/test/magic_cookies_tests/magic_cookies_test_service.cpp b/test/magic_cookies_tests/magic_cookies_test_service.cpp deleted file mode 100644 index 7cd4376..0000000 --- a/test/magic_cookies_tests/magic_cookies_test_service.cpp +++ /dev/null @@ -1,168 +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 <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include "../someip_test_globals.hpp" - -class magic_cookies_test_service { -public: - magic_cookies_test_service(bool _use_static_routing) : - app_(vsomeip::runtime::get()->create_application()), - is_registered_(false), - use_static_routing_(_use_static_routing), - blocked_(false), - offer_thread_(std::bind(&magic_cookies_test_service::run, this)) { - } - - ~magic_cookies_test_service() { - offer_thread_.join(); - } - void init() { - std::lock_guard<std::mutex> its_lock(mutex_); - - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - exit(EXIT_FAILURE); - } - app_->register_message_handler( - vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - vsomeip_test::TEST_SERVICE_METHOD_ID, - std::bind(&magic_cookies_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&magic_cookies_test_service::on_state, this, - std::placeholders::_1)); - - VSOMEIP_INFO<< "Static routing " << (use_static_routing_ ? "ON" : "OFF"); - } - - void start() { - app_->start(); - } - - void offer() { - app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); - } - - void stop_offer() { - app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); - } - - 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) { - if (!is_registered_) { - is_registered_ = true; - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); - } - } else { - is_registered_ = false; - } - } - - void 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() << "]"; - - 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; - for (std::size_t i = 0; i < 120; ++i) - its_payload_data.push_back(i % 256); - its_payload->set_data(its_payload_data); - its_response->set_payload(its_payload); - - app_->send(its_response, true); - if(_request->get_session() == 0x0F) { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); - } - } - - void run() { - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - condition_.wait(its_lock); - - bool is_offer(true); - blocked_ = false; - - if (use_static_routing_) { - offer(); - while (!blocked_) { - if(std::cv_status::timeout == - condition_.wait_for(its_lock, std::chrono::seconds(200))) { - GTEST_NONFATAL_FAILURE_("Didn't receive all requests within time"); - break; - } - } - std::this_thread::sleep_for(std::chrono::milliseconds(5)); - app_->clear_all_handler(); - app_->stop(); - } else { - while (true) { - if (is_offer) - offer(); - else - stop_offer(); - std::this_thread::sleep_for(std::chrono::milliseconds(10000)); - is_offer = !is_offer; - } - } - } - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - bool use_static_routing_; - - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - std::thread offer_thread_; -}; - -static bool use_static_routing = false; - -TEST(someip_magic_cookies_test, reply_to_good_messages) -{ - magic_cookies_test_service its_sample(use_static_routing); - its_sample.init(); - its_sample.start(); -} - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - std::string static_routing_enable("--static-routing"); - for (int i = 1; i < argc; i++) { - if (static_routing_enable == argv[i]) { - use_static_routing = true; - } - } - return RUN_ALL_TESTS(); -} diff --git a/test/magic_cookies_tests/magic_cookies_test_service_start.sh b/test/magic_cookies_tests/magic_cookies_test_service_start.sh deleted file mode 100755 index 9288b7e..0000000 --- a/test/magic_cookies_tests/magic_cookies_test_service_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=magic_cookies_test_service -export VSOMEIP_CONFIGURATION=magic_cookies_test_service.json -./magic_cookies_test_service --tcp --static-routing diff --git a/test/magic_cookies_tests/magic_cookies_test_starter.sh b/test/magic_cookies_tests/magic_cookies_test_starter.sh deleted file mode 100755 index 631eef7..0000000 --- a/test/magic_cookies_tests/magic_cookies_test_starter.sh +++ /dev/null @@ -1,59 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit successfully. - -# Display a message to show the user that he must now call the external service -# to finish the test successfully - -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\"" & -elif [ ! -z "$USE_DOCKER" ]; then - docker run $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./magic_cookies_test_client_start.sh" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** magic_cookies_test_client_start.sh -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** magic_cookies_client.json and -** magic_cookies_service.json to your personal setup. -** -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# Start the client for magic-cookies test -export VSOMEIP_APPLICATION_NAME=magic_cookies_test_service -export VSOMEIP_CONFIGURATION=magic_cookies_test_service.json -./magic_cookies_test_service --tcp --static-routing & - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if client and server both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi 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 deleted file mode 100644 index 066989b..0000000 --- a/test/malicious_data_tests/conf/malicious_data_test_master.json.in +++ /dev/null @@ -1,44 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications" : - [ - { - "name" : "malicious_data_test_service", - "id" : "0x4289", - "max_dispatch_time" : "1000" - } - ], - "services": - [ - { - "service":"0x3345", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - } - ], - "routing":"vsomeipd", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.24.1", - "port":"30490", - "protocol":"udp", - "cyclic_offer_delay" : "1000" - } -}
\ No newline at end of file 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 deleted file mode 100755 index 199f318..0000000 --- a/test/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in +++ /dev/null @@ -1,66 +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=malicious_data_test_master.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -# Start the services -./malicious_data_test_service & -PID_SERIVCE=$! - -sleep 1 - -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@\"" & - 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@" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** malicious_data_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** malicious_data_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 - -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_globals.hpp b/test/malicious_data_tests/malicious_data_test_globals.hpp deleted file mode 100644 index f6336a4..0000000 --- a/test/malicious_data_tests/malicious_data_test_globals.hpp +++ /dev/null @@ -1,32 +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 MALICIOUS_DATA_TEST_GLOBALS_HPP_ -#define MALICIOUS_DATA_TEST_GLOBALS_HPP_ - -namespace malicious_data_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 = { 0x3344, 0x1, 0x1111, 0x8002, 0x1, 0x1404, 0x4242 }; - -enum test_mode_e { - SUBSCRIBE, - SUBSCRIBE_UNSUBSCRIBE, - UNSUBSCRIBE, - SUBSCRIBE_UNSUBSCRIBE_NACK -}; - -} - -#endif /* MALICIOUS_DATA_TEST_GLOBALS_HPP_ */ diff --git a/test/malicious_data_tests/malicious_data_test_msg_sender.cpp b/test/malicious_data_tests/malicious_data_test_msg_sender.cpp deleted file mode 100644 index ad856b8..0000000 --- a/test/malicious_data_tests/malicious_data_test_msg_sender.cpp +++ /dev/null @@ -1,283 +0,0 @@ -// 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 <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/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/message/include/message_impl.hpp" -#include "malicious_data_test_globals.hpp" - -static char* remote_address; -static char* local_address; - -class malicious_data : public ::testing::Test { -public: - malicious_data() : - work_(std::make_shared<boost::asio::io_service::work>(io_)), - io_thread_(std::bind(&malicious_data::io_run, this)) {} -protected: - - void TearDown() { - work_.reset(); - io_thread_.join(); - io_.stop(); - } - - void io_run() { - io_.run(); - } - - boost::asio::io_service io_; - std::shared_ptr<boost::asio::io_service::work> work_; - std::thread io_thread_; -}; - -TEST_F(malicious_data, send_malicious_events) -{ - std::promise<bool> client_subscribed; - - boost::asio::ip::tcp::socket tcp_socket(io_); - boost::asio::ip::udp::socket udp_socket(io_, - boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490)); - - 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) { - 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(1u, sd_msg.get_entries().size()); - for (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()); - EXPECT_EQ(1,e->get_num_options(1)); - EXPECT_EQ(std::uint32_t(0xFFFFFF), e->get_ttl()); - EXPECT_EQ(malicious_data_test::service.service_id, e->get_service()); - EXPECT_EQ(malicious_data_test::service.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(1u, its_casted_entry->get_eventgroup()); - } - client_subscribed.set_value(true); - keep_receiving = false; - } - } - } - - - }; - - 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)); - } - }); - - std::thread send_thread([&]() { - try { - std::promise<bool> client_connected; - boost::asio::ip::tcp::socket::endpoint_type local( - boost::asio::ip::address::from_string(std::string(local_address)), - 40001); - boost::asio::ip::tcp::acceptor its_acceptor(io_); - boost::system::error_code ec; - its_acceptor.open(local.protocol(), ec); - boost::asio::detail::throw_error(ec, "acceptor open"); - its_acceptor.set_option(boost::asio::socket_base::reuse_address(true), ec); - boost::asio::detail::throw_error(ec, "acceptor set_option"); - its_acceptor.bind(local, ec); - boost::asio::detail::throw_error(ec, "acceptor bind"); - its_acceptor.listen(boost::asio::socket_base::max_connections, ec); - boost::asio::detail::throw_error(ec, "acceptor listen"); - its_acceptor.async_accept(tcp_socket, [&](boost::system::error_code _error) { - if (!_error) { - // Nagle algorithm off - tcp_socket.set_option(boost::asio::ip::tcp::no_delay(true)); - client_connected.set_value(true); - } else { - ADD_FAILURE() << "accept_cbk: " << _error.message(); - } - }); - - - // 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, - 0x33, 0x44, 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, 0x06, 0x9c, 0x41, - }; - boost::asio::ip::address its_local_address = - boost::asio::ip::address::from_string(std::string(local_address)); - std::memcpy(&its_offer_service_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_offer_service_message), target_sd); - - // wait until client established TCP connection - if (std::future_status::timeout == client_connected.get_future().wait_for(std::chrono::seconds(10))) { - ADD_FAILURE() << "Client didn't connect within time"; - } - - // wait until client subscribed - if (std::future_status::timeout == client_subscribed.get_future().wait_for(std::chrono::seconds(10))) { - ADD_FAILURE() << "Client didn't subscribe within time"; - } - - // send malicious data as server - std::uint8_t its_malicious_data[] = { - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x11, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x38, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x86, 0x6f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xad, 0x7f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xd4, 0x8f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xfb, 0x9f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x22, 0xaf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, // payload missing - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x49, 0xbf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x70, 0xcf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x43, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x6d, 0x80, 0x00, 0x45, 0x22, 0x80, 0x00, 0x45, 0x3b, 0x80, 0x00, 0x43, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x97, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x23, 0x99, 0x00, 0x4e, 0xb3, 0xe4, 0x4e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x48, 0x00, 0x00, 0x45, 0x96, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x45, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x22, 0x91, 0x00, 0x4e, 0xb3, 0xe3, 0xd7, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x44, 0x48, 0x00, 0x00, 0x45, 0x9c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xe5, 0xff, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x21, 0x6c, 0x00, 0x4e, 0xb3, 0xe3, 0x55, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x20, 0x00, 0x44, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x0d, 0x0f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x20, 0xa9, 0x00, 0x4e, 0xb3, 0xe3, 0x56, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x45, 0x6d, 0x80, 0x00, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x34, 0x1f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1f, 0xc6, 0x00, 0x4e, 0xb3, 0xe3, 0x87, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x96, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x44, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x5b, 0x2f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1e, 0xf1, 0x00, 0x4e, 0xb3, 0xe3, 0x5e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x45, 0x9c, 0x40, 0x00, 0x45, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x82, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xad, 0x00, 0x4e, 0xb3, 0xe3, 0xa8, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x48, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x44, 0xaf, 0x00, 0x00, 0x45, 0x3b, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xa9, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xec, 0x00, 0x4e, 0xb3, 0xe3, 0xd8, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xa8, 0xc0, 0x00, 0x44, 0xaf, 0x00, 0x00, 0x45, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd0, 0x5f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xfa, 0x00, 0x00, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x19, 0x20, 0x00, 0x43, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x7f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x09, 0x80, 0x00, 0x44, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - tcp_socket.send(boost::asio::buffer(its_malicious_data)); - - // establish second tcp connection as client and send malicious data as well - boost::asio::ip::tcp::socket tcp_socket2(io_); - boost::asio::ip::tcp::socket::endpoint_type remote( - boost::asio::ip::address::from_string(std::string(remote_address)), - 40001); - tcp_socket2.open(remote.protocol()); - tcp_socket2.connect(remote); - std::uint8_t its_malicious_client_data[] = { - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x11, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x38, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x86, 0x6f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xad, 0x7f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xd4, 0x8f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xfb, 0x9f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x22, 0xaf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // payload missing - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x49, 0xbf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x70, 0xcf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x43, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x6d, 0x80, 0x00, 0x45, 0x22, 0x80, 0x00, 0x45, 0x3b, 0x80, 0x00, 0x43, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x97, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x23, 0x99, 0x00, 0x4e, 0xb3, 0xe4, 0x4e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x48, 0x00, 0x00, 0x45, 0x96, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x45, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x22, 0x91, 0x00, 0x4e, 0xb3, 0xe3, 0xd7, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x44, 0x48, 0x00, 0x00, 0x45, 0x9c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xe5, 0xff, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x21, 0x6c, 0x00, 0x4e, 0xb3, 0xe3, 0x55, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x20, 0x00, 0x44, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x0d, 0x0f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x20, 0xa9, 0x00, 0x4e, 0xb3, 0xe3, 0x56, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x45, 0x6d, 0x80, 0x00, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x34, 0x1f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1f, 0xc6, 0x00, 0x4e, 0xb3, 0xe3, 0x87, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x96, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x44, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x5b, 0x2f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1e, 0xf1, 0x00, 0x4e, 0xb3, 0xe3, 0x5e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x45, 0x9c, 0x40, 0x00, 0x45, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x82, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xad, 0x00, 0x4e, 0xb3, 0xe3, 0xa8, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x48, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x44, 0xaf, 0x00, 0x00, 0x45, 0x3b, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xa9, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xec, 0x00, 0x4e, 0xb3, 0xe3, 0xd8, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xa8, 0xc0, 0x00, 0x44, 0xaf, 0x00, 0x00, 0x45, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd0, 0x5f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xfa, 0x00, 0x00, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x19, 0x20, 0x00, 0x43, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x7f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x09, 0x80, 0x00, 0x44, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - tcp_socket2.send(boost::asio::buffer(its_malicious_client_data)); - - std::this_thread::sleep_for(std::chrono::milliseconds(1500)); - // call shutdown method - std::uint8_t shutdown_call[] = { - 0x33, 0x45, 0x14, 0x04, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x00, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service); - } catch (const std::exception& _e) { - std::cout << "catched exception: " << _e.what(); - ASSERT_FALSE(true); - } - - }); - - send_thread.join(); - receive_thread.join(); -} - -#ifndef _WIN32 -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - if(argc < 3) { - std::cerr << "Please pass an target and local IP address to this binary like: " - << argv[0] << " 10.0.3.1 10.0.3.202" << std::endl; - exit(1); - } - remote_address = argv[1]; - local_address = argv[2]; - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/malicious_data_tests/malicious_data_test_service.cpp b/test/malicious_data_tests/malicious_data_test_service.cpp deleted file mode 100644 index 17a4bb8..0000000 --- a/test/malicious_data_tests/malicious_data_test_service.cpp +++ /dev/null @@ -1,170 +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 <atomic> -#include <future> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "malicious_data_test_globals.hpp" - -class malicious_data_test_service { -public: - malicious_data_test_service(struct malicious_data_test::service_info _service_info, malicious_data_test::test_mode_e _testmode) : - service_info_(_service_info), - testmode_(_testmode), - app_(vsomeip::runtime::get()->create_application("malicious_data_test_service")), - wait_until_registered_(true), - wait_until_shutdown_method_called_(true), - received_events_(0), - received_methodcalls_(0), - offer_thread_(std::bind(&malicious_data_test_service::run, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&malicious_data_test_service::on_state, this, - std::placeholders::_1)); - - 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); - 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, - std::placeholders::_1)); - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.event_id, - std::bind(&malicious_data_test_service::on_event, this, - std::placeholders::_1)); - - app_->register_message_handler(static_cast<vsomeip::service_t>(service_info_.service_id + 1u), - service_info_.instance_id, 0x1, - std::bind(&malicious_data_test_service::on_message, this, - std::placeholders::_1)); - - // request service of client - 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, vsomeip::subscription_type_e::SU_RELIABLE, - service_info_.event_id); - - app_->start(); - } - - ~malicious_data_test_service() { - EXPECT_EQ(9u, received_events_); - EXPECT_EQ(9u, received_methodcalls_); - offer_thread_.join(); - } - - void offer() { - app_->offer_service(static_cast<vsomeip::service_t>(service_info_.service_id + 1u), 0x1); - } - - void stop() { - app_->stop_offer_service(static_cast<vsomeip::service_t>(service_info_.service_id + 1u), 0x1); - 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_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_event(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_.event_id, _message->get_method()); - EXPECT_EQ(std::uint32_t(0x7F), _message->get_length()); - received_events_++; - } - - void on_message(const std::shared_ptr<vsomeip::message> &_message) { - EXPECT_EQ(static_cast<vsomeip::service_t>(service_info_.service_id + 1u), _message->get_service()); - EXPECT_EQ(service_info_.instance_id, _message->get_instance()); - EXPECT_EQ(vsomeip::method_t(0x1), _message->get_method()); - EXPECT_EQ(std::uint32_t(0x7F), _message->get_length()); - received_methodcalls_++; - } - - 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_shutdown_method_called_) { - condition_.wait(its_lock); - } - stop(); - } - -private: - struct malicious_data_test::service_info service_info_; - malicious_data_test::test_mode_e testmode_; - std::shared_ptr<vsomeip::application> app_; - - bool wait_until_registered_; - bool wait_until_shutdown_method_called_; - std::uint32_t received_events_; - std::uint32_t received_methodcalls_; - std::mutex mutex_; - std::condition_variable condition_; - std::thread offer_thread_; -}; - -malicious_data_test::test_mode_e its_testmode(malicious_data_test::test_mode_e::SUBSCRIBE); - -TEST(someip_malicious_data_test, block_subscription_handler) -{ - malicious_data_test_service its_sample(malicious_data_test::service, its_testmode); -} - - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif 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 deleted file mode 100644 index 17158c1..0000000 --- a/test/offer_tests/conf/offer_test_big_sd_msg_master.json.in +++ /dev/null @@ -1,31 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications" : - [ - { - "name" : "offer_test_big_sd_msg_client", - "id" : "0x6666" - } - ], - "routing":"vsomeipd", - "service-discovery": - { - "enable":"true", - "ttl" : "3", - "multicast":"224.0.11.1", - "port":"30490", - "protocol":"udp", - "cyclic_offer_delay" : "1000" - } -}
\ No newline at end of file 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 deleted file mode 100755 index 2547673..0000000 --- a/test/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in +++ /dev/null @@ -1,82 +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=offer_test_big_sd_msg_master.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! - -./offer_test_big_sd_msg_client & -CLIENT_PID=$! - - -sleep 1 - -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\"" & - 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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** offer_test_big_sd_msg_slave_starter.sh -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** offer_test_big_sd_msg_master.json and -** offer_test_big_sd_msg_slave.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# Wait until all clients and services are finished -for job in $CLIENT_PID -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 - -if [ ! -z "$USE_DOCKER" ]; then - docker stop otems - docker rm otems -fi - -# wait for slave to finish -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - echo "[Master] waiting for job $job" - wait $job || ((FAIL+=1)) -done - -# Check if everything went well -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi 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 deleted file mode 100644 index cd5056a..0000000 --- a/test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in +++ /dev/null @@ -1,334 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications" : - [ - { - "name" : "offer_test_big_sd_msg_service", - "id" : "0x7777" - } - ], - "services": - [ - {"service":"0x1","instance":"0x1","unreliable":"30001","reliable":{"port":"30001","enable-magic-cookies":"false"}}, - {"service":"0x2","instance":"0x1","unreliable":"30002","reliable":{"port":"30002","enable-magic-cookies":"false"}}, - {"service":"0x3","instance":"0x1","unreliable":"30003","reliable":{"port":"30003","enable-magic-cookies":"false"}}, - {"service":"0x4","instance":"0x1","unreliable":"30004","reliable":{"port":"30004","enable-magic-cookies":"false"}}, - {"service":"0x5","instance":"0x1","unreliable":"30005","reliable":{"port":"30005","enable-magic-cookies":"false"}}, - {"service":"0x6","instance":"0x1","unreliable":"30006","reliable":{"port":"30006","enable-magic-cookies":"false"}}, - {"service":"0x7","instance":"0x1","unreliable":"30007","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x8","instance":"0x1","unreliable":"30008","reliable":{"port":"30008","enable-magic-cookies":"false"}}, - {"service":"0x9","instance":"0x1","unreliable":"60000","reliable":{"port":"30009","enable-magic-cookies":"false"}}, - {"service":"0xA","instance":"0x1","unreliable":"30010","reliable":{"port":"30010","enable-magic-cookies":"false"}}, - {"service":"0xB","instance":"0x1","unreliable":"30011","reliable":{"port":"30011","enable-magic-cookies":"false"}}, - {"service":"0xC","instance":"0x1","unreliable":"30012","reliable":{"port":"30012","enable-magic-cookies":"false"}}, - {"service":"0xD","instance":"0x1","unreliable":"30013","reliable":{"port":"30013","enable-magic-cookies":"false"}}, - {"service":"0xE","instance":"0x1","unreliable":"30014","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xF","instance":"0x1","unreliable":"30015","reliable":{"port":"30015","enable-magic-cookies":"false"}}, - {"service":"0x10","instance":"0x1","unreliable":"30016","reliable":{"port":"30016","enable-magic-cookies":"false"}}, - {"service":"0x11","instance":"0x1","unreliable":"30017","reliable":{"port":"30017","enable-magic-cookies":"false"}}, - {"service":"0x12","instance":"0x1","unreliable":"60000","reliable":{"port":"30018","enable-magic-cookies":"false"}}, - {"service":"0x13","instance":"0x1","unreliable":"30019","reliable":{"port":"30019","enable-magic-cookies":"false"}}, - {"service":"0x14","instance":"0x1","unreliable":"30020","reliable":{"port":"30020","enable-magic-cookies":"false"}}, - {"service":"0x15","instance":"0x1","unreliable":"30021","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x16","instance":"0x1","unreliable":"30022","reliable":{"port":"30022","enable-magic-cookies":"false"}}, - {"service":"0x17","instance":"0x1","unreliable":"30023","reliable":{"port":"30023","enable-magic-cookies":"false"}}, - {"service":"0x18","instance":"0x1","unreliable":"30024","reliable":{"port":"30024","enable-magic-cookies":"false"}}, - {"service":"0x19","instance":"0x1","unreliable":"30025","reliable":{"port":"30025","enable-magic-cookies":"false"}}, - {"service":"0x1A","instance":"0x1","unreliable":"30026","reliable":{"port":"30026","enable-magic-cookies":"false"}}, - {"service":"0x1B","instance":"0x1","unreliable":"60000","reliable":{"port":"30027","enable-magic-cookies":"false"}}, - {"service":"0x1C","instance":"0x1","unreliable":"30028","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x1D","instance":"0x1","unreliable":"30029","reliable":{"port":"30029","enable-magic-cookies":"false"}}, - {"service":"0x1E","instance":"0x1","unreliable":"30030","reliable":{"port":"30030","enable-magic-cookies":"false"}}, - {"service":"0x1F","instance":"0x1","unreliable":"30031","reliable":{"port":"30031","enable-magic-cookies":"false"}}, - {"service":"0x20","instance":"0x1","unreliable":"30032","reliable":{"port":"30032","enable-magic-cookies":"false"}}, - {"service":"0x21","instance":"0x1","unreliable":"30033","reliable":{"port":"30033","enable-magic-cookies":"false"}}, - {"service":"0x22","instance":"0x1","unreliable":"30034","reliable":{"port":"30034","enable-magic-cookies":"false"}}, - {"service":"0x23","instance":"0x1","unreliable":"30035","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x24","instance":"0x1","unreliable":"60000","reliable":{"port":"30036","enable-magic-cookies":"false"}}, - {"service":"0x25","instance":"0x1","unreliable":"30037","reliable":{"port":"30037","enable-magic-cookies":"false"}}, - {"service":"0x26","instance":"0x1","unreliable":"30038","reliable":{"port":"30038","enable-magic-cookies":"false"}}, - {"service":"0x27","instance":"0x1","unreliable":"30039","reliable":{"port":"30039","enable-magic-cookies":"false"}}, - {"service":"0x28","instance":"0x1","unreliable":"30040","reliable":{"port":"30040","enable-magic-cookies":"false"}}, - {"service":"0x29","instance":"0x1","unreliable":"30041","reliable":{"port":"30041","enable-magic-cookies":"false"}}, - {"service":"0x2A","instance":"0x1","unreliable":"30042","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x2B","instance":"0x1","unreliable":"30043","reliable":{"port":"30043","enable-magic-cookies":"false"}}, - {"service":"0x2C","instance":"0x1","unreliable":"30044","reliable":{"port":"30044","enable-magic-cookies":"false"}}, - {"service":"0x2D","instance":"0x1","unreliable":"60000","reliable":{"port":"30045","enable-magic-cookies":"false"}}, - {"service":"0x2E","instance":"0x1","unreliable":"30046","reliable":{"port":"30046","enable-magic-cookies":"false"}}, - {"service":"0x2F","instance":"0x1","unreliable":"30047","reliable":{"port":"30047","enable-magic-cookies":"false"}}, - {"service":"0x30","instance":"0x1","unreliable":"30048","reliable":{"port":"30048","enable-magic-cookies":"false"}}, - {"service":"0x31","instance":"0x1","unreliable":"30049","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x32","instance":"0x1","unreliable":"30050","reliable":{"port":"30050","enable-magic-cookies":"false"}}, - {"service":"0x33","instance":"0x1","unreliable":"30051","reliable":{"port":"30051","enable-magic-cookies":"false"}}, - {"service":"0x34","instance":"0x1","unreliable":"30052","reliable":{"port":"30052","enable-magic-cookies":"false"}}, - {"service":"0x35","instance":"0x1","unreliable":"30053","reliable":{"port":"30053","enable-magic-cookies":"false"}}, - {"service":"0x36","instance":"0x1","unreliable":"60000","reliable":{"port":"30054","enable-magic-cookies":"false"}}, - {"service":"0x37","instance":"0x1","unreliable":"30055","reliable":{"port":"30055","enable-magic-cookies":"false"}}, - {"service":"0x38","instance":"0x1","unreliable":"30056","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x39","instance":"0x1","unreliable":"30057","reliable":{"port":"30057","enable-magic-cookies":"false"}}, - {"service":"0x3A","instance":"0x1","unreliable":"30058","reliable":{"port":"30058","enable-magic-cookies":"false"}}, - {"service":"0x3B","instance":"0x1","unreliable":"30059","reliable":{"port":"30059","enable-magic-cookies":"false"}}, - {"service":"0x3C","instance":"0x1","unreliable":"30060","reliable":{"port":"30060","enable-magic-cookies":"false"}}, - {"service":"0x3D","instance":"0x1","unreliable":"30061","reliable":{"port":"30061","enable-magic-cookies":"false"}}, - {"service":"0x3E","instance":"0x1","unreliable":"30062","reliable":{"port":"30062","enable-magic-cookies":"false"}}, - {"service":"0x3F","instance":"0x1","unreliable":"60000","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x40","instance":"0x1","unreliable":"30064","reliable":{"port":"30064","enable-magic-cookies":"false"}}, - {"service":"0x41","instance":"0x1","unreliable":"30065","reliable":{"port":"30065","enable-magic-cookies":"false"}}, - {"service":"0x42","instance":"0x1","unreliable":"30066","reliable":{"port":"30066","enable-magic-cookies":"false"}}, - {"service":"0x43","instance":"0x1","unreliable":"30067","reliable":{"port":"30067","enable-magic-cookies":"false"}}, - {"service":"0x44","instance":"0x1","unreliable":"30068","reliable":{"port":"30068","enable-magic-cookies":"false"}}, - {"service":"0x45","instance":"0x1","unreliable":"30069","reliable":{"port":"30069","enable-magic-cookies":"false"}}, - {"service":"0x46","instance":"0x1","unreliable":"30070","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x47","instance":"0x1","unreliable":"30071","reliable":{"port":"30071","enable-magic-cookies":"false"}}, - {"service":"0x48","instance":"0x1","unreliable":"60000","reliable":{"port":"30072","enable-magic-cookies":"false"}}, - {"service":"0x49","instance":"0x1","unreliable":"30073","reliable":{"port":"30073","enable-magic-cookies":"false"}}, - {"service":"0x4A","instance":"0x1","unreliable":"30074","reliable":{"port":"30074","enable-magic-cookies":"false"}}, - {"service":"0x4B","instance":"0x1","unreliable":"30075","reliable":{"port":"30075","enable-magic-cookies":"false"}}, - {"service":"0x4C","instance":"0x1","unreliable":"30076","reliable":{"port":"30076","enable-magic-cookies":"false"}}, - {"service":"0x4D","instance":"0x1","unreliable":"30077","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x4E","instance":"0x1","unreliable":"30078","reliable":{"port":"30078","enable-magic-cookies":"false"}}, - {"service":"0x4F","instance":"0x1","unreliable":"30079","reliable":{"port":"30079","enable-magic-cookies":"false"}}, - {"service":"0x50","instance":"0x1","unreliable":"30080","reliable":{"port":"30080","enable-magic-cookies":"false"}}, - {"service":"0x51","instance":"0x1","unreliable":"60000","reliable":{"port":"30081","enable-magic-cookies":"false"}}, - {"service":"0x52","instance":"0x1","unreliable":"30082","reliable":{"port":"30082","enable-magic-cookies":"false"}}, - {"service":"0x53","instance":"0x1","unreliable":"30083","reliable":{"port":"30083","enable-magic-cookies":"false"}}, - {"service":"0x54","instance":"0x1","unreliable":"30084","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x55","instance":"0x1","unreliable":"30085","reliable":{"port":"30085","enable-magic-cookies":"false"}}, - {"service":"0x56","instance":"0x1","unreliable":"30086","reliable":{"port":"30086","enable-magic-cookies":"false"}}, - {"service":"0x57","instance":"0x1","unreliable":"30087","reliable":{"port":"30087","enable-magic-cookies":"false"}}, - {"service":"0x58","instance":"0x1","unreliable":"30088","reliable":{"port":"30088","enable-magic-cookies":"false"}}, - {"service":"0x59","instance":"0x1","unreliable":"30089","reliable":{"port":"30089","enable-magic-cookies":"false"}}, - {"service":"0x5A","instance":"0x1","unreliable":"60000","reliable":{"port":"30090","enable-magic-cookies":"false"}}, - {"service":"0x5B","instance":"0x1","unreliable":"30091","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x5C","instance":"0x1","unreliable":"30092","reliable":{"port":"30092","enable-magic-cookies":"false"}}, - {"service":"0x5D","instance":"0x1","unreliable":"30093","reliable":{"port":"30093","enable-magic-cookies":"false"}}, - {"service":"0x5E","instance":"0x1","unreliable":"30094","reliable":{"port":"30094","enable-magic-cookies":"false"}}, - {"service":"0x5F","instance":"0x1","unreliable":"30095","reliable":{"port":"30095","enable-magic-cookies":"false"}}, - {"service":"0x60","instance":"0x1","unreliable":"30096","reliable":{"port":"30096","enable-magic-cookies":"false"}}, - {"service":"0x61","instance":"0x1","unreliable":"30097","reliable":{"port":"30097","enable-magic-cookies":"false"}}, - {"service":"0x62","instance":"0x1","unreliable":"30098","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x63","instance":"0x1","unreliable":"60000","reliable":{"port":"30099","enable-magic-cookies":"false"}}, - {"service":"0x64","instance":"0x1","unreliable":"30100","reliable":{"port":"30100","enable-magic-cookies":"false"}}, - {"service":"0x65","instance":"0x1","unreliable":"30101","reliable":{"port":"30101","enable-magic-cookies":"false"}}, - {"service":"0x66","instance":"0x1","unreliable":"30102","reliable":{"port":"30102","enable-magic-cookies":"false"}}, - {"service":"0x67","instance":"0x1","unreliable":"30103","reliable":{"port":"30103","enable-magic-cookies":"false"}}, - {"service":"0x68","instance":"0x1","unreliable":"30104","reliable":{"port":"30104","enable-magic-cookies":"false"}}, - {"service":"0x69","instance":"0x1","unreliable":"30105","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x6A","instance":"0x1","unreliable":"30106","reliable":{"port":"30106","enable-magic-cookies":"false"}}, - {"service":"0x6B","instance":"0x1","unreliable":"30107","reliable":{"port":"30107","enable-magic-cookies":"false"}}, - {"service":"0x6C","instance":"0x1","unreliable":"60000","reliable":{"port":"30108","enable-magic-cookies":"false"}}, - {"service":"0x6D","instance":"0x1","unreliable":"30109","reliable":{"port":"30109","enable-magic-cookies":"false"}}, - {"service":"0x6E","instance":"0x1","unreliable":"30110","reliable":{"port":"30110","enable-magic-cookies":"false"}}, - {"service":"0x6F","instance":"0x1","unreliable":"30111","reliable":{"port":"30111","enable-magic-cookies":"false"}}, - {"service":"0x70","instance":"0x1","unreliable":"30112","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x71","instance":"0x1","unreliable":"30113","reliable":{"port":"30113","enable-magic-cookies":"false"}}, - {"service":"0x72","instance":"0x1","unreliable":"30114","reliable":{"port":"30114","enable-magic-cookies":"false"}}, - {"service":"0x73","instance":"0x1","unreliable":"30115","reliable":{"port":"30115","enable-magic-cookies":"false"}}, - {"service":"0x74","instance":"0x1","unreliable":"30116","reliable":{"port":"30116","enable-magic-cookies":"false"}}, - {"service":"0x75","instance":"0x1","unreliable":"60000","reliable":{"port":"30117","enable-magic-cookies":"false"}}, - {"service":"0x76","instance":"0x1","unreliable":"30118","reliable":{"port":"30118","enable-magic-cookies":"false"}}, - {"service":"0x77","instance":"0x1","unreliable":"30119","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x78","instance":"0x1","unreliable":"30120","reliable":{"port":"30120","enable-magic-cookies":"false"}}, - {"service":"0x79","instance":"0x1","unreliable":"30121","reliable":{"port":"30121","enable-magic-cookies":"false"}}, - {"service":"0x7A","instance":"0x1","unreliable":"30122","reliable":{"port":"30122","enable-magic-cookies":"false"}}, - {"service":"0x7B","instance":"0x1","unreliable":"30123","reliable":{"port":"30123","enable-magic-cookies":"false"}}, - {"service":"0x7C","instance":"0x1","unreliable":"30124","reliable":{"port":"30124","enable-magic-cookies":"false"}}, - {"service":"0x7D","instance":"0x1","unreliable":"30125","reliable":{"port":"30125","enable-magic-cookies":"false"}}, - {"service":"0x7E","instance":"0x1","unreliable":"60000","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x7F","instance":"0x1","unreliable":"30127","reliable":{"port":"30127","enable-magic-cookies":"false"}}, - {"service":"0x80","instance":"0x1","unreliable":"30128","reliable":{"port":"30128","enable-magic-cookies":"false"}}, - {"service":"0x81","instance":"0x1","unreliable":"30129","reliable":{"port":"30129","enable-magic-cookies":"false"}}, - {"service":"0x82","instance":"0x1","unreliable":"30130","reliable":{"port":"30130","enable-magic-cookies":"false"}}, - {"service":"0x83","instance":"0x1","unreliable":"30131","reliable":{"port":"30131","enable-magic-cookies":"false"}}, - {"service":"0x84","instance":"0x1","unreliable":"30132","reliable":{"port":"30132","enable-magic-cookies":"false"}}, - {"service":"0x85","instance":"0x1","unreliable":"30133","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x86","instance":"0x1","unreliable":"30134","reliable":{"port":"30134","enable-magic-cookies":"false"}}, - {"service":"0x87","instance":"0x1","unreliable":"60000","reliable":{"port":"30135","enable-magic-cookies":"false"}}, - {"service":"0x88","instance":"0x1","unreliable":"30136","reliable":{"port":"30136","enable-magic-cookies":"false"}}, - {"service":"0x89","instance":"0x1","unreliable":"30137","reliable":{"port":"30137","enable-magic-cookies":"false"}}, - {"service":"0x8A","instance":"0x1","unreliable":"30138","reliable":{"port":"30138","enable-magic-cookies":"false"}}, - {"service":"0x8B","instance":"0x1","unreliable":"30139","reliable":{"port":"30139","enable-magic-cookies":"false"}}, - {"service":"0x8C","instance":"0x1","unreliable":"30140","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x8D","instance":"0x1","unreliable":"30141","reliable":{"port":"30141","enable-magic-cookies":"false"}}, - {"service":"0x8E","instance":"0x1","unreliable":"30142","reliable":{"port":"30142","enable-magic-cookies":"false"}}, - {"service":"0x8F","instance":"0x1","unreliable":"30143","reliable":{"port":"30143","enable-magic-cookies":"false"}}, - {"service":"0x90","instance":"0x1","unreliable":"60000","reliable":{"port":"30144","enable-magic-cookies":"false"}}, - {"service":"0x91","instance":"0x1","unreliable":"30145","reliable":{"port":"30145","enable-magic-cookies":"false"}}, - {"service":"0x92","instance":"0x1","unreliable":"30146","reliable":{"port":"30146","enable-magic-cookies":"false"}}, - {"service":"0x93","instance":"0x1","unreliable":"30147","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x94","instance":"0x1","unreliable":"30148","reliable":{"port":"30148","enable-magic-cookies":"false"}}, - {"service":"0x95","instance":"0x1","unreliable":"30149","reliable":{"port":"30149","enable-magic-cookies":"false"}}, - {"service":"0x96","instance":"0x1","unreliable":"30150","reliable":{"port":"30150","enable-magic-cookies":"false"}}, - {"service":"0x97","instance":"0x1","unreliable":"30151","reliable":{"port":"30151","enable-magic-cookies":"false"}}, - {"service":"0x98","instance":"0x1","unreliable":"30152","reliable":{"port":"30152","enable-magic-cookies":"false"}}, - {"service":"0x99","instance":"0x1","unreliable":"60000","reliable":{"port":"30153","enable-magic-cookies":"false"}}, - {"service":"0x9A","instance":"0x1","unreliable":"30154","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x9B","instance":"0x1","unreliable":"30155","reliable":{"port":"30155","enable-magic-cookies":"false"}}, - {"service":"0x9C","instance":"0x1","unreliable":"30156","reliable":{"port":"30156","enable-magic-cookies":"false"}}, - {"service":"0x9D","instance":"0x1","unreliable":"30157","reliable":{"port":"30157","enable-magic-cookies":"false"}}, - {"service":"0x9E","instance":"0x1","unreliable":"30158","reliable":{"port":"30158","enable-magic-cookies":"false"}}, - {"service":"0x9F","instance":"0x1","unreliable":"30159","reliable":{"port":"30159","enable-magic-cookies":"false"}}, - {"service":"0xA0","instance":"0x1","unreliable":"30160","reliable":{"port":"30160","enable-magic-cookies":"false"}}, - {"service":"0xA1","instance":"0x1","unreliable":"30161","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xA2","instance":"0x1","unreliable":"60000","reliable":{"port":"30162","enable-magic-cookies":"false"}}, - {"service":"0xA3","instance":"0x1","unreliable":"30163","reliable":{"port":"30163","enable-magic-cookies":"false"}}, - {"service":"0xA4","instance":"0x1","unreliable":"30164","reliable":{"port":"30164","enable-magic-cookies":"false"}}, - {"service":"0xA5","instance":"0x1","unreliable":"30165","reliable":{"port":"30165","enable-magic-cookies":"false"}}, - {"service":"0xA6","instance":"0x1","unreliable":"30166","reliable":{"port":"30166","enable-magic-cookies":"false"}}, - {"service":"0xA7","instance":"0x1","unreliable":"30167","reliable":{"port":"30167","enable-magic-cookies":"false"}}, - {"service":"0xA8","instance":"0x1","unreliable":"30168","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xA9","instance":"0x1","unreliable":"30169","reliable":{"port":"30169","enable-magic-cookies":"false"}}, - {"service":"0xAA","instance":"0x1","unreliable":"30170","reliable":{"port":"30170","enable-magic-cookies":"false"}}, - {"service":"0xAB","instance":"0x1","unreliable":"60000","reliable":{"port":"30171","enable-magic-cookies":"false"}}, - {"service":"0xAC","instance":"0x1","unreliable":"30172","reliable":{"port":"30172","enable-magic-cookies":"false"}}, - {"service":"0xAD","instance":"0x1","unreliable":"30173","reliable":{"port":"30173","enable-magic-cookies":"false"}}, - {"service":"0xAE","instance":"0x1","unreliable":"30174","reliable":{"port":"30174","enable-magic-cookies":"false"}}, - {"service":"0xAF","instance":"0x1","unreliable":"30175","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xB0","instance":"0x1","unreliable":"30176","reliable":{"port":"30176","enable-magic-cookies":"false"}}, - {"service":"0xB1","instance":"0x1","unreliable":"30177","reliable":{"port":"30177","enable-magic-cookies":"false"}}, - {"service":"0xB2","instance":"0x1","unreliable":"30178","reliable":{"port":"30178","enable-magic-cookies":"false"}}, - {"service":"0xB3","instance":"0x1","unreliable":"30179","reliable":{"port":"30179","enable-magic-cookies":"false"}}, - {"service":"0xB4","instance":"0x1","unreliable":"60000","reliable":{"port":"30180","enable-magic-cookies":"false"}}, - {"service":"0xB5","instance":"0x1","unreliable":"30181","reliable":{"port":"30181","enable-magic-cookies":"false"}}, - {"service":"0xB6","instance":"0x1","unreliable":"30182","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xB7","instance":"0x1","unreliable":"30183","reliable":{"port":"30183","enable-magic-cookies":"false"}}, - {"service":"0xB8","instance":"0x1","unreliable":"30184","reliable":{"port":"30184","enable-magic-cookies":"false"}}, - {"service":"0xB9","instance":"0x1","unreliable":"30185","reliable":{"port":"30185","enable-magic-cookies":"false"}}, - {"service":"0xBA","instance":"0x1","unreliable":"30186","reliable":{"port":"30186","enable-magic-cookies":"false"}}, - {"service":"0xBB","instance":"0x1","unreliable":"30187","reliable":{"port":"30187","enable-magic-cookies":"false"}}, - {"service":"0xBC","instance":"0x1","unreliable":"30188","reliable":{"port":"30188","enable-magic-cookies":"false"}}, - {"service":"0xBD","instance":"0x1","unreliable":"60000","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xBE","instance":"0x1","unreliable":"30190","reliable":{"port":"30190","enable-magic-cookies":"false"}}, - {"service":"0xBF","instance":"0x1","unreliable":"30191","reliable":{"port":"30191","enable-magic-cookies":"false"}}, - {"service":"0xC0","instance":"0x1","unreliable":"30192","reliable":{"port":"30192","enable-magic-cookies":"false"}}, - {"service":"0xC1","instance":"0x1","unreliable":"30193","reliable":{"port":"30193","enable-magic-cookies":"false"}}, - {"service":"0xC2","instance":"0x1","unreliable":"30194","reliable":{"port":"30194","enable-magic-cookies":"false"}}, - {"service":"0xC3","instance":"0x1","unreliable":"30195","reliable":{"port":"30195","enable-magic-cookies":"false"}}, - {"service":"0xC4","instance":"0x1","unreliable":"30196","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xC5","instance":"0x1","unreliable":"30197","reliable":{"port":"30197","enable-magic-cookies":"false"}}, - {"service":"0xC6","instance":"0x1","unreliable":"60000","reliable":{"port":"30198","enable-magic-cookies":"false"}}, - {"service":"0xC7","instance":"0x1","unreliable":"30199","reliable":{"port":"30199","enable-magic-cookies":"false"}}, - {"service":"0xC8","instance":"0x1","unreliable":"30200","reliable":{"port":"30200","enable-magic-cookies":"false"}}, - {"service":"0xC9","instance":"0x1","unreliable":"30201","reliable":{"port":"30201","enable-magic-cookies":"false"}}, - {"service":"0xCA","instance":"0x1","unreliable":"30202","reliable":{"port":"30202","enable-magic-cookies":"false"}}, - {"service":"0xCB","instance":"0x1","unreliable":"30203","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xCC","instance":"0x1","unreliable":"30204","reliable":{"port":"30204","enable-magic-cookies":"false"}}, - {"service":"0xCD","instance":"0x1","unreliable":"30205","reliable":{"port":"30205","enable-magic-cookies":"false"}}, - {"service":"0xCE","instance":"0x1","unreliable":"30206","reliable":{"port":"30206","enable-magic-cookies":"false"}}, - {"service":"0xCF","instance":"0x1","unreliable":"60000","reliable":{"port":"30207","enable-magic-cookies":"false"}}, - {"service":"0xD0","instance":"0x1","unreliable":"30208","reliable":{"port":"30208","enable-magic-cookies":"false"}}, - {"service":"0xD1","instance":"0x1","unreliable":"30209","reliable":{"port":"30209","enable-magic-cookies":"false"}}, - {"service":"0xD2","instance":"0x1","unreliable":"30210","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xD3","instance":"0x1","unreliable":"30211","reliable":{"port":"30211","enable-magic-cookies":"false"}}, - {"service":"0xD4","instance":"0x1","unreliable":"30212","reliable":{"port":"30212","enable-magic-cookies":"false"}}, - {"service":"0xD5","instance":"0x1","unreliable":"30213","reliable":{"port":"30213","enable-magic-cookies":"false"}}, - {"service":"0xD6","instance":"0x1","unreliable":"30214","reliable":{"port":"30214","enable-magic-cookies":"false"}}, - {"service":"0xD7","instance":"0x1","unreliable":"30215","reliable":{"port":"30215","enable-magic-cookies":"false"}}, - {"service":"0xD8","instance":"0x1","unreliable":"60000","reliable":{"port":"30216","enable-magic-cookies":"false"}}, - {"service":"0xD9","instance":"0x1","unreliable":"30217","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xDA","instance":"0x1","unreliable":"30218","reliable":{"port":"30218","enable-magic-cookies":"false"}}, - {"service":"0xDB","instance":"0x1","unreliable":"30219","reliable":{"port":"30219","enable-magic-cookies":"false"}}, - {"service":"0xDC","instance":"0x1","unreliable":"30220","reliable":{"port":"30220","enable-magic-cookies":"false"}}, - {"service":"0xDD","instance":"0x1","unreliable":"30221","reliable":{"port":"30221","enable-magic-cookies":"false"}}, - {"service":"0xDE","instance":"0x1","unreliable":"30222","reliable":{"port":"30222","enable-magic-cookies":"false"}}, - {"service":"0xDF","instance":"0x1","unreliable":"30223","reliable":{"port":"30223","enable-magic-cookies":"false"}}, - {"service":"0xE0","instance":"0x1","unreliable":"30224","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xE1","instance":"0x1","unreliable":"60000","reliable":{"port":"30225","enable-magic-cookies":"false"}}, - {"service":"0xE2","instance":"0x1","unreliable":"30226","reliable":{"port":"30226","enable-magic-cookies":"false"}}, - {"service":"0xE3","instance":"0x1","unreliable":"30227","reliable":{"port":"30227","enable-magic-cookies":"false"}}, - {"service":"0xE4","instance":"0x1","unreliable":"30228","reliable":{"port":"30228","enable-magic-cookies":"false"}}, - {"service":"0xE5","instance":"0x1","unreliable":"30229","reliable":{"port":"30229","enable-magic-cookies":"false"}}, - {"service":"0xE6","instance":"0x1","unreliable":"30230","reliable":{"port":"30230","enable-magic-cookies":"false"}}, - {"service":"0xE7","instance":"0x1","unreliable":"30231","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xE8","instance":"0x1","unreliable":"30232","reliable":{"port":"30232","enable-magic-cookies":"false"}}, - {"service":"0xE9","instance":"0x1","unreliable":"30233","reliable":{"port":"30233","enable-magic-cookies":"false"}}, - {"service":"0xEA","instance":"0x1","unreliable":"60000","reliable":{"port":"30234","enable-magic-cookies":"false"}}, - {"service":"0xEB","instance":"0x1","unreliable":"30235","reliable":{"port":"30235","enable-magic-cookies":"false"}}, - {"service":"0xEC","instance":"0x1","unreliable":"30236","reliable":{"port":"30236","enable-magic-cookies":"false"}}, - {"service":"0xED","instance":"0x1","unreliable":"30237","reliable":{"port":"30237","enable-magic-cookies":"false"}}, - {"service":"0xEE","instance":"0x1","unreliable":"30238","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xEF","instance":"0x1","unreliable":"30239","reliable":{"port":"30239","enable-magic-cookies":"false"}}, - {"service":"0xF0","instance":"0x1","unreliable":"30240","reliable":{"port":"30240","enable-magic-cookies":"false"}}, - {"service":"0xF1","instance":"0x1","unreliable":"30241","reliable":{"port":"30241","enable-magic-cookies":"false"}}, - {"service":"0xF2","instance":"0x1","unreliable":"30242","reliable":{"port":"30242","enable-magic-cookies":"false"}}, - {"service":"0xF3","instance":"0x1","unreliable":"60000","reliable":{"port":"30243","enable-magic-cookies":"false"}}, - {"service":"0xF4","instance":"0x1","unreliable":"30244","reliable":{"port":"30244","enable-magic-cookies":"false"}}, - {"service":"0xF5","instance":"0x1","unreliable":"30245","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xF6","instance":"0x1","unreliable":"30246","reliable":{"port":"30246","enable-magic-cookies":"false"}}, - {"service":"0xF7","instance":"0x1","unreliable":"30247","reliable":{"port":"30247","enable-magic-cookies":"false"}}, - {"service":"0xF8","instance":"0x1","unreliable":"30248","reliable":{"port":"30248","enable-magic-cookies":"false"}}, - {"service":"0xF9","instance":"0x1","unreliable":"30249","reliable":{"port":"30249","enable-magic-cookies":"false"}}, - {"service":"0xFA","instance":"0x1","unreliable":"30250","reliable":{"port":"30250","enable-magic-cookies":"false"}}, - {"service":"0xFB","instance":"0x1","unreliable":"30251","reliable":{"port":"30251","enable-magic-cookies":"false"}}, - {"service":"0xFC","instance":"0x1","unreliable":"60000","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0xFD","instance":"0x1","unreliable":"30253","reliable":{"port":"30253","enable-magic-cookies":"false"}}, - {"service":"0xFE","instance":"0x1","unreliable":"30254","reliable":{"port":"30254","enable-magic-cookies":"false"}}, - {"service":"0xFF","instance":"0x1","unreliable":"30255","reliable":{"port":"30255","enable-magic-cookies":"false"}}, - {"service":"0x100","instance":"0x1","unreliable":"30256","reliable":{"port":"30256","enable-magic-cookies":"false"}}, - {"service":"0x101","instance":"0x1","unreliable":"30257","reliable":{"port":"30257","enable-magic-cookies":"false"}}, - {"service":"0x102","instance":"0x1","unreliable":"30258","reliable":{"port":"30258","enable-magic-cookies":"false"}}, - {"service":"0x103","instance":"0x1","unreliable":"30259","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x104","instance":"0x1","unreliable":"30260","reliable":{"port":"30260","enable-magic-cookies":"false"}}, - {"service":"0x105","instance":"0x1","unreliable":"60000","reliable":{"port":"30261","enable-magic-cookies":"false"}}, - {"service":"0x106","instance":"0x1","unreliable":"30262","reliable":{"port":"30262","enable-magic-cookies":"false"}}, - {"service":"0x107","instance":"0x1","unreliable":"30263","reliable":{"port":"30263","enable-magic-cookies":"false"}}, - {"service":"0x108","instance":"0x1","unreliable":"30264","reliable":{"port":"30264","enable-magic-cookies":"false"}}, - {"service":"0x109","instance":"0x1","unreliable":"30265","reliable":{"port":"30265","enable-magic-cookies":"false"}}, - {"service":"0x10A","instance":"0x1","unreliable":"30266","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x10B","instance":"0x1","unreliable":"30267","reliable":{"port":"30267","enable-magic-cookies":"false"}}, - {"service":"0x10C","instance":"0x1","unreliable":"30268","reliable":{"port":"30268","enable-magic-cookies":"false"}}, - {"service":"0x10D","instance":"0x1","unreliable":"30269","reliable":{"port":"30269","enable-magic-cookies":"false"}}, - {"service":"0x10E","instance":"0x1","unreliable":"60000","reliable":{"port":"30270","enable-magic-cookies":"false"}}, - {"service":"0x10F","instance":"0x1","unreliable":"30271","reliable":{"port":"30271","enable-magic-cookies":"false"}}, - {"service":"0x110","instance":"0x1","unreliable":"30272","reliable":{"port":"30272","enable-magic-cookies":"false"}}, - {"service":"0x111","instance":"0x1","unreliable":"30273","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x112","instance":"0x1","unreliable":"30274","reliable":{"port":"30274","enable-magic-cookies":"false"}}, - {"service":"0x113","instance":"0x1","unreliable":"30275","reliable":{"port":"30275","enable-magic-cookies":"false"}}, - {"service":"0x114","instance":"0x1","unreliable":"30276","reliable":{"port":"30276","enable-magic-cookies":"false"}}, - {"service":"0x115","instance":"0x1","unreliable":"30277","reliable":{"port":"30277","enable-magic-cookies":"false"}}, - {"service":"0x116","instance":"0x1","unreliable":"30278","reliable":{"port":"30278","enable-magic-cookies":"false"}}, - {"service":"0x117","instance":"0x1","unreliable":"60000","reliable":{"port":"30279","enable-magic-cookies":"false"}}, - {"service":"0x118","instance":"0x1","unreliable":"30280","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x119","instance":"0x1","unreliable":"30281","reliable":{"port":"30281","enable-magic-cookies":"false"}}, - {"service":"0x11A","instance":"0x1","unreliable":"30282","reliable":{"port":"30282","enable-magic-cookies":"false"}}, - {"service":"0x11B","instance":"0x1","unreliable":"30283","reliable":{"port":"30283","enable-magic-cookies":"false"}}, - {"service":"0x11C","instance":"0x1","unreliable":"30284","reliable":{"port":"30284","enable-magic-cookies":"false"}}, - {"service":"0x11D","instance":"0x1","unreliable":"30285","reliable":{"port":"30285","enable-magic-cookies":"false"}}, - {"service":"0x11E","instance":"0x1","unreliable":"30286","reliable":{"port":"30286","enable-magic-cookies":"false"}}, - {"service":"0x11F","instance":"0x1","unreliable":"30287","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x120","instance":"0x1","unreliable":"60000","reliable":{"port":"30288","enable-magic-cookies":"false"}}, - {"service":"0x121","instance":"0x1","unreliable":"30289","reliable":{"port":"30289","enable-magic-cookies":"false"}}, - {"service":"0x122","instance":"0x1","unreliable":"30290","reliable":{"port":"30290","enable-magic-cookies":"false"}}, - {"service":"0x123","instance":"0x1","unreliable":"30291","reliable":{"port":"30291","enable-magic-cookies":"false"}}, - {"service":"0x124","instance":"0x1","unreliable":"30292","reliable":{"port":"30292","enable-magic-cookies":"false"}}, - {"service":"0x125","instance":"0x1","unreliable":"30293","reliable":{"port":"30293","enable-magic-cookies":"false"}}, - {"service":"0x126","instance":"0x1","unreliable":"30294","reliable":{"port":"60000","enable-magic-cookies":"false"}}, - {"service":"0x127","instance":"0x1","unreliable":"30295","reliable":{"port":"30295","enable-magic-cookies":"false"}}, - {"service":"0x128","instance":"0x1","unreliable":"30296","reliable":{"port":"30296","enable-magic-cookies":"false"}}, - {"service":"0x129","instance":"0x1","unreliable":"60000","reliable":{"port":"30297","enable-magic-cookies":"false"}}, - {"service":"0x12A","instance":"0x1","unreliable":"30298","reliable":{"port":"30298","enable-magic-cookies":"false"}}, - {"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", - "service-discovery": - { - "enable":"true", - "ttl" : "3", - "multicast":"224.0.11.1", - "cyclic_offer_delay" : "1000", - "port":"30490", - "protocol":"udp" - } -}
\ No newline at end of file diff --git a/test/offer_tests/conf/offer_test_external_master.json.in b/test/offer_tests/conf/offer_test_external_master.json.in deleted file mode 100644 index b16a258..0000000 --- a/test/offer_tests/conf/offer_test_external_master.json.in +++ /dev/null @@ -1,36 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "services": - [ - { - "service":"0x1111", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - } - ], - "routing":"vsomeipd", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp", - "cyclic_offer_delay" : "500" - } -}
\ No newline at end of file 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 deleted file mode 100755 index 0f8f104..0000000 --- a/test/offer_tests/conf/offer_test_external_master_starter.sh.in +++ /dev/null @@ -1,164 +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 -# Rejecting offer for which there is already a remote offer: -# * start daemon -# * start application which offers service -# * start daemon remotely -# * start same application which offers the same service again remotely -# -> should be rejected as there is already a service instance -# running in the network - -# Array for client pids -CLIENT_PIDS=() -export VSOMEIP_CONFIGURATION=offer_test_external_master.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -# Start the services -./offer_test_service 2 & -PID_SERVICE_TWO=$! -echo "SERVICE_TWO pid $PID_SERVICE_TWO" - -./offer_test_client SUBSCRIBE & -CLIENT_PIDS+=($!) -echo "client pid ${CLIENT_PIDS[0]}" - -sleep 1 - -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\"" & - 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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** offer_test_external_slave_starter.sh -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** offer_test_external_master.json and -** offer_test_external_slave.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# Wait until all clients and services are finished -for job in ${CLIENT_PIDS[*]} $PID_SERVICE_TWO -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 - -if [ ! -z "$USE_DOCKER" ]; then - docker stop otems - docker rm otems -fi - -# wait for slave to finish -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - echo "[Master] waiting for job $job" - wait $job || ((FAIL+=1)) -done - -# 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 - -# Array for client pids -CLIENT_PIDS=() -export VSOMEIP_CONFIGURATION=offer_test_external_master.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -# Start the services -./offer_test_service 2 & -PID_SERVICE_TWO=$! - -./offer_test_client SUBSCRIBE & -CLIENT_PIDS+=($!) -echo "client pid ${CLIENT_PIDS[0]}" - -sleep 1 - -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\"" & - 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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** offer_test_external_sd_msg_sender @TEST_IP_MASTER@ -** (pass the correct ip address of your test master) -** from an external host to successfully complete this test. -** -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# Wait until all clients and services are finished -for job in ${CLIENT_PIDS[*]} $PID_SERVICE_TWO -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 - -if [ ! -z "$USE_DOCKER" ]; then - docker stop otesms - docker rm otesms -fi - -# wait for slave to finish -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - echo "[Master] waiting for job $job" - wait $job || ((FAIL+=1)) -done - -# Check if everything went well -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/offer_tests/conf/offer_test_external_slave.json.in b/test/offer_tests/conf/offer_test_external_slave.json.in deleted file mode 100644 index 47a3e9d..0000000 --- a/test/offer_tests/conf/offer_test_external_slave.json.in +++ /dev/null @@ -1,36 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "services": - [ - { - "service":"0x1111", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - } - ], - "routing":"vsomeipd", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.0.1", - "port":"30490", - "protocol":"udp", - "cyclic_offer_delay" : "500" - } -}
\ No newline at end of file diff --git a/test/offer_tests/offer_test_big_sd_msg_client.cpp b/test/offer_tests/offer_test_big_sd_msg_client.cpp deleted file mode 100644 index cf00de7..0000000 --- a/test/offer_tests/offer_test_big_sd_msg_client.cpp +++ /dev/null @@ -1,235 +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 <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" -#include "../../implementation/configuration/include/internal.hpp" - -#include "offer_test_globals.hpp" - -class offer_test_big_sd_msg_client { -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), - wait_for_stop_(true), - stop_thread_(std::bind(&offer_test_big_sd_msg_client::wait_for_stop, this)), - send_thread_(std::bind(&offer_test_big_sd_msg_client::send, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&offer_test_big_sd_msg_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind(&offer_test_big_sd_msg_client::on_message, this, - std::placeholders::_1)); - - // register availability for all other services and request their event. - app_->register_availability_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, - std::bind(&offer_test_big_sd_msg_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3), 0x1, 0x1); - 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_event(s,0x1, offer_test::big_msg_event_id, - its_eventgroups, false); - 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); - app_->register_subscription_status_handler(s,0x1, - offer_test::big_msg_eventgroup_id, - offer_test::big_msg_event_id, - std::bind(&offer_test_big_sd_msg_client::subscription_status_changed, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4, std::placeholders::_5)); - } - app_->start(); - } - - ~offer_test_big_sd_msg_client() { - send_thread_.join(); - stop_thread_.join(); - } - - void on_state(vsomeip::state_type_e _state) { - VSOMEIP_WARNING << "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) { - VSOMEIP_DEBUG << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance - << "] is " << (_is_available ? "available":"not available") << "."; - - std::lock_guard<std::mutex> its_lock(mutex_); - if(_is_available) { - auto found_service = services_available_subribed_.find(_service); - if (found_service != services_available_subribed_.end()) { - found_service->second.first = true; - if (std::all_of(services_available_subribed_.cbegin(), - services_available_subribed_.cend(), - [](const services_available_subribed_t::value_type& v) { - return v.second.first; - } - )) { - VSOMEIP_WARNING << "************************************************************"; - VSOMEIP_WARNING << "All services available!"; - VSOMEIP_WARNING << "************************************************************"; - wait_until_service_available_ = false; - condition_.notify_one(); - } - } - } - } - - void 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) { - EXPECT_EQ(0x1, _instance); - EXPECT_EQ(offer_test::big_msg_eventgroup_id, _eventgroup); - EXPECT_EQ(offer_test::big_msg_event_id, _event); - VSOMEIP_DEBUG << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance - << "] has " << (!_error ? "sent subscribe ack":" sent subscribe_nack") << "."; - if (_error == 0x0 /*OK*/) { - - 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; - if (std::all_of(services_available_subribed_.cbegin(), - services_available_subribed_.cend(), - [](const services_available_subribed_t::value_type& v) { - return v.second.second; - } - )) { - VSOMEIP_WARNING << "************************************************************"; - VSOMEIP_WARNING << "All subscription were acknowledged!"; - VSOMEIP_WARNING << "************************************************************"; - wait_until_subscribed_ = false; - condition_.notify_one(); - } - } - } - }; - - void on_message(const std::shared_ptr<vsomeip::message> &_message) { - if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { - on_response(_message); - } - } - - void on_response(const std::shared_ptr<vsomeip::message> &_message) { - EXPECT_EQ(0x1, _message->get_service()); - EXPECT_EQ(service_info_.shutdown_method_id, _message->get_method()); - EXPECT_EQ(0x1, _message->get_instance()); - if(service_info_.shutdown_method_id == _message->get_method()) { - std::lock_guard<std::mutex> its_lock(stop_mutex_); - wait_for_stop_ = false; - VSOMEIP_INFO << "going down"; - stop_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); - } - - while (wait_until_subscribed_) { - condition_.wait(its_lock); - } - - std::this_thread::sleep_for(std::chrono::seconds(5)); - std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request(); - its_req->set_service(1); - its_req->set_instance(1); - its_req->set_interface_version(0x1); - its_req->set_method(service_info_.shutdown_method_id); - app_->send(its_req); - } - - 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"; - app_->clear_all_handler(); - app_->stop(); - } - -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_; - bool wait_until_subscribed_; - std::mutex mutex_; - std::condition_variable condition_; - - bool wait_for_stop_; - std::mutex stop_mutex_; - std::condition_variable stop_condition_; - - typedef std::map<vsomeip::service_t,std::pair<bool, bool>> services_available_subribed_t; - services_available_subribed_t services_available_subribed_; - std::thread stop_thread_; - std::thread send_thread_; -}; - -TEST(someip_offer_test_big_sd_msg, subscribe_or_call_method_at_service) -{ - offer_test_big_sd_msg_client its_sample(offer_test::service); -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/offer_tests/offer_test_big_sd_msg_service.cpp b/test/offer_tests/offer_test_big_sd_msg_service.cpp deleted file mode 100644 index d5666c8..0000000 --- a/test/offer_tests/offer_test_big_sd_msg_service.cpp +++ /dev/null @@ -1,131 +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 <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "offer_test_globals.hpp" - -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 - // this way the same json file can be reused for all local tests - // including the ones with vsomeipd - app_(vsomeip::runtime::get()->create_application("offer_test_big_sd_msg_service")), - counter_(0), - wait_until_registered_(true), - shutdown_method_called_(false), - offer_thread_(std::bind(&offer_test_big_sd_msg_service::run, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&offer_test_big_sd_msg_service::on_state, this, - std::placeholders::_1)); - - // offer field - 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_->offer_event(s, 0x1, - offer_test::big_msg_event_id, its_eventgroups, false); - } - - 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(); - } - - ~offer_test_big_sd_msg_service() { - offer_thread_.join(); - } - - void offer() { - for (std::uint16_t s = 1; s <= offer_test::big_msg_number_services; s++) { - app_->offer_service(s,0x1,0x1,0x1); - } - } - - 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)); - std::this_thread::sleep_for(std::chrono::seconds(1)); - VSOMEIP_WARNING << "************************************************************"; - VSOMEIP_WARNING << "Shutdown method called -> going down!"; - VSOMEIP_WARNING << "************************************************************"; - shutdown_method_called_ = true; - for (std::uint16_t s = 1; s <= offer_test::big_msg_number_services; s++) { - app_->stop_offer_service(s,0x1,0x1,0x1); - } - app_->clear_all_handler(); - app_->stop(); - } - - 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(); - } - -private: - struct offer_test::service_info service_info_; - std::shared_ptr<vsomeip::application> app_; - std::uint32_t counter_; - - bool wait_until_registered_; - std::mutex mutex_; - std::condition_variable condition_; - std::atomic<bool> shutdown_method_called_; - std::thread offer_thread_; -}; - -TEST(someip_offer_test_big_sd_msg, notify_increasing_counter) -{ - offer_test_big_sd_msg_service its_sample(offer_test::service); -} - - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif 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 deleted file mode 100755 index d83139f..0000000 --- a/test/offer_tests/offer_test_big_sd_msg_slave_starter.sh +++ /dev/null @@ -1,45 +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/. - -FAIL=0 -# Rejecting offer for which there is already a remote offer: -# * start daemon -# * start application which offers service -# * start daemon remotely -# * start same application which offers the same service again remotely -# -> should be rejected as there is already a service instance -# running in the network - -export VSOMEIP_CONFIGURATION=offer_test_big_sd_msg_slave.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -sleep 1 -# Start the services -./offer_test_big_sd_msg_service & -PID_SERVICE_TWO=$! -sleep 1 - -# Wait until all clients and services are finished -for job in $PID_SERVICE_TWO -do - # Fail gets incremented if a client exits with a non-zero exit code - wait $job || FAIL=$(($FAIL+1)) -done - -# kill the services -kill $PID_VSOMEIPD -sleep 1 - - - -# Check if everything went well -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/offer_tests/offer_test_client.cpp b/test/offer_tests/offer_test_client.cpp deleted file mode 100644 index b337199..0000000 --- a/test/offer_tests/offer_test_client.cpp +++ /dev/null @@ -1,285 +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 <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" -#include "../../implementation/configuration/include/internal.hpp" - -#include "offer_test_globals.hpp" - -enum operation_mode_e { - SUBSCRIBE, - METHODCALL -}; - -class offer_test_client { -public: - offer_test_client(struct offer_test::service_info _service_info, operation_mode_e _mode) : - 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), - last_received_counter_(0), - last_received_response_(std::chrono::steady_clock::now()), - number_received_responses_(0), - stop_thread_(std::bind(&offer_test_client::wait_for_stop, this)), - send_thread_(std::bind(&offer_test_client::send, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&offer_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind(&offer_test_client::on_message, 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(&offer_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); - - if (operation_mode_ == operation_mode_e::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, false); - - 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); - } - - app_->start(); - } - - ~offer_test_client() { - send_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) { - VSOMEIP_INFO << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance - << "] is " << (_is_available ? "available":"not available") << "."; - std::lock_guard<std::mutex> its_lock(mutex_); - if(_is_available) { - wait_until_service_available_ = false; - condition_.notify_one(); - } else { - wait_until_service_available_ = true; - condition_.notify_one(); - } - } - - void on_message(const std::shared_ptr<vsomeip::message> &_message) { - if(_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) { - on_notification(_message); - } else if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { - on_response(_message); - } - } - - void on_notification(const std::shared_ptr<vsomeip::message> &_message) { - std::shared_ptr<vsomeip::payload> its_payload(_message->get_payload()); - EXPECT_EQ(4u, its_payload->get_length()); - 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]; - - 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() <<"] got:" << std::dec << counter; - - ASSERT_GT(counter, last_received_counter_); - last_received_counter_ = counter; - ++number_received_notifications; - - if(number_received_notifications >= 250) { - std::lock_guard<std::mutex> its_lock(stop_mutex_); - wait_for_stop_ = false; - VSOMEIP_INFO << "going down"; - stop_condition_.notify_one(); - } - } - - void on_response(const std::shared_ptr<vsomeip::message> &_message) { - ++number_received_responses_; - static bool first(true); - if (first) { - first = false; - last_received_response_ = std::chrono::steady_clock::now(); - return; - } - EXPECT_EQ(service_info_.service_id, _message->get_service()); - EXPECT_EQ(service_info_.method_id, _message->get_method()); - EXPECT_EQ(service_info_.instance_id, _message->get_instance()); - ASSERT_LT(std::chrono::duration_cast<std::chrono::milliseconds>( - std::chrono::steady_clock::now() - last_received_response_).count(), - (std::chrono::milliseconds(VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT) - + std::chrono::milliseconds(1000)).count()); - last_received_response_ = std::chrono::steady_clock::now(); - std::cout << "."; - std::cout.flush(); - } - - void send() { - if (operation_mode_ != operation_mode_e::METHODCALL) { - return; - } - 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); - } - its_lock.unlock(); - its_lock.release(); - - for (int var = 0; var < offer_test::number_of_messages_to_send; ++var) { - bool send(false); - { - std::lock_guard<std::mutex> its_lock(mutex_); - send = !wait_until_service_available_; - } - if (send) { - std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request(); - its_req->set_service(service_info_.service_id); - its_req->set_instance(service_info_.instance_id); - its_req->set_method(service_info_.method_id); - app_->send(its_req); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } else { - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - } - } - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - { - std::lock_guard<std::mutex> its_lock(stop_mutex_); - wait_for_stop_ = false; - VSOMEIP_INFO << "going down. Sent " << offer_test::number_of_messages_to_send - << " requests and received " << number_received_responses_ - << " responses"; - 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"; - app_->clear_all_handler(); - app_->stop(); - } - -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_; - std::mutex mutex_; - std::condition_variable condition_; - - bool wait_for_stop_; - 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::thread stop_thread_; - std::thread send_thread_; -}; - -static operation_mode_e passed_mode = operation_mode_e::SUBSCRIBE; - -TEST(someip_offer_test, subscribe_or_call_method_at_service) -{ - offer_test_client its_sample(offer_test::service, passed_mode); -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cerr << "Please specify a operation mode, like: " << argv[0] << " SUBSCRIBE" << std::endl; - std::cerr << "Valid operation modes are SUBSCRIBE and METHODCALL" << std::endl; - return 1; - } - - if (std::string("SUBSCRIBE") == std::string(argv[1])) { - passed_mode = operation_mode_e::SUBSCRIBE; - } else if (std::string("METHODCALL") == std::string(argv[1])) { - passed_mode = operation_mode_e::METHODCALL; - } else { - std::cerr << "Wrong operation mode passed, exiting" << std::endl; - std::cerr << "Please specify a operation mode, like: " << argv[0] << " SUBSCRIBE" << std::endl; - std::cerr << "Valid operation modes are SUBSCRIBE and METHODCALL" << std::endl; - return 1; - } - -#if 0 - if (argc >= 4 && std::string("SAME_SERVICE_ID") == std::string(argv[3])) { - use_same_service_id = true; - } else { - use_same_service_id = false; - } -#endif - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/offer_tests/offer_test_external_sd_msg_sender.cpp b/test/offer_tests/offer_test_external_sd_msg_sender.cpp deleted file mode 100644 index 6849b95..0000000 --- a/test/offer_tests/offer_test_external_sd_msg_sender.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// 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 <gtest/gtest.h> - -#include <boost/asio.hpp> - -static char* passed_address; - -TEST(someip_offer_test, send_offer_service_sd_message) -{ - try { - boost::asio::io_service io; - boost::asio::ip::udp::socket::endpoint_type target_sd( - boost::asio::ip::address::from_string(std::string(passed_address)), - 30490); - boost::asio::ip::udp::socket udp_socket(io, - boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490)); - std::uint8_t its_offer_service_message[] = { - 0xff, 0xff, 0x81, 0x00, - 0x00, 0x00, 0x00, 0x3c, - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x01, 0x02, 0x00, - 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x01, 0x00, 0x00, 0x20, - 0x11, 0x11, 0x00, 0x01, - 0x00, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, - 0x00, 0x09, 0x04, 0x00, - 0x0a, 0x00, 0x03, 0x01, - 0x00, 0x06, 0x9c, 0x41, - 0x00, 0x09, 0x04, 0x00, - 0x0a, 0x00, 0x03, 0x7D, // slave address - 0x00, 0x11, 0x75, 0x31 - }; - for (int var = 0; var < 15; ++var) { - udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd); - ++its_offer_service_message[11]; - } - - // call shutdown method - std::uint8_t shutdown_call[] = { - 0x11, 0x11, 0x14, 0x04, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x01, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(passed_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service); - } catch (...) { - ASSERT_FALSE(true); - } -} - - -#ifndef _WIN32 -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cout << "Please pass an target IP address to this binary like: " - << argv[0] << " 10.0.3.1" << std::endl; - exit(1); - } - passed_address = argv[1]; - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/offer_tests/offer_test_external_slave_starter.sh b/test/offer_tests/offer_test_external_slave_starter.sh deleted file mode 100755 index d7f08fb..0000000 --- a/test/offer_tests/offer_test_external_slave_starter.sh +++ /dev/null @@ -1,45 +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/. - -FAIL=0 -# Rejecting offer for which there is already a remote offer: -# * start daemon -# * start application which offers service -# * start daemon remotely -# * start same application which offers the same service again remotely -# -> should be rejected as there is already a service instance -# running in the network - -export VSOMEIP_CONFIGURATION=offer_test_external_slave.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -sleep 1 -# Start the services -./offer_test_service_external 2 & -PID_SERVICE_TWO=$! -sleep 1 - -# Wait until all clients and services are finished -for job in $PID_SERVICE_TWO -do - # Fail gets incremented if a client exits with a non-zero exit code - wait $job || FAIL=$(($FAIL+1)) -done - -# kill the services -kill $PID_VSOMEIPD -sleep 1 - - - -# Check if everything went well -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/offer_tests/offer_test_globals.hpp b/test/offer_tests/offer_test_globals.hpp deleted file mode 100644 index ba69886..0000000 --- a/test/offer_tests/offer_test_globals.hpp +++ /dev/null @@ -1,29 +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 OFFER_TEST_GLOBALS_HPP_ -#define OFFER_TEST_GLOBALS_HPP_ - -namespace offer_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; -}; - -struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404 }; - -static constexpr int number_of_messages_to_send = 150; - -static constexpr std::uint16_t big_msg_number_services = 300; -static constexpr vsomeip::event_t big_msg_event_id = 0x8000; -static constexpr vsomeip::eventgroup_t big_msg_eventgroup_id = 0x1; -} - -#endif /* OFFER_TEST_GLOBALS_HPP_ */ diff --git a/test/offer_tests/offer_test_local.json b/test/offer_tests/offer_test_local.json deleted file mode 100644 index a54049c..0000000 --- a/test/offer_tests/offer_test_local.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "unicast":"127.0.0.1", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "routing":"vsomeipd", - "service-discovery": - { - "enable":"false" - } -} - diff --git a/test/offer_tests/offer_test_local_starter.sh b/test/offer_tests/offer_test_local_starter.sh deleted file mode 100755 index 38efbb6..0000000 --- a/test/offer_tests/offer_test_local_starter.sh +++ /dev/null @@ -1,298 +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 - -# Rejecting offer of service instance whose hosting application is still -# alive: -# * start application which offers service -# * start two clients which continuously exchanges messages with the service -# * start application which offers the same service again -> should be -# rejected and an error message should be printed. -# * Message exchange with client application should not be interrupted. - -# Array for client pids -CLIENT_PIDS=() -export VSOMEIP_CONFIGURATION=offer_test_local.json -# Start the services -./offer_test_service 1 & -PID_SERVICE_ONE=$! -./offer_test_client SUBSCRIBE & -CLIENT_PIDS+=($!) -./offer_test_client SUBSCRIBE & -CLIENT_PIDS+=($!) - -./offer_test_service 2 & -PID_SERVICE_TWO=$! - -# 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 the services -kill $PID_SERVICE_TWO -kill $PID_SERVICE_ONE -sleep 1 - - -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Running second test -******************************************************************************* -******************************************************************************* -End-of-message - -# Rejecting offer of service instance whose hosting application is still -# alive with daemon: -# * start daemon (needed as he has to ping the offering client) -# * start application which offers service -# * start two clients which continuously exchanges messages with the service -# * start application which offers the same service again -> should be -# rejected and an error message should be printed. -# * Message exchange with client application should not be interrupted. - -# Array for client pids -CLIENT_PIDS=() -export VSOMEIP_CONFIGURATION=offer_test_local.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! - -# Start the services -./offer_test_service 2 & -PID_SERVICE_TWO=$! -./offer_test_client SUBSCRIBE & -CLIENT_PIDS+=($!) -./offer_test_client SUBSCRIBE & -CLIENT_PIDS+=($!) - -./offer_test_service 3 & -PID_SERVICE_THREE=$! - -# 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 the services -kill $PID_SERVICE_THREE -kill $PID_SERVICE_TWO -sleep 1 -kill $PID_VSOMEIPD -sleep 1 - - -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Running third test -******************************************************************************* -******************************************************************************* -End-of-message - -# Accepting offer of service instance whose hosting application crashed -# with (send SIGKILL) -# * start daemon -# * start application which offers service -# * start client which exchanges messages with the service -# * kill application with SIGKILL -# * start application which offers the same service again -> should be -# accepted. -# * start another client which exchanges messages with the service -# * Client should now communicate with new offerer. - -# Array for client pids -CLIENT_PIDS=() -export VSOMEIP_CONFIGURATION=offer_test_local.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -# Start the service -./offer_test_service 2 & -PID_SERVICE_TWO=$! - -# Start a client -./offer_test_client METHODCALL & -CLIENT_PIDS+=($!) - -# Kill the service -sleep 1 -kill -KILL $PID_SERVICE_TWO - -# reoffer the service -./offer_test_service 3 & -PID_SERVICE_THREE=$! - -# Start another client -./offer_test_client METHODCALL & -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 the services -kill $PID_SERVICE_THREE -kill $PID_VSOMEIPD -sleep 1 - -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Running fourth test -******************************************************************************* -******************************************************************************* -End-of-message - -# Accepting offer of service instance whose hosting application became -# unresponsive (SIGSTOP) -# * start daemon -# * start application which offers service -# * Send a SIGSTOP to the service to make it unresponsive -# * start application which offers the same service again -> should be -# marked as PENDING_OFFER and a ping should be sent to the paused -# application. -# * After the timeout passed the new offer should be accepted. -# * start client which exchanges messages with the service -# * Client should now communicate with new offerer. - -# Array for client pids -CLIENT_PIDS=() -export VSOMEIP_CONFIGURATION=offer_test_local.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -# Start the service -./offer_test_service 2 & -PID_SERVICE_TWO=$! - -# Start a client -./offer_test_client METHODCALL & -CLIENT_PIDS+=($!) - -# Pause the service -sleep 1 -kill -STOP $PID_SERVICE_TWO - -# reoffer the service -./offer_test_service 3 & -PID_SERVICE_THREE=$! - -# Start another client -./offer_test_client METHODCALL & -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 the services -kill -CONT $PID_SERVICE_TWO -kill $PID_SERVICE_TWO -kill $PID_SERVICE_THREE -kill $PID_VSOMEIPD -sleep 1 - -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Running fifth test -******************************************************************************* -******************************************************************************* -End-of-message - -# Rejecting offers for which there is already a pending offer -# * start daemon -# * start application which offers service -# * Send a SIGSTOP to the service to make it unresponsive -# * start application which offers the same service again -> should be -# marked as PENDING_OFFER and a ping should be sent to the paused -# application. -# * start application which offers the same service again -> should be -# rejected as there is already a PENDING_OFFER pending. -# * After the timeout passed the new offer should be accepted. -# * start client which exchanges messages with the service -# * Client should now communicate with new offerer. - -# Array for client pids -CLIENT_PIDS=() -export VSOMEIP_CONFIGURATION=offer_test_local.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -# Start the service -./offer_test_service 2 & -PID_SERVICE_TWO=$! - -# Start a client -./offer_test_client METHODCALL & -CLIENT_PIDS+=($!) - -# Pause the service -sleep 1 -kill -STOP $PID_SERVICE_TWO - -# reoffer the service -./offer_test_service 3 & -PID_SERVICE_THREE=$! - -# reoffer the service again to provoke rejecting as there is -# already a pending offer -./offer_test_service 4 & -PID_SERVICE_FOUR=$! - -# Start another client -./offer_test_client METHODCALL & -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 the services -kill -CONT $PID_SERVICE_TWO -kill $PID_SERVICE_TWO -kill $PID_SERVICE_THREE -kill $PID_SERVICE_FOUR -kill $PID_VSOMEIPD - - -# Check if everything went well -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/offer_tests/offer_test_service.cpp b/test/offer_tests/offer_test_service.cpp deleted file mode 100644 index 13c193f..0000000 --- a/test/offer_tests/offer_test_service.cpp +++ /dev/null @@ -1,169 +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 <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "offer_test_globals.hpp" - -static std::string service_number; - -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 - // this way the same json file can be reused for all local tests - // including the ones with vsomeipd - app_(vsomeip::runtime::get()->create_application( - (service_number == "1") ? "vsomeipd" : - "offer_test_service" + service_number)), - counter_(0), - wait_until_registered_(true), - shutdown_method_called_(false), - offer_thread_(std::bind(&offer_test_service::run, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&offer_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, false); - - inc_counter_and_notify(); - - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.method_id, - std::bind(&offer_test_service::on_request, this, - std::placeholders::_1)); - - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.shutdown_method_id, - std::bind(&offer_test_service::on_shutdown_method_called, this, - std::placeholders::_1)); - app_->start(); - } - - ~offer_test_service() { - offer_thread_.join(); - } - - void offer() { - app_->offer_service(service_info_.service_id, service_info_.instance_id); - // this is allowed - app_->offer_service(service_info_.service_id, service_info_.instance_id); - // this is not allowed and will be rejected - app_->offer_service(service_info_.service_id, service_info_.instance_id, 33, 4711); - } - - 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_request(const std::shared_ptr<vsomeip::message> &_message) { - app_->send(vsomeip::runtime::get()->create_response(_message)); - } - - void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) { - (void)_message; - shutdown_method_called_ = true; - // this is will trigger a warning - app_->stop_offer_service(service_info_.service_id, service_info_.instance_id, 44, 4711); - app_->stop_offer_service(service_info_.service_id, service_info_.instance_id); - app_->clear_all_handler(); - app_->stop(); - } - - 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(); - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Notifying"; - while(!shutdown_method_called_) { - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - inc_counter_and_notify(); - } - } - - void inc_counter_and_notify() { - ++counter_; - // set value to field - const std::shared_ptr<vsomeip::payload> its_payload(vsomeip::runtime::get()->create_payload()); - std::vector<vsomeip::byte_t> its_data; - its_data.push_back(static_cast<vsomeip::byte_t>((counter_ & 0xFF000000) >> 24)); - its_data.push_back(static_cast<vsomeip::byte_t>((counter_ & 0xFF0000) >> 16)); - its_data.push_back(static_cast<vsomeip::byte_t>((counter_ & 0xFF00) >> 8)); - its_data.push_back(static_cast<vsomeip::byte_t>((counter_ & 0xFF))); - its_payload->set_data(its_data); - app_->notify(service_info_.service_id, service_info_.instance_id, - service_info_.event_id, its_payload); - } - -private: - struct offer_test::service_info service_info_; - std::shared_ptr<vsomeip::application> app_; - std::uint32_t counter_; - - bool wait_until_registered_; - std::mutex mutex_; - std::condition_variable condition_; - std::atomic<bool> shutdown_method_called_; - std::thread offer_thread_; -}; - -TEST(someip_offer_test, notify_increasing_counter) -{ - offer_test_service its_sample(offer_test::service); -} - - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl; - return 1; - } - - service_number = std::string(argv[1]); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/offer_tests/offer_test_service_external.cpp b/test/offer_tests/offer_test_service_external.cpp deleted file mode 100644 index 694a678..0000000 --- a/test/offer_tests/offer_test_service_external.cpp +++ /dev/null @@ -1,155 +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 "offer_test_globals.hpp" - -static std::string service_number; - -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 - // this way the same json file can be reused for all local tests - // including the ones with vsomeipd - app_(vsomeip::runtime::get()->create_application( - (service_number == "1") ? "vsomeipd" : - "offer_test_service" + service_number)), - wait_until_registered_(true), - wait_until_service_available_(true), - offer_thread_(std::bind(&offer_test_service::run, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&offer_test_service::on_state, this, - std::placeholders::_1)); - - app_->register_availability_handler(service_info_.service_id, - service_info_.instance_id, - std::bind(&offer_test_service::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - app_->request_service(service_info_.service_id, - service_info_.instance_id); - app_->start(); - } - - ~offer_test_service() { - offer_thread_.join(); - } - - void offer() { - app_->offer_service(service_info_.service_id, service_info_.instance_id); - // this is allowed - app_->offer_service(service_info_.service_id, service_info_.instance_id); - // this is not allowed and will be rejected - app_->offer_service(service_info_.service_id, service_info_.instance_id, 33, 4711); - } - - 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) { - VSOMEIP_INFO << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance - << "] is " << (_is_available ? "available":"not available") << "."; - std::lock_guard<std::mutex> its_lock(mutex_); - if(_is_available) { - wait_until_service_available_ = false; - condition_.notify_one(); - } else { - wait_until_service_available_ = true; - 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_) { - condition_.wait(its_lock); - } - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Offering"; - offer(); - - while(wait_until_service_available_) { - condition_.wait(its_lock); - } - } - - std::this_thread::sleep_for(std::chrono::seconds(1)); - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Calling stop method"; - std::shared_ptr<vsomeip::message> msg(vsomeip::runtime::get()->create_request()); - msg->set_service(service_info_.service_id); - msg->set_instance(service_info_.instance_id); - msg->set_method(service_info_.shutdown_method_id); - msg->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN); - app_->send(msg); - std::this_thread::sleep_for(std::chrono::seconds(2)); - app_->clear_all_handler(); - app_->stop(); - } - -private: - struct offer_test::service_info service_info_; - std::shared_ptr<vsomeip::application> app_; - - bool wait_until_registered_; - bool wait_until_service_available_; - std::mutex mutex_; - std::condition_variable condition_; - std::thread offer_thread_; -}; - -TEST(someip_offer_test, notify_increasing_counter) -{ - offer_test_service its_sample(offer_test::service); -} - - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl; - return 1; - } - - service_number = std::string(argv[1]); - return RUN_ALL_TESTS(); -} -#endif 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 deleted file mode 100644 index 1aa0802..0000000 --- a/test/offered_services_info_test/offered_services_info_test_client.cpp +++ /dev/null @@ -1,332 +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 <atomic> -#include <future> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" -#include "../../implementation/configuration/include/internal.hpp" - -#include "offered_services_info_test_globals.hpp" - -enum operation_mode_e { - SUBSCRIBE, - METHODCALL -}; - -std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> all_offered_services; -std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> local_offered_services; -std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> remote_offered_services; - -class offered_services_info_test_client { -public: - offered_services_info_test_client(struct offer_test::service_info _service_info,offer_test::service_info _remote_service_info, operation_mode_e _mode) : - service_info_(_service_info), - 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)), - test_offered_services_thread_(std::bind(&offered_services_info_test_client::test_offered_services, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - - local_offered_services[service_info_.service_id].insert(service_info_.instance_id); - all_offered_services[service_info_.service_id].insert(service_info_.instance_id); - - local_offered_services[service_info_.service_id].insert((vsomeip::instance_t)(service_info_.instance_id + 1)); - all_offered_services[service_info_.service_id].insert((vsomeip::instance_t)(service_info_.instance_id + 1)); - - // offer remote service ID 0x2222 instance ID 0x2 (port configuration added to json file) - remote_offered_services[remote_service_info_.service_id].insert(remote_service_info_.instance_id); - all_offered_services[remote_service_info_.service_id].insert(remote_service_info_.instance_id); - - remote_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 1)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 1)); - all_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 1)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 1)); - - remote_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 2)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 2)); - all_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 2)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 2)); - - app_->register_state_handler( - std::bind(&offered_services_info_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind(&offered_services_info_test_client::on_message, this, - std::placeholders::_1)); - - app_->register_availability_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, - std::bind(&offered_services_info_test_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - // request all services - app_->request_service(service_info_.service_id, service_info_.instance_id); - app_->request_service(service_info_.service_id, vsomeip::instance_t(service_info_.instance_id + 1)); - app_->request_service(remote_service_info_.service_id, remote_service_info_.instance_id); - app_->request_service(vsomeip::service_t(remote_service_info_.service_id + 1), vsomeip::instance_t(remote_service_info_.instance_id + 1)); - app_->request_service(vsomeip::service_t(remote_service_info_.service_id + 2), vsomeip::instance_t(remote_service_info_.instance_id + 2)); - - app_->start(); - } - - ~offered_services_info_test_client() { - test_offered_services_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) { - VSOMEIP_INFO << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance - << "] is " << (_is_available ? "available":"not available") << "."; - static int services_available =0; - std::lock_guard<std::mutex> its_lock(mutex_); - if(_is_available) { - services_available++; - if (services_available == 5) { - wait_until_service_available_ = false; - condition_.notify_one(); - } - } else { - wait_until_service_available_ = true; - condition_.notify_one(); - } - } - - void on_message(const std::shared_ptr<vsomeip::message> &_message) { - if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { - on_response(_message); - } - } - - void on_response(const std::shared_ptr<vsomeip::message> &_message) { - ++number_received_responses_; - static bool first(true); - if (first) { - first = false; - last_received_response_ = std::chrono::steady_clock::now(); - return; - } - EXPECT_EQ(service_info_.service_id, _message->get_service()); - EXPECT_EQ(service_info_.method_id, _message->get_method()); - EXPECT_EQ(service_info_.instance_id, _message->get_instance()); - ASSERT_LT(std::chrono::duration_cast<std::chrono::milliseconds>( - std::chrono::steady_clock::now() - last_received_response_).count(), - (std::chrono::milliseconds(VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT) - + std::chrono::milliseconds(1000)).count()); - last_received_response_ = std::chrono::steady_clock::now(); - std::cout << "."; - std::cout.flush(); - } - - void test_offered_services() { - if (operation_mode_ != operation_mode_e::METHODCALL) { - return; - } - 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); - } - its_lock.unlock(); - its_lock.release(); - - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - VSOMEIP_INFO << "TEST LOCAL SERVICES"; - app_->get_offered_services_async(vsomeip::offer_type_e::OT_LOCAL, std::bind(&offered_services_info_test_client::on_offered_services_local, this, std::placeholders::_1)); - - // send shutdown command to service - if (std::future_status::timeout == all_callbacks_received_.get_future().wait_for(std::chrono::seconds(15))) { - ADD_FAILURE() << "Didn't receive all callbacks within time"; - } else { - std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request(); - its_req->set_service(service_info_.service_id); - its_req->set_instance(service_info_.instance_id); - its_req->set_method(service_info_.shutdown_method_id); - app_->send(its_req); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - - - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - { - std::lock_guard<std::mutex> its_lock(stop_mutex_); - wait_for_stop_ = false; - VSOMEIP_INFO << "going down. Sent shutdown command to service"; - stop_condition_.notify_one(); - } - } - - void on_offered_services_local( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) { - std::cout << "ON OFFERED SERVICES LOCAL CALLBACK START" << std::endl; - EXPECT_EQ(2u, _services.size()); - bool local_service_test_failed(true); - for (auto its_pair : _services) { - local_service_test_failed = true; - std::cout << "CALLBACK VALUE -> Service: "<< std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl; - auto found_service = local_offered_services.find(its_pair.first); - if (found_service != local_offered_services.end()) { - auto found_instance = found_service->second.find(its_pair.second); - if (found_instance != found_service->second.end()) { - local_service_test_failed = false; - } - } - EXPECT_FALSE(local_service_test_failed); - } - std::cout << "ON OFFERED SERVICES LOCAL CALLBACK END" << std::endl; - VSOMEIP_INFO << "TEST REMOTE SERVICES"; - app_->get_offered_services_async(vsomeip::offer_type_e::OT_REMOTE, std::bind(&offered_services_info_test_client::on_offered_services_remote, this, std::placeholders::_1)); - } - - void on_offered_services_remote( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) { - std::cout << "ON OFFERED SERVICES REMOTE CALLBACK START" << std::endl; - EXPECT_EQ(3u, _services.size()); - bool remote_service_test_failed(true); - for (auto its_pair : _services) { - remote_service_test_failed = true; - std::cout << "CALLBACK VALUE -> Service: " << std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl; - auto found_service = remote_offered_services.find(its_pair.first); - if (found_service != remote_offered_services.end()) { - auto found_instance = found_service->second.find(its_pair.second); - if (found_instance != found_service->second.end()) { - remote_service_test_failed = false; - } - } - EXPECT_FALSE(remote_service_test_failed); - } - std::cout << "ON OFFERED SERVICES REMOTE CALLBACK END" << std::endl; - VSOMEIP_INFO << "TEST ALL SERVICES"; - app_->get_offered_services_async(vsomeip::offer_type_e::OT_ALL, std::bind(&offered_services_info_test_client::on_offered_services_all, this, std::placeholders::_1)); - } - - void on_offered_services_all( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) { - std::cout << "ON OFFERED SERVICES ALL CALLBACK START" << std::endl; - EXPECT_EQ(5u, _services.size()); - bool all_service_test_failed(true); - for (auto its_pair : _services) { - all_service_test_failed = true; - std::cout << "CALLBACK VALUE -> Service: " << std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl; - auto found_service = all_offered_services.find(its_pair.first); - if (found_service != all_offered_services.end()) { - auto found_instance = found_service->second.find(its_pair.second); - if (found_instance != found_service->second.end()) { - all_service_test_failed = false; - } - } - EXPECT_FALSE(all_service_test_failed); - } - std::cout << "ON OFFERED SERVICES ALL CALLBACK END" << std::endl; - all_callbacks_received_.set_value(); - } - - 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"; - app_->clear_all_handler(); - app_->stop(); - } - -private: - struct offer_test::service_info service_info_; - 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_; - std::mutex mutex_; - std::condition_variable condition_; - - bool wait_for_stop_; - 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_; - std::thread stop_thread_; - std::thread test_offered_services_thread_; -}; - -static operation_mode_e passed_mode = operation_mode_e::METHODCALL; - -TEST(someip_offered_services_info_test, check_offered_services) -{ - offered_services_info_test_client its_sample(offer_test::service, offer_test::remote_service, passed_mode); -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cerr << "Please specify a operation mode, like: " << argv[0] << " SUBSCRIBE" << std::endl; - std::cerr << "Valid operation modes are SUBSCRIBE and METHODCALL" << std::endl; - return 1; - } - - if (std::string("SUBSCRIBE") == std::string(argv[1])) { - passed_mode = operation_mode_e::SUBSCRIBE; - } else if (std::string("METHODCALL") == std::string(argv[1])) { - passed_mode = operation_mode_e::METHODCALL; - } else { - std::cerr << "Wrong operation mode passed, exiting" << std::endl; - std::cerr << "Please specify a operation mode, like: " << argv[0] << " SUBSCRIBE" << std::endl; - std::cerr << "Valid operation modes are SUBSCRIBE and METHODCALL" << std::endl; - return 1; - } - -#if 0 - if (argc >= 4 && std::string("SAME_SERVICE_ID") == std::string(argv[3])) { - use_same_service_id = true; - } else { - use_same_service_id = false; - } -#endif - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/offered_services_info_test/offered_services_info_test_globals.hpp b/test/offered_services_info_test/offered_services_info_test_globals.hpp deleted file mode 100644 index b74dfab..0000000 --- a/test/offered_services_info_test/offered_services_info_test_globals.hpp +++ /dev/null @@ -1,29 +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 OFFER_TEST_GLOBALS_HPP_ -#define OFFER_TEST_GLOBALS_HPP_ - -namespace offer_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; -}; - -uint8_t num_all_offered_services = 5; -uint8_t num_local_offered_services = 2; -uint8_t num_remote_offered_services = 3; - - -struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404 }; -struct service_info remote_service = { 0x2222, 0x2, 0x2222, 0x2222, 0x2000, 0x2808 }; -} - -#endif /* OFFER_TEST_GLOBALS_HPP_ */ 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 deleted file mode 100644 index cb7db92..0000000 --- a/test/offered_services_info_test/offered_services_info_test_local.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "diagnosis":"0x12", - "logging" : - { - "level" : "warning", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "offered_services_info_test_service", - "id" : "0x1277" - } - ], - - "services" : - [ - { - "service" : "0x1111", - "instance" : "0x1" - }, - { - "service" : "0x2222", - "instance" : "0x2", - "reliable" : { "port" : "30502" }, - "unreliable" : "31002" - }, - { - "service" : "0x2223", - "instance" : "0x3", - "reliable" : { "port" : "30503" } - }, - { - "service" : "0x2224", - "instance" : "0x4", - "unreliable" : "31004" - } - ], - - "routing" : "vsomeipd", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} 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 deleted file mode 100755 index 68482f9..0000000 --- a/test/offered_services_info_test/offered_services_info_test_local_starter.sh +++ /dev/null @@ -1,58 +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 - -# Rejecting offer of service instance whose hosting application is still -# alive: -# * start application which offers service -# * start two clients which continuously exchanges messages with the service -# * start application which offers the same service again -> should be -# rejected and an error message should be printed. -# * Message exchange with client application should not be interrupted. - -# 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 -PID_SERVICE_ONE=$! -./offered_services_info_test_client METHODCALL & -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 the services -kill $PID_SERVICE_ONE -sleep 1 - - -# Check if everything went well -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi 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 deleted file mode 100644 index d9a7ae4..0000000 --- a/test/offered_services_info_test/offered_services_info_test_service.cpp +++ /dev/null @@ -1,260 +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 <atomic> -#include <future> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "offered_services_info_test_globals.hpp" - -static std::string service_number; -std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> all_offered_services; -std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> local_offered_services; -std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> remote_offered_services; - - -class offer_test_service { -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 - // this way the same json file can be reused for all local tests - // including the ones with vsomeipd - app_(vsomeip::runtime::get()->create_application( - (service_number == "1") ? "vsomeipd" : - "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)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&offer_test_service::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.method_id, - std::bind(&offer_test_service::on_request, this, - std::placeholders::_1)); - - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.shutdown_method_id, - std::bind(&offer_test_service::on_shutdown_method_called, this, - std::placeholders::_1)); - app_->start(); - } - - ~offer_test_service() { - offer_thread_.join(); - } - - void offer() { - //offer local services - app_->offer_service(service_info_.service_id, service_info_.instance_id); - local_offered_services[service_info_.service_id].insert(service_info_.instance_id); - all_offered_services[service_info_.service_id].insert(service_info_.instance_id); - - app_->offer_service(service_info_.service_id, (vsomeip::instance_t)(service_info_.instance_id + 1)); - local_offered_services[service_info_.service_id].insert((vsomeip::instance_t)(service_info_.instance_id + 1)); - all_offered_services[service_info_.service_id].insert((vsomeip::instance_t)(service_info_.instance_id + 1)); - - // offer remote service ID 0x2222 instance ID 0x2 (port configuration added to json file) - app_->offer_service(remote_service_info_.service_id, remote_service_info_.instance_id); // reliable and unreliable port - remote_offered_services[remote_service_info_.service_id].insert(remote_service_info_.instance_id); - all_offered_services[remote_service_info_.service_id].insert(remote_service_info_.instance_id); - - - app_->offer_service((vsomeip::service_t)(remote_service_info_.service_id + 1), (vsomeip::instance_t)(remote_service_info_.instance_id + 1)); // only reliable port - remote_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 1)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 1)); - all_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 1)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 1)); - - - app_->offer_service((vsomeip::service_t)(remote_service_info_.service_id + 2), (vsomeip::instance_t)(remote_service_info_.instance_id + 2)); // only unreliable port - remote_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 2)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 2)); - all_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 2)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 2)); - } - - 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_request(const std::shared_ptr<vsomeip::message> &_message) { - app_->send(vsomeip::runtime::get()->create_response(_message)); - } - - void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) { - (void)_message; - shutdown_method_called_ = true; - - app_->stop_offer_service(service_info_.service_id, service_info_.instance_id); - app_->stop_offer_service(service_info_.service_id, (vsomeip::instance_t)(service_info_.instance_id + 1)); - - app_->stop_offer_service(remote_service_info_.service_id, remote_service_info_.instance_id); // reliable and unreliable port - app_->stop_offer_service((vsomeip::service_t)(remote_service_info_.service_id + 1), (vsomeip::instance_t)(remote_service_info_.instance_id + 1)); // only reliable port - app_->stop_offer_service((vsomeip::service_t)(remote_service_info_.service_id + 2), (vsomeip::instance_t)(remote_service_info_.instance_id + 2)); // only unreliable port - - app_->clear_all_handler(); - app_->stop(); - } - - 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(); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - VSOMEIP_INFO << "TEST LOCAL SERVICES"; - app_->get_offered_services_async(vsomeip::offer_type_e::OT_LOCAL, std::bind(&offer_test_service::on_offered_services_local, this, std::placeholders::_1)); - - if (std::future_status::timeout == all_callbacks_received_.get_future().wait_for(std::chrono::seconds(15))) { - ADD_FAILURE() << "Didn't receive all callbacks within time"; - } - - while(!shutdown_method_called_) { - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - } - } - - - void on_offered_services_local( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) { - std::cout << "ON OFFERED SERVICES LOCAL CALLBACK START" << std::endl; - EXPECT_EQ(2u, _services.size()); - bool local_service_test_failed(true); - uint16_t i=0; - for (auto its_pair : _services) { - local_service_test_failed = true; - std::cout << "CALLBACK VALUE -> Service: "<< std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl; - auto found_service = local_offered_services.find(its_pair.first); - if (found_service != local_offered_services.end()) { - auto found_instance = found_service->second.find(its_pair.second); - if (found_instance != found_service->second.end()) { - i++; - local_service_test_failed = false; - } - } - EXPECT_FALSE(local_service_test_failed); - } - EXPECT_EQ(offer_test::num_local_offered_services, i); - - std::cout << "ON OFFERED SERVICES LOCAL CALLBACK END" << std::endl; - - VSOMEIP_INFO << "TEST REMOTE SERVICES"; - app_->get_offered_services_async(vsomeip::offer_type_e::OT_REMOTE, std::bind(&offer_test_service::on_offered_services_remote, this, std::placeholders::_1)); - } - - - void on_offered_services_remote( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) { - std::cout << "ON OFFERED SERVICES REMOTE CALLBACK START" << std::endl; - EXPECT_EQ(3u, _services.size()); - bool remote_service_test_failed(true); - uint16_t i=0; - for (auto its_pair : _services) { - remote_service_test_failed = true; - std::cout << "CALLBACK VALUE -> Service: " << std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl; - auto found_service = remote_offered_services.find(its_pair.first); - if (found_service != remote_offered_services.end()) { - auto found_instance = found_service->second.find(its_pair.second); - if (found_instance != found_service->second.end()) { - i++; - remote_service_test_failed = false; - } - } - EXPECT_FALSE(remote_service_test_failed); - } - EXPECT_EQ(offer_test::num_remote_offered_services, i); - - std::cout << "ON OFFERED SERVICES REMOTE CALLBACK END" << std::endl; - - VSOMEIP_INFO << "TEST ALL SERVICES"; - app_->get_offered_services_async(vsomeip::offer_type_e::OT_ALL, std::bind(&offer_test_service::on_offered_services_all, this, std::placeholders::_1)); - } - - - void on_offered_services_all( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) { - std::cout << "ON OFFERED SERVICES ALL CALLBACK START" << std::endl; - EXPECT_EQ(5u, _services.size()); - bool all_service_test_failed(true); - uint16_t i=0; - for (auto its_pair : _services) { - all_service_test_failed = true; - std::cout << "CALLBACK VALUE -> Service: " << std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl; - auto found_service = all_offered_services.find(its_pair.first); - if (found_service != all_offered_services.end()) { - auto found_instance = found_service->second.find(its_pair.second); - if (found_instance != found_service->second.end()) { - i++; - all_service_test_failed = false; - } - } - EXPECT_FALSE(all_service_test_failed); - } - EXPECT_EQ(offer_test::num_all_offered_services, i); - std::cout << "ON OFFERED SERVICES ALL CALLBACK END" << std::endl; - all_callbacks_received_.set_value(); - } - -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_; - std::condition_variable condition_; - std::atomic<bool> shutdown_method_called_; - std::promise<void> all_callbacks_received_; - std::thread offer_thread_; -}; - -TEST(someip_offered_services_info_test, check_offered_services_as_rm_impl) -{ - offer_test_service its_sample(offer_test::service, offer_test::remote_service); -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - if(argc < 2) { - std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl; - return 1; - } - - service_number = std::string(argv[1]); - return RUN_ALL_TESTS(); -} -#endif 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 deleted file mode 100644 index d027a6f..0000000 --- a/test/payload_tests/conf/external_local_payload_test_client_external.json.in +++ /dev/null @@ -1,48 +0,0 @@ -{ - "unicast" : "@TEST_IP_SLAVE@", - "netmask" : "255.255.255.0", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "true", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "true" - }, - - "applications" : - [ - { - "name" : "external_local_payload_test_client_external", - "id" : "0x1343" - } - ], - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678", - "unicast" : "@TEST_IP_MASTER@", - "unreliable" : "30509", - "reliable" : - { - "port" : "30510", - "enable-magic-cookies" : "false" - } - } - ], - - "routing" : "external_local_payload_test_client_external", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30491", - "protocol" : "udp" - } -} 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 deleted file mode 100644 index 40f40ca..0000000 --- a/test/payload_tests/conf/external_local_payload_test_client_local.json.in +++ /dev/null @@ -1,49 +0,0 @@ -{ - "unicast" : "@TEST_IP_MASTER@", - "netmask" : "255.255.255.0", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "true", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "true" - }, - - "applications" : - [ - { - "name" : "external_local_payload_test_client_local", - "id" : "0x1343" - } - ], - - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678", - "unicast" : "@TEST_IP_MASTER@", - "unreliable" : "30509", - "reliable" : - { - "port" : "30510", - "enable-magic-cookies" : "false" - } - } - ], - - "routing" : "external_local_payload_test_service", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30491", - "protocol" : "udp" - } -} 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 deleted file mode 100644 index dc7680c..0000000 --- a/test/payload_tests/conf/external_local_payload_test_service.json.in +++ /dev/null @@ -1,46 +0,0 @@ -{ - "unicast" : "@TEST_IP_MASTER@", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "external_local_payload_test_service", - "id" : "0x1277" - } - ], - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678", - "unreliable" : "30509", - "reliable" : - { - "port" : "30510", - "enable-magic-cookies" : "false" - } - } - ], - - "routing" : "external_local_payload_test_service", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} diff --git a/test/payload_tests/external_local_payload_test_client_external_start.sh b/test/payload_tests/external_local_payload_test_client_external_start.sh deleted file mode 100755 index 5f6b7ea..0000000 --- a/test/payload_tests/external_local_payload_test_client_external_start.sh +++ /dev/null @@ -1,13 +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/. - -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_external -export VSOMEIP_CONFIGURATION=external_local_payload_test_client_external.json -./payload_test_client --udp --max-payload-size UDP -# We sleep to let the service restart with --tcp option so we can test -# communication via TCP. -sleep 5 -./payload_test_client --tcp --max-payload-size TCP 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 deleted file mode 100755 index da6ca08..0000000 --- a/test/payload_tests/external_local_payload_test_client_external_starter.sh +++ /dev/null @@ -1,126 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# Parameter 1: the pid to check -# Parameter 2: number of TCP/UDP sockets the process should have open -check_tcp_udp_sockets_are_open () -{ - # Check that the passed pid/process does listen on at least one TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -lt $2 ] - then - ((FAIL+=1)) - fi -} - -# Parameter 1: the pid to check -check_tcp_udp_sockets_are_closed () -{ - # Check that the passed pid/process does not listen on any TCP/UDP socket - # or has any active connection via a TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] - then - ((FAIL+=1)) - fi - - SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] - then - ((FAIL+=1)) - fi -} - -# Start the service for payload test with UDP -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service -export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json -./payload_test_service --udp & -SERIVCE_PID=$! - -# Display a message to show the user that he must now call the external client -# 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\"" & - 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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** external_local_payload_test_client_external_start.sh -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** external_local_payload_test_client_external.json and -** external_local_payload_test_service.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# The service should listen on a TCP and UDP socket now -sleep 1 -check_tcp_udp_sockets_are_open $SERIVCE_PID 2 - -# Wait until service is finished -# The client remotely shuts down the service if he has successfully transmitted -# all the packets with different payloads. Therefore we can assume that everything -# went well, even if we can only check the exit code of the service here. - -# Fail gets incremented if either client or service exit -# with a non-zero exit code -wait $SERIVCE_PID || ((FAIL+=1)) - - -# Start the service for payload test with tcp -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service -export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json -./payload_test_service --tcp & -SERIVCE_PID=$! - -# The service should listen on a TCP and UDP socket now -sleep 1 -check_tcp_udp_sockets_are_open $SERIVCE_PID 2 - - -# Wait until service is finished -# The client remotely shuts down the service if he has successfully transmitted -# all the packets with different payloads. Therefore we can assume that everything -# went well, even if we can only check the exit code of the service here. - -# Fail gets incremented if either client or service exit -# 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 - exit 0 -else - exit 1 -fi 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 deleted file mode 100755 index 041abc4..0000000 --- a/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh +++ /dev/null @@ -1,144 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# Parameter 1: the pid to check -# Parameter 2: number of TCP/UDP sockets the process should have open -check_tcp_udp_sockets_are_open () -{ - # Check that the passed pid/process does listen on at least one TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -lt $2 ] - then - ((FAIL+=1)) - fi -} - -# Parameter 1: the pid to check -check_tcp_udp_sockets_are_closed () -{ - # Check that the passed pid/process does not listen on any TCP/UDP socket - # or has any active connection via a TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] - then - ((FAIL+=1)) - fi - - SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] - then - ((FAIL+=1)) - fi -} - -# Start the service -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service -export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json -./payload_test_service & -SERIVCE_PID=$! -sleep 1; - -# The service should listen on a TCP and UDP socket now -check_tcp_udp_sockets_are_open $SERIVCE_PID 2 - -# Start the client which sends messages over local UDS -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local -export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json -./payload_test_client --dont-shutdown-service & -CLIENT_PID=$! -sleep 1 - -check_tcp_udp_sockets_are_open $SERIVCE_PID 2 -check_tcp_udp_sockets_are_closed $CLIENT_PID - -# Wait until client is finished -wait $CLIENT_PID || ((FAIL+=1)) - -# Display a message to show the user that he must now call the external client -# 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\"" & - 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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** external_local_payload_test_client_external_start.sh -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** external_local_payload_test_client_external.json and -** external_local_payload_test_service.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# The service should still listen on a TCP and UDP socket -sleep 1 -check_tcp_udp_sockets_are_open $SERIVCE_PID 2 - -# Wait until service is finished -# The client remotely shuts down the service if he has successfully transmitted -# all the packets with different payloads. Therefore we can assume that everything -# went well, even if we can only check the exit code of the service here. - -# Fail gets incremented if either client or service exit -# with a non-zero exit code -wait $SERIVCE_PID || ((FAIL+=1)) - - -# Start the service for payload test with tcp -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service -export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json -./payload_test_service --tcp & -SERIVCE_PID=$! - -# The service should listen on a TCP and UDP socket now -sleep 1 -check_tcp_udp_sockets_are_open $SERIVCE_PID 2 - - -# Wait until service is finished -# The client remotely shuts down the service if he has successfully transmitted -# all the packets with different payloads. Therefore we can assume that everything -# went well, even if we can only check the exit code of the service here. - -# Fail gets incremented if either client or service exit -# 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 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/payload_tests/external_local_payload_test_client_local_start.sh b/test/payload_tests/external_local_payload_test_client_local_start.sh deleted file mode 100755 index b79e534..0000000 --- a/test/payload_tests/external_local_payload_test_client_local_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local -export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json -./payload_test_client diff --git a/test/payload_tests/external_local_payload_test_client_local_starter.sh b/test/payload_tests/external_local_payload_test_client_local_starter.sh deleted file mode 100755 index c73dd81..0000000 --- a/test/payload_tests/external_local_payload_test_client_local_starter.sh +++ /dev/null @@ -1,91 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# Parameter 1: the pid to check -# Parameter 2: number of TCP/UDP sockets the process should have open -check_tcp_udp_sockets_are_open () -{ - # Check that the passed pid/process does listen on at least one TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -lt $2 ] - then - ((FAIL+=1)) - fi -} - -# Parameter 1: the pid to check -check_tcp_udp_sockets_are_closed () -{ - # Check that the passed pid/process does not listen on any TCP/UDP socket - # or has any active connection via a TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] - then - ((FAIL+=1)) - fi - - SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] - then - ((FAIL+=1)) - fi -} - -# Start the service -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service -export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json -./payload_test_service & -SERIVCE_PID=$! -sleep 1; - -# The service should listen on a TCP and UDP socket now -check_tcp_udp_sockets_are_open $SERIVCE_PID 2 - -# Start the client -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local -export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json -./payload_test_client & -CLIENT_PID=$! - -# The service should still listen on a TCP and UDP socket now -check_tcp_udp_sockets_are_open $SERIVCE_PID 2 -# The client should use the shortcut over a local UDS instead of TCP/UDP, -# therefore he shouldn't have any open TCP/UDP sockets -check_tcp_udp_sockets_are_closed $CLIENT_PID - -if [ ! -z "$USE_DOCKER" ]; then - FAIL=0 -fi - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if client and server both exited sucessfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/payload_tests/external_local_payload_test_service_client_external_start.sh b/test/payload_tests/external_local_payload_test_service_client_external_start.sh deleted file mode 100755 index 046d50b..0000000 --- a/test/payload_tests/external_local_payload_test_service_client_external_start.sh +++ /dev/null @@ -1,12 +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/. - -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service -export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json -./payload_test_service --udp -# After payload was measured with UDP the client will restart and measure -# throughput with TCP -./payload_test_service --tcp
\ No newline at end of file diff --git a/test/payload_tests/external_local_payload_test_service_start.sh b/test/payload_tests/external_local_payload_test_service_start.sh deleted file mode 100755 index 90b1b38..0000000 --- a/test/payload_tests/external_local_payload_test_service_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service -export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json -./payload_test_service diff --git a/test/payload_tests/local_payload_test_client.json b/test/payload_tests/local_payload_test_client.json deleted file mode 100644 index 24fa1fa..0000000 --- a/test/payload_tests/local_payload_test_client.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "netmask" : "255.255.255.0", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "true", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "true" - }, - - "applications" : - [ - { - "name" : "local_payload_test_client", - "id" : "0x1343" - } - ], - "services" : - [ - ], - - "routing" : "local_payload_test_service", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30491", - "protocol" : "udp" - } -} diff --git a/test/payload_tests/local_payload_test_client_start.sh b/test/payload_tests/local_payload_test_client_start.sh deleted file mode 100755 index 975be2a..0000000 --- a/test/payload_tests/local_payload_test_client_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=local_payload_test_client -export VSOMEIP_CONFIGURATION=local_payload_test_client.json -./payload_test_client diff --git a/test/payload_tests/local_payload_test_huge_payload_starter.sh b/test/payload_tests/local_payload_test_huge_payload_starter.sh deleted file mode 100755 index c230891..0000000 --- a/test/payload_tests/local_payload_test_huge_payload_starter.sh +++ /dev/null @@ -1,43 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# Start the service -export VSOMEIP_APPLICATION_NAME=local_payload_test_service -export VSOMEIP_CONFIGURATION=local_payload_test_service.json -./payload_test_service & -SERIVCE_PID=$! -sleep 1; - -# Start the client -export VSOMEIP_APPLICATION_NAME=local_payload_test_client -export VSOMEIP_CONFIGURATION=local_payload_test_client.json -./payload_test_client --number-of-messages 100 --max-payload-size 10485760 & -CLIENT_PID=$! - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if client and server both exited sucessfully and the service didnt't -# have any open tcp/udp sockets -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/payload_tests/local_payload_test_service.json b/test/payload_tests/local_payload_test_service.json deleted file mode 100644 index b5c83a6..0000000 --- a/test/payload_tests/local_payload_test_service.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "local_payload_test_service", - "id" : "0x1277" - } - ], - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ], - - "routing" : "local_payload_test_service", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} diff --git a/test/payload_tests/local_payload_test_service_start.sh b/test/payload_tests/local_payload_test_service_start.sh deleted file mode 100755 index cc67f54..0000000 --- a/test/payload_tests/local_payload_test_service_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=local_payload_test_service -export VSOMEIP_CONFIGURATION=local_payload_test_service.json -./payload_test_service diff --git a/test/payload_tests/local_payload_test_starter.sh b/test/payload_tests/local_payload_test_starter.sh deleted file mode 100755 index abc4577..0000000 --- a/test/payload_tests/local_payload_test_starter.sh +++ /dev/null @@ -1,69 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# Parameter 1: the pid to check -check_tcp_udp_sockets_are_closed () -{ - # Check that the service does not listen on any TCP/UDP socket - # or has any active connection via a TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] - then - ((FAIL+=1)) - fi - - SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] - then - ((FAIL+=1)) - fi -} - -# Start the service -export VSOMEIP_APPLICATION_NAME=local_payload_test_service -export VSOMEIP_CONFIGURATION=local_payload_test_service.json -./payload_test_service & -SERIVCE_PID=$! -sleep 1; - -check_tcp_udp_sockets_are_closed $SERIVCE_PID - -# Start the client -export VSOMEIP_APPLICATION_NAME=local_payload_test_client -export VSOMEIP_CONFIGURATION=local_payload_test_client.json -./payload_test_client & -CLIENT_PID=$! - -check_tcp_udp_sockets_are_closed $SERIVCE_PID -check_tcp_udp_sockets_are_closed $CLIENT_PID - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if client and server both exited sucessfully and the service didnt't -# have any open tcp/udp sockets -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/payload_tests/payload_test_client.cpp b/test/payload_tests/payload_test_client.cpp deleted file mode 100644 index 65dbec7..0000000 --- a/test/payload_tests/payload_test_client.cpp +++ /dev/null @@ -1,415 +0,0 @@ -// 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 "payload_test_client.hpp" - -enum class payloadsize - : std::uint8_t - { - UDS, TCP, UDP, USER_SPECIFIED -}; - -// this variables are changed via cmdline parameters -static bool use_tcp = false; -static bool call_service_sync = true; -static std::uint32_t sliding_window_size = vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS; -static payloadsize max_payload_size = payloadsize::UDS; -static bool shutdown_service_at_end = true; -static std::uint32_t user_defined_max_payload; -static std::uint32_t number_of_messages_to_send = 0; - -payload_test_client::payload_test_client( - bool _use_tcp, - bool _call_service_sync, - std::uint32_t _sliding_window_size) : - app_(vsomeip::runtime::get()->create_application()), - request_(vsomeip::runtime::get()->create_request(_use_tcp)), - call_service_sync_(_call_service_sync), - sliding_window_size_(_sliding_window_size), - blocked_(false), - is_available_(false), - number_of_messages_to_send_(number_of_messages_to_send ? number_of_messages_to_send : vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS), - number_of_sent_messages_(0), - number_of_sent_messages_total_(0), - number_of_acknowledged_messages_(0), - current_payload_size_(1), - all_msg_acknowledged_(false), - sender_(std::bind(&payload_test_client::run, this)) -{ -} - -bool payload_test_client::init() -{ - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - - app_->register_state_handler( - std::bind(&payload_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD, - std::bind(&payload_test_client::on_message, this, - std::placeholders::_1)); - - app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - std::bind(&payload_test_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - return true; -} - -void payload_test_client::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void payload_test_client::stop() -{ - VSOMEIP_INFO << "Stopping..."; - // shutdown the service - if(shutdown_service_at_end) - { - shutdown_service(); - } - app_->clear_all_handler(); -} - -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); -} - -void payload_test_client::join_sender_thread() -{ - sender_.join(); -} - -void payload_test_client::on_state(vsomeip::state_type_e _state) -{ - if(_state == vsomeip::state_type_e::ST_REGISTERED) - { - app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); - } -} - -void payload_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 << "." << _instance << "] is " - << (_is_available ? "available." : "NOT available."); - - if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service - && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) - { - if(is_available_ && !_is_available) - { - is_available_ = false; - } - else if(_is_available && !is_available_) - { - is_available_ = true; - send(); - } - } -} - -void payload_test_client::on_message(const std::shared_ptr<vsomeip::message>& _response) -{ - number_of_acknowledged_messages_++; - - ASSERT_EQ(_response->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID); - ASSERT_EQ(_response->get_instance(), vsomeip_test::TEST_SERVICE_INSTANCE_ID); - - if(call_service_sync_) - { - // We notify the sender thread every time a message was acknowledged - { - std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_); - all_msg_acknowledged_ = true; - } - all_msg_acknowledged_cv_.notify_one(); - } - else - { - // We notify the sender thread only if all sent messages have been acknowledged - if(number_of_acknowledged_messages_ == number_of_messages_to_send_) - { - std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_); - number_of_acknowledged_messages_ = 0; - all_msg_acknowledged_ = true; - all_msg_acknowledged_cv_.notify_one(); - } - else if(number_of_acknowledged_messages_ % sliding_window_size == 0) - { - std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_); - all_msg_acknowledged_ = true; - all_msg_acknowledged_cv_.notify_one(); - } - } -} - -void payload_test_client::send() -{ - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); -} - -void payload_test_client::run() -{ - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - { - condition_.wait(its_lock); - } - - 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); - - // lock the mutex - std::unique_lock<std::mutex> lk(all_msg_acknowledged_mutex_); - - std::uint32_t max_allowed_payload = get_max_allowed_payload(); - - std::shared_ptr<vsomeip::payload> payload = vsomeip::runtime::get()->create_payload(); - std::vector<vsomeip::byte_t> payload_data; - bool reached_peak = false; - for(;;) - { - payload_data.assign(current_payload_size_ , vsomeip_test::PAYLOAD_TEST_DATA); - payload->set_data(payload_data); - request_->set_payload(payload); - - watch_.reset(); - watch_.start(); - - call_service_sync_ ? send_messages_sync(lk) : send_messages_async(lk); - - watch_.stop(); - print_throughput(); - - // Increase array size for next iteration - if(!reached_peak) { - current_payload_size_ *= 2; - } else { - current_payload_size_ /= 2; - } - - if(!reached_peak && current_payload_size_ > max_allowed_payload) - { - current_payload_size_ = max_allowed_payload; - reached_peak = true; - } else if(reached_peak && current_payload_size_ <= 1) { - break; - } - } - blocked_ = false; - - stop(); - std::thread t1([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));}); - t1.join(); - app_->stop(); - std::thread t([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));}); - t.join(); -} - - -std::uint32_t payload_test_client::get_max_allowed_payload() -{ - std::uint32_t payload; - switch (max_payload_size) - { - case payloadsize::UDS: - // TODO - payload = 1024 * 32 - 16; - break; - case payloadsize::TCP: - // TODO - payload = 4095 - 16; - break; - case payloadsize::UDP: - payload = VSOMEIP_MAX_UDP_MESSAGE_SIZE - 16; - break; - case payloadsize::USER_SPECIFIED: - payload = user_defined_max_payload; - break; - default: - payload = VSOMEIP_MAX_LOCAL_MESSAGE_SIZE; - break; - } - return payload; -} - -void payload_test_client::send_messages_sync(std::unique_lock<std::mutex>& lk) -{ - for (number_of_sent_messages_ = 0; - number_of_sent_messages_ < number_of_messages_to_send_; - number_of_sent_messages_++, number_of_sent_messages_total_++) - { - app_->send(request_, true); - // 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, [&] - { return all_msg_acknowledged_;}); - // Reset condition variable (lk is locked again here) - all_msg_acknowledged_ = false; - } -} - -void payload_test_client::send_messages_async(std::unique_lock<std::mutex>& lk) -{ - for (number_of_sent_messages_ = 0; - number_of_sent_messages_ < number_of_messages_to_send_; - number_of_sent_messages_++, number_of_sent_messages_total_++) - { - app_->send(request_, true); - - 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 - all_msg_acknowledged_cv_.wait(lk, [&] - { return all_msg_acknowledged_;}); - - // Reset condition variable - all_msg_acknowledged_ = false; - } - } -} - -void payload_test_client::print_throughput() -{ - constexpr std::uint32_t usec_per_sec = 1000000; - stop_watch::usec_t time_needed = watch_.get_total_elapsed_microseconds(); - stop_watch::usec_t time_per_message = time_needed / number_of_sent_messages_; - std::double_t calls_per_sec = number_of_sent_messages_ - * (usec_per_sec / static_cast<double>(time_needed)); - std::double_t mbyte_per_sec = ((number_of_sent_messages_ - * current_payload_size_) - / (static_cast<double>(time_needed) / usec_per_sec)) / (1024*1024); - - VSOMEIP_INFO<< "[ Payload Test ] : :" - << "Payload size [byte]: " << std::dec << std::setw(8) << std::setfill('0') << current_payload_size_ - << " Messages sent: " << std::dec << std::setw(8) << std::setfill('0') << number_of_sent_messages_ - << " Meantime/message [usec]: " << std::dec << std::setw(8) << std::setfill('0') << time_per_message - << " Calls/sec: " << std::dec << std::setw(8) << std::setfill('0') << calls_per_sec - << " MiB/sec: " << std::dec << std::setw(8) << std::setfill('0') << mbyte_per_sec; -} - -TEST(someip_payload_test, send_different_payloads) -{ - payload_test_client test_client_(use_tcp, call_service_sync, sliding_window_size); - if (test_client_.init()) { - test_client_.start(); - test_client_.join_sender_thread(); - } -} - - -#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 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 numbers_of_messages("--number-of-messages"); - 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(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 { - max_payload_size = payloadsize::USER_SPECIFIED; - std::stringstream converter(argv[i]); - converter >> user_defined_max_payload; - } - } - else if (numbers_of_messages == argv[i]) { - i++; - std::stringstream converter(argv[i]); - converter >> number_of_messages_to_send; - } - 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" - << "--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" - << "--number-of-messages: Number of messages to send per payload size iteration\n" - << "--help: print this help"; - } - i++; - } - - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/payload_tests/payload_test_client.hpp b/test/payload_tests/payload_test_client.hpp deleted file mode 100644 index 2757d00..0000000 --- a/test/payload_tests/payload_test_client.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// 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/. - -#ifndef PAYLOADTESTCLIENT_HPP_ -#define PAYLOADTESTCLIENT_HPP_ - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <cmath> -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> - -#include "../someip_test_globals.hpp" - -#include "stopwatch.hpp" - -class payload_test_client -{ -public: - payload_test_client(bool _use_tcp, bool _call_service_sync, std::uint32_t _sliding_window_size); - bool init(); - void start(); - void stop(); - void join_sender_thread(); - void on_state(vsomeip::state_type_e _state); - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available); - void on_message(const std::shared_ptr<vsomeip::message> &_response); - void send(); - void run(); - -private: - void print_throughput(); - void send_messages_sync(std::unique_lock<std::mutex>& lk); - void send_messages_async(std::unique_lock<std::mutex>& lk); - void shutdown_service(); - std::uint32_t get_max_allowed_payload(); - -private: - std::shared_ptr<vsomeip::application> app_; - std::shared_ptr<vsomeip::message> request_; - bool call_service_sync_; - std::uint32_t sliding_window_size_; - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - bool is_available_; - const std::uint32_t number_of_messages_to_send_; - std::uint32_t number_of_sent_messages_; - std::uint32_t number_of_sent_messages_total_; - std::uint32_t number_of_acknowledged_messages_; - - std::uint32_t current_payload_size_; - - stop_watch watch_; - - bool all_msg_acknowledged_; - std::mutex all_msg_acknowledged_mutex_; - std::condition_variable all_msg_acknowledged_cv_; - - std::thread sender_; - -}; - -#endif /* PAYLOADTESTCLIENT_HPP_ */ diff --git a/test/payload_tests/payload_test_service.cpp b/test/payload_tests/payload_test_service.cpp deleted file mode 100644 index bb174cd..0000000 --- a/test/payload_tests/payload_test_service.cpp +++ /dev/null @@ -1,186 +0,0 @@ -// 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 "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) : - 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)) -{ -} - -bool payload_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(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID, - std::bind(&payload_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN, - std::bind(&payload_test_service::on_message_shutdown, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&payload_test_service::on_state, this, - std::placeholders::_1)); - return true; -} - -void payload_test_service::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void payload_test_service::stop() -{ - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); -} - -void payload_test_service::join_offer_thread() -{ - offer_thread_.join(); -} - -void payload_test_service::offer() -{ - app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void payload_test_service::stop_offer() -{ - app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void payload_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 payload_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request) -{ - number_of_received_messages_++; - if(number_of_received_messages_ % vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS == 0) - { - 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() << "] payload size [byte]:" - << std::dec << _request->get_payload()->get_length(); - } - - ASSERT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _request->get_service()); - ASSERT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _request->get_method()); - - // Check the protocol version this shall be set to 0x01 according to the spec. - // TR_SOMEIP_00052 - ASSERT_EQ(0x01, _request->get_protocol_version()); - // Check the message type this shall be 0xx (REQUEST) according to the spec. - // TR_SOMEIP_00055 - ASSERT_EQ(vsomeip::message_type_e::MT_REQUEST, _request->get_message_type()); - - if (check_payload) { - std::shared_ptr<vsomeip::payload> pl = _request->get_payload(); - vsomeip::byte_t* pl_ptr = pl->get_data(); - for (vsomeip::length_t i = 0; i < pl->get_length(); i++) - { - ASSERT_EQ(vsomeip_test::PAYLOAD_TEST_DATA, *(pl_ptr+i)); - } - } - - // send response - std::shared_ptr<vsomeip::message> its_response = - vsomeip::runtime::get()->create_response(_request); - - app_->send(its_response, true); -} - -void payload_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 payload_test_service::run() -{ - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - condition_.wait(its_lock); - - offer(); -} - -TEST(someip_payload_test, send_response_for_every_request) -{ - payload_test_service test_service(use_tcp); - if (test_service.init()) { - test_service.start(); - test_service.join_offer_thread(); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - std::string help("--help"); - std::string check("--do-not-check-payload"); - - int i = 1; - while (i < argc) - { - if(help == argv[i]) - { - VSOMEIP_INFO << "Parameters:\n" - << "--help: print this help\n" - << "--do-not-check-payload: Don't verify payload data " - << "-> Use this flag for performance measurements!"; - } else if (check == argv[i]) { - check_payload = false; - } - i++; - } - - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/payload_tests/payload_test_service.hpp b/test/payload_tests/payload_test_service.hpp deleted file mode 100644 index 32ae1e7..0000000 --- a/test/payload_tests/payload_test_service.hpp +++ /dev/null @@ -1,47 +0,0 @@ -// 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/. - -#ifndef PAYLOADTESTSERVICE_HPP_ -#define PAYLOADTESTSERVICE_HPP_ -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> - -#include "../someip_test_globals.hpp" - -class payload_test_service -{ -public: - payload_test_service(bool _use_tcp); - bool init(); - void start(); - void stop(); - void offer(); - void stop_offer(); - void join_offer_thread(); - void on_state(vsomeip::state_type_e _state); - void on_message(const std::shared_ptr<vsomeip::message> &_request); - void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - bool use_tcp_; - bool use_static_routing_; - - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - std::uint32_t number_of_received_messages_; - std::thread offer_thread_; -}; - -#endif /* PAYLOADTESTSERVICE_HPP_ */ diff --git a/test/payload_tests/stopwatch.cpp b/test/payload_tests/stopwatch.cpp deleted file mode 100644 index 83506f4..0000000 --- a/test/payload_tests/stopwatch.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// 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 "stopwatch.hpp" - -#include <cassert> -#include <ctime> - - -#define USEC_PER_SEC 1000000ULL -#define NSEC_PER_USEC 1000ULL - - -stop_watch::usec_t stop_watch::get_total_elapsed_microseconds() const { - usec_t elapsed = total_elapsed_; - - if (started_) - elapsed += get_elapsed(); - - return elapsed; -} - -stop_watch::usec_t stop_watch::get_total_elapsed_seconds() const { - return get_total_elapsed_microseconds() / USEC_PER_SEC; -} - -stop_watch::usec_t stop_watch::now() { - struct timespec ts; - - const int ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - assert(!ret); - static_cast<void>(ret); // prevent warning in release build - - return (usec_t) ts.tv_sec * USEC_PER_SEC + (usec_t) ts.tv_nsec / NSEC_PER_USEC; -} - diff --git a/test/payload_tests/stopwatch.hpp b/test/payload_tests/stopwatch.hpp deleted file mode 100644 index 5917e12..0000000 --- a/test/payload_tests/stopwatch.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// 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/. - -#ifndef STOP_WATCH_H_ -#define STOP_WATCH_H_ - -#include <cstdint> - - -class stop_watch -{ -public: - typedef uint64_t usec_t; - - stop_watch() : - started_(false), - start_time_point_(0), - total_elapsed_(0) - { - } - - inline void reset() - { - started_ = false; - total_elapsed_ = 0; - } - - inline void start() - { - start_time_point_ = now(); - started_ = true; - } - - inline void stop() - { - total_elapsed_ += get_elapsed(); - started_ = false; - } - - usec_t get_total_elapsed_microseconds() const; - usec_t get_total_elapsed_seconds() const; - -private: - inline usec_t get_elapsed() const - { - return now() - start_time_point_; - } - - static usec_t now(); - - bool started_; - usec_t start_time_point_; - usec_t total_elapsed_; -}; - -#endif // STOP_WATCH_H_ 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 deleted file mode 100644 index 5c363a7..0000000 --- a/test/pending_subscription_tests/conf/pending_subscription_test_master.json.in +++ /dev/null @@ -1,44 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"info", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications" : - [ - { - "name" : "pending_subscription_test_service", - "id" : "0xCAFE", - "max_dispatch_time" : "1000" - } - ], - "services": - [ - { - "service":"0x1122", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - } - ], - "routing":"vsomeipd", - "service-discovery": - { - "enable":"true", - "multicast":"224.0.23.1", - "port":"30490", - "protocol":"udp", - "cyclic_offer_delay" : "1000" - } -}
\ No newline at end of file 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 deleted file mode 100755 index 0a3dd17..0000000 --- a/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in +++ /dev/null @@ -1,75 +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 - -if [ $# -lt 1 ] -then - echo "Please pass a test mode to this script." - echo "For example: $0 SUSCRIBE" - echo "Valid subscription types include:" - echo " [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE_NACK]" - exit 1 -fi -TESTMODE=$1 -export VSOMEIP_CONFIGURATION=pending_subscription_test_master.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! -# Start the services -./pending_subscription_test_service $1 & -PID_SERIVCE=$! - -sleep 1 - -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\"" & - 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" & -else -cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** pending_subscription_test_sd_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 -** pending_subscription_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 - -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_globals.hpp b/test/pending_subscription_tests/pending_subscription_test_globals.hpp deleted file mode 100644 index 8daf91a..0000000 --- a/test/pending_subscription_tests/pending_subscription_test_globals.hpp +++ /dev/null @@ -1,32 +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 PENDING_SUBSCRIPTION_TEST_GLOBALS_HPP_ -#define PENDING_SUBSCRIPTION_TEST_GLOBALS_HPP_ - -namespace pending_subscription_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 = { 0x1122, 0x1, 0x1111, 0x1111, 0x1000, 0x1404, 0x4242 }; - -enum test_mode_e { - SUBSCRIBE, - SUBSCRIBE_UNSUBSCRIBE, - UNSUBSCRIBE, - SUBSCRIBE_UNSUBSCRIBE_NACK -}; - -} - -#endif /* PENDING_SUBSCRIPTION_TEST_GLOBALS_HPP_ */ 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 deleted file mode 100644 index b5325ab..0000000 --- a/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp +++ /dev/null @@ -1,826 +0,0 @@ -// 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 <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/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/message/include/message_impl.hpp" -#include "pending_subscription_test_globals.hpp" - -static char* remote_address; -static char* local_address; - -class pending_subscription : public ::testing::Test { -public: - pending_subscription() : - work_(std::make_shared<boost::asio::io_service::work>(io_)), - io_thread_(std::bind(&pending_subscription::io_run, this)) {} -protected: - - void TearDown() { - work_.reset(); - io_thread_.join(); - io_.stop(); - } - - void io_run() { - io_.run(); - } - - boost::asio::io_service io_; - std::shared_ptr<boost::asio::io_service::work> work_; - std::thread io_thread_; -}; - -TEST_F(pending_subscription, send_multiple_subscriptions) -{ - std::promise<bool> trigger_notifications; - - boost::asio::ip::udp::socket udp_socket(io_, - boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490)); - 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) { - 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); - } - } - 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()); - } - } - - 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)); - } - }); - - std::thread send_thread([&]() { - try { - std::uint8_t its_offer_service_message[] = { - 0xff, 0xff, 0x81, 0x00, - 0x00, 0x00, 0x00, 0x40, // length - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x01, 0x02, 0x00, - 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, // length entries array - 0x06, 0x00, 0x00, 0x10, - 0x11, 0x22, 0x00, 0x01, // service / instance - 0x00, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x10, 0x00, // eventgroup - 0x06, 0x00, 0x00, 0x10, - 0x11, 0x22, 0x00, 0x01, // service / instance - 0x00, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x10, 0x01, // eventgroup 2 - 0x00, 0x00, 0x00, 0x0c, // length options array - 0x00, 0x09, 0x04, 0x00, - 0xff, 0xff, 0xff, 0xff, // ip address - 0x00, 0x11, 0x77, 0x1a - }; - boost::asio::ip::address its_local_address = - boost::asio::ip::address::from_string(std::string(local_address)); - std::memcpy(&its_offer_service_message[64], &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); - for (int var = 0; var < 15; ++var) { - udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd); - ++its_offer_service_message[11]; - } - - - if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) { - ADD_FAILURE() << "Didn't receive all SubscribeAcks within time"; - } else { - // call notify method - std::uint8_t trigger_notifications_call[] = { - 0x11, 0x22, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x01, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service); - } - - // call shutdown method - std::uint8_t shutdown_call[] = { - 0x11, 0x22, 0x14, 0x04, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x00, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service); - } catch (...) { - ASSERT_FALSE(true); - } - - }); - - send_thread.join(); - receive_thread.join(); -} - -TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe) -{ - std::promise<bool> trigger_notifications; - - boost::asio::ip::udp::socket udp_socket(io_, - boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490)); - std::thread receive_thread([&](){ - const std::uint32_t expected_acks(8); - 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 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) { - if (error) { - 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]); - } - 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 (!error && (acks_received != expected_acks || - responses_received != expected_responses || - notifications_received != expected_notifications)) { - receive(); - } - }; - - 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); - }); - - std::thread send_thread([&]() { - try { - std::uint8_t its_offer_service_message[] = { - 0xff, 0xff, 0x81, 0x00, - 0x00, 0x00, 0x00, 0x40, // length - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x01, 0x02, 0x00, - 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, // length entries array - 0x06, 0x00, 0x00, 0x10, - 0x11, 0x22, 0x00, 0x01, // service / instance - 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL - 0x00, 0x00, 0x10, 0x00, // eventgroup - 0x06, 0x00, 0x00, 0x10, - 0x11, 0x22, 0x00, 0x01, // service / instance - 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL - 0x00, 0x00, 0x10, 0x01, // eventgroup 2 - 0x00, 0x00, 0x00, 0x0c, // length options array - 0x00, 0x09, 0x04, 0x00, - 0xff, 0xff, 0xff, 0xff, // ip address - 0x00, 0x11, 0x77, 0x1a - }; - - boost::asio::ip::address its_local_address = - boost::asio::ip::address::from_string(std::string(local_address)); - std::memcpy(&its_offer_service_message[64], &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); - for (int var = 0; var < 15; ++var) { - udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd); - ++its_offer_service_message[11]; - if (its_offer_service_message[11] % 2) { - its_offer_service_message[35] = 16; - its_offer_service_message[51] = 16; - } else { - its_offer_service_message[35] = 0; - its_offer_service_message[51] = 0; - } - } - - if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) { - ADD_FAILURE() << "Didn't receive all SubscribeAcks within time"; - } else { - // call notify method - std::uint8_t trigger_notifications_call[] = { - 0x11, 0x22, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x01, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service); - } - - // call shutdown method - std::uint8_t shutdown_call[] = { - 0x11, 0x22, 0x14, 0x04, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x00, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service); - } catch (...) { - ASSERT_FALSE(true); - } - - }); - - send_thread.join(); - receive_thread.join(); -} - -TEST_F(pending_subscription, send_multiple_unsubscriptions) -{ - std::promise<bool> trigger_notifications; - - boost::asio::ip::udp::socket udp_socket(io_, - boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490)); - std::thread receive_thread([&](){ - const std::uint32_t expected_acks(2); - 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 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) { - if (error) { - 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]); - } - 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 (!error && (acks_received != expected_acks || - responses_received != expected_responses || - notifications_received != expected_notifications)) { - receive(); - } - }; - - 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); - }); - - std::thread send_thread([&]() { - try { - std::uint8_t its_offer_service_message[] = { - 0xff, 0xff, 0x81, 0x00, - 0x00, 0x00, 0x00, 0x40, // length - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x01, 0x02, 0x00, - 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, // length entries array - 0x06, 0x00, 0x00, 0x10, - 0x11, 0x22, 0x00, 0x01, // service / instance - 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL - 0x00, 0x00, 0x10, 0x00, // eventgroup - 0x06, 0x00, 0x00, 0x10, - 0x11, 0x22, 0x00, 0x01, // service / instance - 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL - 0x00, 0x00, 0x10, 0x01, // eventgroup 2 - 0x00, 0x00, 0x00, 0x0c, // length options array - 0x00, 0x09, 0x04, 0x00, - 0xff, 0xff, 0xff, 0xff, // ip address - 0x00, 0x11, 0x77, 0x1a - }; - - boost::asio::ip::address its_local_address = - boost::asio::ip::address::from_string(std::string(local_address)); - std::memcpy(&its_offer_service_message[64], &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); - for (int var = 0; var < 15; ++var) { - if (its_offer_service_message[11] == 15 || its_offer_service_message[11] == 0x1) { - its_offer_service_message[35] = 16; - its_offer_service_message[51] = 16; - } else { - its_offer_service_message[35] = 0; - its_offer_service_message[51] = 0; - } - udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd); - ++its_offer_service_message[11]; - } - - if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) { - ADD_FAILURE() << "Didn't receive all SubscribeAcks within time"; - } else { - // call notify method - std::uint8_t trigger_notifications_call[] = { - 0x11, 0x22, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x01, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service); - } - - // call shutdown method - std::uint8_t shutdown_call[] = { - 0x11, 0x22, 0x14, 0x04, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x00, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service); - } catch (...) { - ASSERT_FALSE(true); - } - - }); - - send_thread.join(); - receive_thread.join(); -} - -TEST_F(pending_subscription, send_alternating_subscribe_nack_unsubscribe) -{ - std::promise<bool> trigger_notifications; - - boost::asio::ip::udp::socket udp_socket(io_, - boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490)); - std::thread receive_thread([&](){ - const std::uint32_t expected_acks(8); - std::atomic<std::uint32_t> acks_received(0); - - const std::uint32_t expected_nacks(8); - std::atomic<std::uint32_t> nacks_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 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) { - if (error) { - 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); - } - } - 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++; - } - } - - - 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(); - } - }; - - 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); - }); - - std::thread send_thread([&]() { - try { - std::uint8_t its_offer_service_message[] = { - 0xff, 0xff, 0x81, 0x00, - 0x00, 0x00, 0x00, 0x40, // length - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x01, 0x02, 0x00, - 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, // length entries array - 0x06, 0x00, 0x00, 0x10, - 0x11, 0x22, 0x00, 0x01, // service / instance - 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL - 0x00, 0x00, 0x10, 0x00, // eventgroup - 0x06, 0x00, 0x00, 0x10, - 0x11, 0x22, 0x00, 0x01, // service / instance - 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL - 0x00, 0x00, 0x10, 0x01, // eventgroup 2 - 0x00, 0x00, 0x00, 0x0c, // length options array - 0x00, 0x09, 0x04, 0x00, - 0xff, 0xff, 0xff, 0xff, // ip address - 0x00, 0x11, 0x77, 0x1a - }; - - boost::asio::ip::address its_local_address = - boost::asio::ip::address::from_string(std::string(local_address)); - std::memcpy(&its_offer_service_message[64], &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); - for (int var = 0; var < 15; ++var) { - udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd); - ++its_offer_service_message[11]; - if (its_offer_service_message[11] % 2) { - its_offer_service_message[35] = 16; - its_offer_service_message[51] = 16; - } else { - its_offer_service_message[35] = 0; - its_offer_service_message[51] = 0; - } - } - - if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) { - ADD_FAILURE() << "Didn't receive all SubscribeAcks within time"; - } else { - // call notify method - std::uint8_t trigger_notifications_call[] = { - 0x11, 0x22, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x01, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service); - } - - // call shutdown method - std::uint8_t shutdown_call[] = { - 0x11, 0x22, 0x14, 0x04, - 0x00, 0x00, 0x00, 0x08, - 0x22, 0x22, 0x00, 0x01, - 0x01, 0x00, 0x00, 0x00 }; - boost::asio::ip::udp::socket::endpoint_type target_service( - boost::asio::ip::address::from_string(std::string(remote_address)), - 30001); - udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service); - } catch (...) { - ASSERT_FALSE(true); - } - - }); - - send_thread.join(); - receive_thread.join(); -} - - -#ifndef _WIN32 -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - if(argc < 4) { - std::cerr << "Please pass an target and local IP address and test mode to this binary like: " - << argv[0] << " 10.0.3.1 10.0.3.202 SUBSCRIBE" << std::endl; - std::cerr << "Testmodes are [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE]" << std::endl; - exit(1); - } - remote_address = argv[1]; - local_address = argv[2]; - std::string its_testmode = argv[3]; - if (its_testmode == std::string("SUBSCRIBE")) { - ::testing::GTEST_FLAG(filter) = "*send_multiple_subscriptions"; - } else if (its_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE")) { - ::testing::GTEST_FLAG(filter) = "*send_alternating_subscribe_unsubscribe"; - } else if (its_testmode == std::string("UNSUBSCRIBE")) { - ::testing::GTEST_FLAG(filter) = "*send_multiple_unsubscriptions"; - } else if (its_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE_NACK")) { - ::testing::GTEST_FLAG(filter) = "*send_alternating_subscribe_nack_unsubscribe"; - } - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/pending_subscription_tests/pending_subscription_test_service.cpp b/test/pending_subscription_tests/pending_subscription_test_service.cpp deleted file mode 100644 index 00434f3..0000000 --- a/test/pending_subscription_tests/pending_subscription_test_service.cpp +++ /dev/null @@ -1,311 +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 <atomic> -#include <future> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "pending_subscription_test_globals.hpp" - -class pending_subscription_test_service { -public: - pending_subscription_test_service(struct pending_subscription_test::service_info _service_info, pending_subscription_test::test_mode_e _testmode) : - service_info_(_service_info), - testmode_(_testmode), - app_(vsomeip::runtime::get()->create_application("pending_subscription_test_service")), - wait_until_registered_(true), - wait_until_shutdown_method_called_(true), - subscription_accepted_asynchronous_(false), - subscription_accepted_synchronous_(false), - offer_thread_(std::bind(&pending_subscription_test_service::run, this)) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&pending_subscription_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, 0x1, - service_info_.event_id, its_eventgroups, true); - - 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); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, service_info_.shutdown_method_id, - std::bind(&pending_subscription_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(&pending_subscription_test_service::on_notify_method_called, this, - std::placeholders::_1)); - - 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)); - 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)); - app_->start(); - } - - ~pending_subscription_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, 0x1); - 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_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::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()->create_payload(); - its_payload->set_data( {0xDD}); - app_->notify(service_info_.service_id, service_info_.instance_id, - service_info_.event_id, its_payload); - app_->notify(service_info_.service_id, service_info_.instance_id, - static_cast<vsomeip::event_t>(service_info_.event_id + 1u) , its_payload); - notify_method_called_.set_value(true); - } - - 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 (!subscription_accepted_asynchronous_ || !subscription_accepted_synchronous_) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE) { - async_subscription_handler_(true); - } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE) { - ; - } else if (testmode_ == pending_subscription_test::test_mode_e::UNSUBSCRIBE) { - ; - } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK) { - ; - } - std::future<bool> itsFuture = notify_method_called_.get_future(); - if (std::future_status::timeout == itsFuture.wait_for(std::chrono::seconds(10))) { - ADD_FAILURE() << "notify method wasn't called within time!"; - } else { - EXPECT_TRUE(itsFuture.get()); - } - while (wait_until_shutdown_method_called_) { - condition_.wait(its_lock); - } - std::this_thread::sleep_for(std::chrono::milliseconds(2000)); - stop(); - } - - void subscription_handler_async(vsomeip::client_t _client, bool _subscribed, - std::function<void(const bool)> _cbk) { - VSOMEIP_WARNING << __func__ << " " << std::hex << _client << " subscribed." << _subscribed; - if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE) { - async_subscription_handler_ = _cbk; - static int was_called = 0; - was_called++; - EXPECT_EQ(1, was_called); - EXPECT_TRUE(_subscribed); - subscription_accepted_asynchronous_ = true; - } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE) { - static int count_subscribe = 0; - static int count_unsubscribe = 0; - _subscribed ? count_subscribe++ : count_unsubscribe++; - if (count_subscribe == 1) { - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - } - _cbk(true); - if (count_subscribe == 8 || count_unsubscribe == 7) { - subscription_accepted_asynchronous_ = true; - } - } else if (testmode_ == pending_subscription_test::test_mode_e::UNSUBSCRIBE) { - static int count_subscribe = 0; - static int count_unsubscribe = 0; - _subscribed ? count_subscribe++ : count_unsubscribe++; - if (count_subscribe == 1) { - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - } - _cbk(true); - if (count_subscribe == 2 || count_unsubscribe == 1) { - subscription_accepted_asynchronous_ = true; - } - } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK) { - static int count_subscribe = 0; - static int count_unsubscribe = 0; - _subscribed ? count_subscribe++ : count_unsubscribe++; - if (count_subscribe == 1) { - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - } - if (_subscribed) { - _cbk((count_subscribe % 2)); // nack every second subscription - } else { - _cbk(true); - } - if (count_subscribe == 8 || count_unsubscribe == 7) { - subscription_accepted_asynchronous_ = true; - } - } - } - - bool subscription_handler(vsomeip::client_t _client, bool _subscribed) { - (void)_subscribed; - bool ret(false); - VSOMEIP_WARNING << __func__ << " " << std::hex << _client << " subscribed. " << _subscribed; - if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE) { - static int was_called = 0; - was_called++; - EXPECT_EQ(1, was_called); - EXPECT_TRUE(_subscribed); - subscription_accepted_synchronous_ = true; - ret = true; - } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE) { - 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 == 8 && count_unsubscribe == 7) { - subscription_accepted_synchronous_ = true; - } - ret = true; - } else if (testmode_ == pending_subscription_test::test_mode_e::UNSUBSCRIBE) { - 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 == 2 && count_unsubscribe == 1) { - subscription_accepted_synchronous_ = true; - } - ret = true; - } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK) { - 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 == 8 && count_unsubscribe == 7) { - subscription_accepted_synchronous_ = true; - } - if (_subscribed) { - ret = (count_subscribed % 2); // nack every second subscription - } else { - ret = true; - } - } - return ret; - } - -private: - struct pending_subscription_test::service_info service_info_; - pending_subscription_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> subscription_accepted_asynchronous_; - std::atomic<bool> subscription_accepted_synchronous_; - std::thread offer_thread_; - std::function<void(const bool)> async_subscription_handler_; - std::promise<bool> notify_method_called_; -}; - -pending_subscription_test::test_mode_e its_testmode(pending_subscription_test::test_mode_e::SUBSCRIBE); - -TEST(someip_pending_subscription_test, block_subscription_handler) -{ - pending_subscription_test_service its_sample(pending_subscription_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] << " SUBSCRIBE" << std::endl; - std::cerr << "Testmodes are [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE]" << std::endl; - exit(1); - } - - std::string its_pased_testmode = argv[1]; - if (its_pased_testmode == std::string("SUBSCRIBE")) { - its_testmode = pending_subscription_test::test_mode_e::SUBSCRIBE; - } else if (its_pased_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE")) { - its_testmode = pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE; - } else if (its_pased_testmode == std::string("UNSUBSCRIBE")) { - its_testmode = pending_subscription_test::test_mode_e::UNSUBSCRIBE; - } else if (its_pased_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE_NACK")) { - its_testmode = pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK; - } - - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/readme.txt b/test/readme.txt deleted file mode 100644 index 9f7985a..0000000 --- a/test/readme.txt +++ /dev/null @@ -1,522 +0,0 @@ -Configuration Test ------------------- -To start the configuration test from the build directory do: - -./configuration-test -someip ../config/vsomeip-test.json - -The expected output is: - -2015-02-10 08:47:31.503874 [info] Test "HOST ADDRESS" succeeded. -2015-02-10 08:47:31.507609 [info] Test "HAS CONSOLE" succeeded. -2015-02-10 08:47:31.507865 [info] Test "HAS FILE" succeeded. -2015-02-10 08:47:31.508001 [info] Test "HAS DLT" succeeded. -2015-02-10 08:47:31.508143 [info] Test "LOGFILE" succeeded. -2015-02-10 08:47:31.508315 [info] Test "LOGLEVEL" succeeded. -2015-02-10 08:47:31.508456 [info] Test "RELIABLE_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.508593 [info] Test "UNRELIABLE_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.508759 [info] Test "RELIABLE_TEST_1234_0023" succeeded. -2015-02-10 08:47:31.508896 [info] Test "UNRELIABLE_TEST_1234_0023" succeeded. -2015-02-10 08:47:31.509032 [info] Test "RELIABLE_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.509185 [info] Test "UNRELIABLE_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.509330 [info] Test "RELIABLE_TEST_4466_0321" succeeded. -2015-02-10 08:47:31.509467 [info] Test "UNRELIABLE_TEST_4466_0321" succeeded. -2015-02-10 08:47:31.509602 [info] Test "RELIABLE_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.509771 [info] Test "UNRELIABLE_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.509915 [info] Test "ADDRESS_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.510049 [info] Test "MIN_INITIAL_DELAY_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.510354 [info] Test "MAX_INITIAL_DELAY_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.510610 [info] Test "REPETITION_BASE_DELAY_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.513978 [info] Test "REPETITION_MAX_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.514177 [info] Test "CYCLIC_OFFER_DELAY_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.514280 [info] Test "CYCLIC_REQUEST_DELAY_TEST_1234_0022" succeeded. -2015-02-10 08:47:31.514397 [info] Test "MIN_INITIAL_DELAY_TEST_1234_0023" succeeded. -2015-02-10 08:47:31.514618 [info] Test "MAX_INITIAL_DELAY_TEST_1234_0023" succeeded. -2015-02-10 08:47:31.514754 [info] Test "REPETITION_BASE_DELAY_TEST_1234_0023" succeeded. -2015-02-10 08:47:31.514901 [info] Test "REPETITION_MAX_TEST_1234_0023" succeeded. -2015-02-10 08:47:31.515052 [info] Test "CYCLIC_OFFER_DELAY_TEST_1234_0023" succeeded. -2015-02-10 08:47:31.515186 [info] Test "CYCLIC_REQUEST_DELAY_TEST_1234_0023" succeeded. -2015-02-10 08:47:31.515325 [info] Test "MIN_INITIAL_DELAY_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.515395 [info] Test "MAX_INITIAL_DELAY_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.515536 [info] Test "REPETITION_BASE_DELAY_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.515691 [info] Test "REPETITION_MAX_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.515834 [info] Test "CYCLIC_OFFER_DELAY_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.515971 [info] Test "CYCLIC_REQUEST_DELAY_TEST_2277_0022" succeeded. -2015-02-10 08:47:31.516109 [info] Test "MIN_INITIAL_DELAY_TEST_2266_0022" succeeded. -2015-02-10 08:47:31.516279 [info] Test "MAX_INITIAL_DELAY_TEST_2266_0022" succeeded. -2015-02-10 08:47:31.516380 [info] Test "REPETITION_BASE_DELAY_TEST_2266_0022" succeeded. -2015-02-10 08:47:31.516512 [info] Test "REPETITION_MAX_TEST_2266_0022" succeeded. -2015-02-10 08:47:31.516610 [info] Test "CYCLIC_OFFER_DELAY_TEST_2266_0022" succeeded. -2015-02-10 08:47:31.516736 [info] Test "CYCLIC_REQUEST_DELAY_TEST_2266_0022" succeeded. -2015-02-10 08:47:31.516874 [info] Test "ADDRESS_TEST_4466_0321" succeeded. -2015-02-10 08:47:31.516974 [info] Test "SERVICE DISCOVERY PROTOCOL" succeeded. -2015-02-10 08:47:31.517106 [info] Test "SERVICE DISCOVERY PORT" succeeded. - - -Application test ----------------- - -This test tests starting and stopping a vsomeip application in various ways. - -Automatic start from build directory: - -ctest -V -R application_test - -Manual start from sub folder test of build directory: - -./application_test_starter.sh - - -Magic Cookies Test ------------------- -To run the magic cookies test you need two devices on the same network. The network addresses within -the configuration files need to be adapted to match the devices addresses. - -To start the magic-cookies-test from the build-directory do: - -Automatic start from build directory: - -ctest -V -R magic_cookies_test - -Manual start from sub folder test of build directory: - -# On external host run -./magic_cookies_test_service_start.sh - -# On local host run -./magic_cookies_test_client_start.sh - - -The expected result is an output like this on service side: - -2015-02-10 08:42:07.317695 [info] Received a message with Client/Session [1343/0001] -2015-02-10 08:42:07.360105 [error] Detected Magic Cookie within message data. Resyncing. -2015-02-10 08:42:07.360298 [info] Received a message with Client/Session [1343/0003] -2015-02-10 08:42:07.360527 [error] Detected Magic Cookie within message data. Resyncing. -2015-02-10 08:42:07.360621 [error] Detected Magic Cookie within message data. Resyncing. -2015-02-10 08:42:07.360714 [info] Received a message with Client/Session [1343/0006] -2015-02-10 08:42:07.360850 [info] Received a message with Client/Session [1343/0007] -2015-02-10 08:42:07.361021 [error] Detected Magic Cookie within message data. Resyncing. -2015-02-10 08:42:07.361107 [error] Detected Magic Cookie within message data. Resyncing. -2015-02-10 08:42:07.361191 [error] Detected Magic Cookie within message data. Resyncing. -2015-02-10 08:42:07.361276 [info] Received a message with Client/Session [1343/000b] -2015-02-10 08:42:07.361434 [info] Received a message with Client/Session [1343/000c] -2015-02-10 08:42:07.361558 [info] Received a message with Client/Session [1343/000d] -2015-02-10 08:42:07.361672 [error] Detected Magic Cookie within message data. Resyncing. -2015-02-10 08:42:07.361761 [info] Received a message with Client/Session [1343/000f] - -Header Factory Tests --------------------- - -The following things are tested: -a) create request - --> check "Protocol Version" / "Message Type" / "Return Type" fields -b) create request, fill header, create response - --> compare header fields of request & response -c) create notification - --> check "Protocol Version" / "Message Type" / "Return Type" fields -d) create message, fill header (service/instance/method/interface version/message type) - --> send message 10 times - --> receive message and check client id / session id - -a) to c) are combined in one binary. d) is composed out of a client and service. - -To start the header factory tests from the build directory do: - -Automatic start from build directory: -ctest -V -R header_factory_test - -Manual start from build directory: -cd test -./header_factory_test -# Start client and service separately -./header_factory_test_service_start.sh & -./header_factory_test_client_start.sh -# Alternatively start client and service with one script -./header_factory_test_send_receive_starter.sh - -All tests should be marked as "passed". - -Routing Tests -------------- - -The following things are tested: -a) create a service instance - - check that it is accessible from a local client but invisible for an external client -b) create a service instance, configure it to be externally visible - - check that it is accessible from a local client and from a external client - -a) and b) are composed out of a service each and one common client binary which is used -with different configuration files. - -Automatic start from build directory: - -ctest -V -R local_routing_test - -A message will be shown when the external client should be started. - -Manual start from build directory: -cd test -# First part with local client -# Start client and service with one script -./local_routing_test_starter.sh - -# Alternatively start client and service separately -# Warning some checks are done within the *_starter.sh script. -# This should only be used for debugging -# Start the service -./local_routing_test_service_start.sh & -# Start the client -./local_routing_test_client_start.sh - -# Second part with external client -# Start client and service with one script -./external_local_routing_test_starter.sh -# Start the external client from an external host when the message is displayed to start it -./external_local_routing_test_client_external_start.sh - -# Alternatively start client and service separately -# Warning some checks are done within the *_starter.sh script. -# This should only be used for debugging -# Start the service -./external_local_routing_test_service_start.sh & -# Start the client -./local_routing_test_client_start.sh -# Start the external client from an external host after local client has finished -./external_local_routing_test_client_external_start.sh - - -All tests should be marked as "passed". - -Payload Tests -------------- - -The following things are tested: -a) create a local service - - send messages with payloads of different size from a local client to the service - - check that the messages are received correctly - - measure the throughput -b) create a service instance, configure it to be externally visible - - send messages with payloads of different size from a local client to the service - - check that the messages are received correctly - - measure the throughput -c) create a service instance, configure it to be externally visible - - send messages with payloads of different size from an external client to the service - - check that the messages are received correctly - - measure the throughput -d) create a service instance, configure it to be externally visible - - send messages with payloads of different size from a local client to the service - - send messages with payloads of different size from an external client to the service - - check that the messages are received correctly - - measure the throughput - -The tests a) to d) are composed out of a service and a client binary which are called -with different configuration files and parameters. - -Automatic start from build directory: - -ctest -V -R payload_test - -A message will be shown when the external clients should be started. - -Manual start from build directory: -cd test - -# First part with local client -# start client and service with one script -./local_payload_test_starter.sh - -# Alternatively start client and service separately -# Warning some checks are done within the *_starter.sh script. -# This should only be used for debugging -./local_payload_test_service_start.sh & -./local_payload_test_client_start.sh - -# Second part with external visible service and local client -# start client and service with one script -./external_local_payload_test_client_local_starter.sh - -# Alternatively start client and service separately -# Warning some checks are done within the *_starter.sh script. -# This should only be used for debugging -./external_local_payload_test_service_start.sh & -./external_local_payload_test_client_local_start.sh - -# Third part with external visible service and external client -# start client and service with one script -./external_local_payload_test_client_external_starter.sh -# Start the external client from an external host if asked to -./external_local_payload_test_client_external_start.sh - -# Alternatively start client and service separately -# Warning some checks are done within the *_starter.sh script. -# This should only be used for debugging -./external_local_payload_test_service_client_external_start.sh -# Start the external client from an external host -./external_local_payload_test_client_external_start.sh - -# Fourth part with external visible service and local and external client -# start client and service with one script -./external_local_payload_test_client_local_and_external_starter.sh -# Start the external client from an external host if asked to -./external_local_payload_test_client_external_start.sh - -# Alternatively start client and service separately -# Warning some checks are done within the *_starter.sh script. -# This should only be used for debugging -./external_local_payload_test_service_client_external_start.sh & -# Start the local client -VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local \ -VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json \ -./payload_test_client --dont-shutdown-service -# Start the external client after the local client is finished from an -# external host -./external_local_payload_test_client_external_start.sh - -All tests should be marked as "passed". - - -Big payload tests ------------------ - -This test tests the possibility to sent messages with bigger payloads -for local and TCP communication. - -The test will send a messages with 600k payload from a client to a service. -The service will reply with a response containing 600k payload as well. -This is repeated 10 times. -There is a version for local and for TCP communication available. -Additionally there are test versions available which sent up to 10MiB big -messages and a version which tests the limitiation of message sizes configurable -via json file. - -Automatic start from the build directory: - -ctest -V -R big_payload_test_local - -Manual start from sub folder test of build directory: - -./big_payload_test_service_local_start.sh & -./big_payload_test_client_local_start.sh - - -Automatic start of the TCP version from the build directory: - -ctest -V -R big_payload_test_external - -Manual start from sub folder test of build directory: - -./big_payload_test_client_start.sh - -# On external host run -./big_payload_test_service_external_start.sh - - -Client ID tests ---------------- - -This tests tests communication over two nodes with multiple services on both -nodes. - -The test setup is as followed: -* There are six services with one method each. -* Three of the services run on node 1. -* Three of the services run on node 2. -* Each of the services sends ten requests to the other services and waits - until it received a response for every request. -* If all responses have been received, the service shutdown. - -Automatic start from the build directory: - -ctest -V -R client_id_test_diff_client_ids_diff_ports - -Manual start from sub folder test of build directory: - -./client_id_test_master_starter.sh client_id_test_diff_client_ids_diff_ports_master.json - -Second version where all services on one node use the same port: - -Automatic start from the build directory: - -ctest -V -R client_id_test_diff_client_ids_same_ports - -Manual start from sub folder test of build directory: - -./client_id_test_master_starter.sh client_id_test_diff_client_ids_same_ports_master.json - - -Subscribe notify tests ----------------------- -This tests tests subscribe notify mechanism over two nodes with multiple services -on both nodes. - -The test setup is as followed: -* There are six services offering one event each. -* Three of the services run on node 1. -* Three of the services run on node 2. -* Each of the services waits until all other services are available. -* Each of the services subscribes to the offered event of all the other services. -* Each of the services then waits until the other services have subscribed to - its event. -* Each of the services then starts to sent out ten notifications for its event. -* Each service waits until it received the correct amount of notifications from - all other services. -* If all notifications have been received, the service shuts down. - -Automatic start from the build directory (example): - -ctest -V -R subscribe_notify_test_diff_client_ids_diff_ports_udp - -Manual start from sub folder test of build directory: - -./subscribe_notify_test_master_starter.sh UDP subscribe_notify_test_diff_client_ids_diff_ports_master.json - -There are multiple versions of this test which differ in the used subscription -method and port setup (use ctest -N to see all). For manual start the desired -description method has to be passed to the starter script as first parameter. - -The subscribe_notify_test_one_event_two_eventgroups_* tests are testing the -requirement that for events which are member of multiple eventgroups initial -events shall be sent per eventgroup. However normal updates of the event should -be sent only once even if a remote subscriber is subscribed to multiple of the -event's eventgroups (TR_SOMEIP_00570). - - -CPU load test -------------- -This test does a increasing number of synchronous function calls to the same -method of the service and measures CPU load for each batch of function calls. -All method calls transport a payload of 40 Bytes. The responses don't transport -any payload. - -The CPU load is measured thorugh the proc fs. -If the test prints a message like: - - Synchronously sent 0890 messages. CPU load [%]: 12.68 - -This means that the test process consumed 12% of the jiffies consumed by -complete system while doing 890 methodcalls. - -Automatic start from the build directory (example): - -ctest -V -R cpu_load_test - - -Initial event tests ----------------------- -This tests tests initial event mechanism over two nodes with multiple services -on both nodes. - -The test setup is as followed: -* There are six services offering one event each. -* Three of the services run on node 1. -* Three of the services run on node 2. -* All of the services initially set their event to their service id and notify - once -* On each node there are 20 client applications which subscribe to all of the - services events which are started at different times -* Each client waits until it received one notification (the initial one) from - all services and then exits. -* If all clients exited, the services are killed as well - -Automatic start from the build directory (example): - -ctest -V -R initial_event_test_diff_client_ids_diff_ports_udp - -Manual start from sub folder test of build directory: -./initial_event_test_master_starter.sh UDP initial_event_test_diff_client_ids_diff_ports_master.json - -There are multiple versions of this test which differ in the used subscription -method and port setup (use ctest -N to see all). For manual start the desired -description method has to be passed to the starter script as first parameter. - -Offer tests ------------ -This tests test various cases of offering a service and error recovery -after an application became unresponsive - -* Rejecting offer of service instance whose hosting application is - still alive. -* Rejecting offer of service instance whose hosting application is - still alive with daemon -* Accepting offer of service instance whose hosting application - crashed with (send SIGKILL) -* Accepting offer of service instance whose hosting application became - unresponsive (SIGSTOP) -* Rejecting offers for which there is already a pending offer -* Rejecting remote offer for which there is already a local offer -* Rejecting a local offer for which there is already a remote offer - -Automatic start from the build directory (example): - -ctest -V -R offer_tests - -Manual start from sub folder test of build directory: -./offer_test_local_starter -./offer_test_external_master_starter.sh - -Tests in detail: -Rejecting offer of service instance whose hosting application is still -alive: -* start application which offers service -* start client which continuously exchanges messages with the service -* start application which offers the same service again -> should be - rejected and an error message should be printed. -* Message exchange with client application should not be interrupted. - -Rejecting offer of service instance whose hosting application is still -alive with daemon -* start daemon (needed as he has to ping the offering client) -* start application which offers service -* start client which continuously exchanges messages with the service -* start application which offers the same service again -> should be - rejected and an error message should be printed. -* Message exchange with client application should not be interrupted. - -Accepting offer of service instance whose hosting application crashed -with (send SIGKILL) -* start daemon -* start application which offers service -* start client which exchanges messages with the service -* kill application with SIGKILL -* start application which offers the same service again -> should be - accepted. -* start another client which exchanges messages with the service -* Client should now communicate with new offerer. - -Accepting offer of service instance whose hosting application became -unresponsive (SIGSTOP) -* start daemon -* start application which offers service -* Send a SIGSTOP to the service to make it unresponsive -* start application which offers the same service again -> should be - marked as PENDING_OFFER and a ping should be sent to the paused - application. -* After the timeout passed the new offer should be accepted. -* start client which exchanges messages with the service -* Client should now communicate with new offerer. - -Rejecting offers for which there is already a pending offer -* start daemon -* start application which offers service -* Send a SIGSTOP to the service to make it unresponsive -* start application which offers the same service again -> should be - marked as PENDING_OFFER and a ping should be sent to the paused - application. -* start application which offers the same service again -> should be - rejected as there is already a PENDING_OFFER pending. -* After the timeout passed the new offer should be accepted. -* start client which exchanges messages with the service -* Client should now communicate with new offerer. - -Rejecting a local offer for which there is already a remote offer: -* start daemon -* start application which offers service -* start daemon remotely -* start same application which offers the same service again remotely - -> should be rejected as there is already a service instance - running in the network - -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 diff --git a/test/restart_routing_tests/restart_routing_test_autoconfig.json b/test/restart_routing_tests/restart_routing_test_autoconfig.json deleted file mode 100644 index f50dba7..0000000 --- a/test/restart_routing_tests/restart_routing_test_autoconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "netmask" : "255.255.255.0", - "logging" : - { - "level" : "warning", - "console" : "true", - "file" : - { - "enable" : "true", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "true" - }, - - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30491", - "protocol" : "udp" - } -} diff --git a/test/restart_routing_tests/restart_routing_test_client.cpp b/test/restart_routing_tests/restart_routing_test_client.cpp deleted file mode 100644 index a8c0acc..0000000 --- a/test/restart_routing_tests/restart_routing_test_client.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// 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 "restart_routing_test_client.hpp" - -routing_restart_test_client::routing_restart_test_client() - : app_(vsomeip::runtime::get()->create_application()), - is_available_(false), - sender_(std::bind(&routing_restart_test_client::run, this)), - received_responses_(0) { - -} - -bool routing_restart_test_client::init() { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - - app_->register_state_handler( - std::bind(&routing_restart_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD, - std::bind(&routing_restart_test_client::on_message, this, - std::placeholders::_1)); - - app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - std::bind(&routing_restart_test_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - return true; -} - -void routing_restart_test_client::start() { - VSOMEIP_INFO << "Starting..."; - - app_->start(); -} - -void routing_restart_test_client::stop() { - VSOMEIP_INFO << "Stopping..."; - - shutdown_service(); - - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - app_->clear_all_handler(); - app_->stop(); -} - -void routing_restart_test_client::on_state(vsomeip::state_type_e _state) { - if(_state == vsomeip::state_type_e::ST_REGISTERED) { - app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); - } -} - -void routing_restart_test_client::on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available) { - - VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() - << " : Service [" << std::setw(4) << std::setfill('0') << std::hex - << _service << "." << _instance << "] is " - << (_is_available ? "available." : "NOT available."); - - if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service - && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) { - std::unique_lock<std::mutex> its_lock(mutex_); - if(is_available_ && !_is_available) { - is_available_ = false; - } - else if(_is_available && !is_available_) { - is_available_ = true; - condition_.notify_one(); - } - } -} - -void routing_restart_test_client::on_message(const std::shared_ptr<vsomeip::message> &_response) { - VSOMEIP_INFO << "Received a response from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() - << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() - << "]"; - - if (_response->get_service() == vsomeip_test::TEST_SERVICE_SERVICE_ID && - _response->get_instance() == vsomeip_test::TEST_SERVICE_INSTANCE_ID) { - received_responses_++; - 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!"; - } - } -} - -void routing_restart_test_client::run() { - for (uint32_t i = 0; i < vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS; ++i) { - { - std::unique_lock<std::mutex> its_lock(mutex_); - while (!is_available_) - { - condition_.wait(its_lock); - } - } - - auto request = vsomeip::runtime::get()->create_request(false); - 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); - - 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_); - - stop(); -} - -void routing_restart_test_client::join_sender_thread() -{ - if (sender_.joinable()) { - sender_.join(); - } -} - -void routing_restart_test_client::shutdown_service() { - auto request = vsomeip::runtime::get()->create_request(false); - 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); -} - -TEST(someip_restart_routing_test, request_response_over_restart) -{ - routing_restart_test_client test_client; - if (test_client.init()) { - test_client.start(); - test_client.join_sender_thread(); - } -} - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/restart_routing_tests/restart_routing_test_client.hpp b/test/restart_routing_tests/restart_routing_test_client.hpp deleted file mode 100644 index fdc56d4..0000000 --- a/test/restart_routing_tests/restart_routing_test_client.hpp +++ /dev/null @@ -1,50 +0,0 @@ - -// 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/. - -#ifndef RESTART_ROUTING_TEST_CLIENT_HPP -#define RESTART_ROUTING_TEST_CLIENT_HPP - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include "../someip_test_globals.hpp" - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <atomic> - -class routing_restart_test_client { -public: - routing_restart_test_client(); - bool init(); - void start(); - void stop(); - - void on_state(vsomeip::state_type_e _state); - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available); - void on_message(const std::shared_ptr<vsomeip::message> &_response); - - void run(); - void join_sender_thread(); - -private: - void shutdown_service(); - - std::shared_ptr<vsomeip::application> app_; - - std::mutex mutex_; - std::condition_variable condition_; - bool is_available_; - - std::thread sender_; - - std::atomic<std::uint32_t> received_responses_; -}; - -#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 deleted file mode 100644 index 0d901d8..0000000 --- a/test/restart_routing_tests/restart_routing_test_client.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "netmask" : "255.255.255.0", - "logging" : - { - "level" : "warning", - "console" : "true", - "file" : - { - "enable" : "true", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "true" - }, - - "applications" : - [ - { - "name" : "restart_routing_test_client1", - "id" : "0x1343" - }, - { - "name" : "restart_routing_test_client2", - "id" : "0x1344" - }, - { - "name" : "restart_routing_test_client3", - "id" : "0x1345" - }, - { - "name" : "restart_routing_test_client4", - "id" : "0x1346" - } - ], - "services" : - [ - ], - - "routing" : "vsomeipd", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30491", - "protocol" : "udp" - } -} diff --git a/test/restart_routing_tests/restart_routing_test_client_start.sh b/test/restart_routing_tests/restart_routing_test_client_start.sh deleted file mode 100755 index de944b9..0000000 --- a/test/restart_routing_tests/restart_routing_test_client_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client diff --git a/test/restart_routing_tests/restart_routing_test_service.cpp b/test/restart_routing_tests/restart_routing_test_service.cpp deleted file mode 100644 index cf4bba1..0000000 --- a/test/restart_routing_tests/restart_routing_test_service.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// 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 "restart_routing_test_service.hpp" - -routing_restart_test_service::routing_restart_test_service() : - app_(vsomeip::runtime::get()->create_application()), - is_registered_(false), - blocked_(false), - number_of_received_messages_(0), - offer_thread_(std::bind(&routing_restart_test_service::run, this)) { -} - -bool routing_restart_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(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID, - std::bind(&routing_restart_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN, - std::bind(&routing_restart_test_service::on_message_shutdown, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&routing_restart_test_service::on_state, this, - std::placeholders::_1)); - return true; -} - -void routing_restart_test_service::start() { - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void routing_restart_test_service::stop() { - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); -} - -void routing_restart_test_service::join_offer_thread() { - if (offer_thread_.joinable()) { - offer_thread_.join(); - } -} - -void routing_restart_test_service::offer() { - app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void routing_restart_test_service::stop_offer() { - app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void routing_restart_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 routing_restart_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request) { - ASSERT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _request->get_service()); - ASSERT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _request->get_method()); - - 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() << "]"; - - // 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_ROUTING_RESTART_TESTS) { - VSOMEIP_INFO << "Received all messages!"; - } -} - -void routing_restart_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 routing_restart_test_service::run() { - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - condition_.wait(its_lock); - - offer(); -} - -TEST(someip_restart_routing_test, send_response_for_every_request) { - routing_restart_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/restart_routing_tests/restart_routing_test_service.hpp b/test/restart_routing_tests/restart_routing_test_service.hpp deleted file mode 100644 index 3abfe17..0000000 --- a/test/restart_routing_tests/restart_routing_test_service.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// 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/. - -#ifndef RESTART_ROUTING_TEST_SERVICE_HPP -#define RESTART_ROUTING_TEST_SERVICE_HPP - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include "../someip_test_globals.hpp" - -#include <thread> -#include <mutex> -#include <condition_variable> - -class routing_restart_test_service { -public: - routing_restart_test_service(); - bool init(); - void start(); - void stop(); - void offer(); - void stop_offer(); - void join_offer_thread(); - void on_state(vsomeip::state_type_e _state); - void on_message(const std::shared_ptr<vsomeip::message> &_request); - void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - std::uint32_t number_of_received_messages_; - std::thread offer_thread_; -}; - -#endif // RESTART_ROUTING_TEST_SERVICE_HPP diff --git a/test/restart_routing_tests/restart_routing_test_service.json b/test/restart_routing_tests/restart_routing_test_service.json deleted file mode 100644 index 8ff90cb..0000000 --- a/test/restart_routing_tests/restart_routing_test_service.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "logging" : - { - "level" : "warning", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "vsomeipd", - "id" : "0x0815" - }, - { - "name" : "restart_routing_test_service", - "id" : "0x1277" - } - ], - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ], - - "routing" : "vsomeipd", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} diff --git a/test/restart_routing_tests/restart_routing_test_service_start.sh b/test/restart_routing_tests/restart_routing_test_service_start.sh deleted file mode 100755 index b82be7c..0000000 --- a/test/restart_routing_tests/restart_routing_test_service_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=restart_routing_test_service -export VSOMEIP_CONFIGURATION=restart_routing_test_service.json -./restart_routing_test_service diff --git a/test/restart_routing_tests/restart_routing_test_starter.sh b/test/restart_routing_tests/restart_routing_test_starter.sh deleted file mode 100755 index 0778e98..0000000 --- a/test/restart_routing_tests/restart_routing_test_starter.sh +++ /dev/null @@ -1,312 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# NOW WITHOUT JSON -echo "----------------------------------------------" -echo "----------------------------------------------" -echo " Run test with auto configuration " -echo "----------------------------------------------" -echo "----------------------------------------------" - -export VSOMEIP_CONFIGURATION=restart_routing_test_autoconfig.json - -../daemon/./vsomeipd & -DAEMON_PID=$! - -sleep 2 - -# Start the service -export VSOMEIP_APPLICATION_NAME=restart_routing_test_service -./restart_routing_test_service & -SERIVCE_PID=$! - -# Start the client1 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client1 -./restart_routing_test_client & -CLIENT1_PID=$! - -# Start the client2 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client2 -./restart_routing_test_client & -CLIENT2_PID=$! - -# Start the client3 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client3 -./restart_routing_test_client & -CLIENT3_PID=$! - -# Start the client4 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client4 -./restart_routing_test_client & -CLIENT4_PID=$! - -sleep 2 -echo "----------------------------------------------" -echo " let vsomeipd crash (kill -9) " -echo "----------------------------------------------" -kill -9 $DAEMON_PID -echo "----------------------------------------------" -echo " restart vsomeipd " -echo "----------------------------------------------" -sleep 2 - -../daemon/./vsomeipd & -DAEMON_PID=$! - -wait $SERIVCE_PID || ((FAIL+=1)) -wait $CLIENT1_PID || ((FAIL+=1)) -wait $CLIENT2_PID || ((FAIL+=1)) -wait $CLIENT3_PID || ((FAIL+=1)) -wait $CLIENT4_PID || ((FAIL+=1)) - -kill $DAEMON_PID -wait $DAEMON_PID - -# Check if client and server both exited sucessfully and the service didnt't -# have any open tcp/udp sockets -if [ $FAIL -eq 0 ] -then - echo "Test Succeeded" -else - exit 1 -fi - -# NOW WITHOUT VSOMEIPD -echo "----------------------------------------------" -echo "----------------------------------------------" -echo " Run test with auto configuration no deamon " -echo "----------------------------------------------" -echo "----------------------------------------------" - -sleep 2 - -# Start the service -export VSOMEIP_APPLICATION_NAME=restart_routing_test_service -./restart_routing_test_service & -SERIVCE_PID=$! - -# Start the client1 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client1 -./restart_routing_test_client & -CLIENT1_PID=$! - -# Start the client2 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client2 -./restart_routing_test_client & -CLIENT2_PID=$! - -# Start the client3 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client3 -./restart_routing_test_client & -CLIENT3_PID=$! - -# Start the client4 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client4 -./restart_routing_test_client & -CLIENT4_PID=$! - -sleep 2 -echo "----------------------------------------------" -echo " let service (routing) crash (kill -9) " -echo "----------------------------------------------" -kill -9 $SERIVCE_PID -echo "----------------------------------------------" -echo " restart service (routing) " -echo "----------------------------------------------" -sleep 2 - -# Start the service -export VSOMEIP_APPLICATION_NAME=restart_routing_test_service -./restart_routing_test_service & -SERIVCE_PID=$! - -wait $SERIVCE_PID || ((FAIL+=1)) -wait $CLIENT1_PID || ((FAIL+=1)) -wait $CLIENT2_PID || ((FAIL+=1)) -wait $CLIENT3_PID || ((FAIL+=1)) -wait $CLIENT4_PID || ((FAIL+=1)) - -# Check if client and server both exited sucessfully and the service didnt't -# have any open tcp/udp sockets -if [ $FAIL -eq 0 ] -then - echo "Test Succeeded" -else - exit 1 -fi - - -echo "----------------------------------------------" -echo "----------------------------------------------" -echo " Run test with json configuration " -echo "----------------------------------------------" -echo "----------------------------------------------" - -sleep 2 - -export VSOMEIP_CONFIGURATION=restart_routing_test_service.json -../daemon/./vsomeipd & -DAEMON_PID=$! - -# Start the service -export VSOMEIP_APPLICATION_NAME=restart_routing_test_service -export VSOMEIP_CONFIGURATION=restart_routing_test_service.json -./restart_routing_test_service & -SERIVCE_PID=$! - -# Start the client1 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client1 -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client & -CLIENT1_PID=$! - -# Start the client2 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client2 -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client & -CLIENT2_PID=$! - -# Start the client3 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client3 -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client & -CLIENT3_PID=$! - -# Start the client4 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client4 -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client & -CLIENT4_PID=$! - -sleep 2 -echo "----------------------------------------------" -echo " let vsomeipd crash (kill -9) " -echo "----------------------------------------------" -kill -9 $DAEMON_PID -echo "----------------------------------------------" -echo " restart vsomeipd " -echo "----------------------------------------------" -sleep 2 - -export VSOMEIP_CONFIGURATION=restart_routing_test_service.json -../daemon/./vsomeipd & -DAEMON_PID=$! - -wait $SERIVCE_PID || ((FAIL+=1)) -wait $CLIENT1_PID || ((FAIL+=1)) -wait $CLIENT2_PID || ((FAIL+=1)) -wait $CLIENT3_PID || ((FAIL+=1)) -wait $CLIENT4_PID || ((FAIL+=1)) - -kill $DAEMON_PID -wait $DAEMON_PID - -# Check if client and server both exited sucessfully and the service didnt't -# have any open tcp/udp sockets -if [ $FAIL -eq 0 ] -then - echo "Test Succeeded" -else - exit 1 -fi - -echo "----------------------------------------------" -echo "----------------------------------------------" -echo "Run test with json configuration + kill service" -echo "----------------------------------------------" -echo "----------------------------------------------" - -sleep 2 - -export VSOMEIP_CONFIGURATION=restart_routing_test_service.json -../daemon/./vsomeipd & -DAEMON_PID=$! - -# Start the service -export VSOMEIP_APPLICATION_NAME=restart_routing_test_service -export VSOMEIP_CONFIGURATION=restart_routing_test_service.json -./restart_routing_test_service & -SERIVCE_PID=$! - -# Start the client1 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client1 -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client & -CLIENT1_PID=$! - -# Start the client2 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client2 -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client & -CLIENT2_PID=$! - -# Start the client3 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client3 -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client & -CLIENT3_PID=$! - -# Start the client4 -export VSOMEIP_APPLICATION_NAME=restart_routing_test_client4 -export VSOMEIP_CONFIGURATION=restart_routing_test_client.json -./restart_routing_test_client & -CLIENT4_PID=$! - -sleep 2 -echo "----------------------------------------------" -echo " let vsomeipd crash (kill -9) " -echo "----------------------------------------------" -kill -9 $DAEMON_PID -sleep 1 -echo "----------------------------------------------" -echo " let service crash (kill -9) " -echo "----------------------------------------------" -kill -9 $SERIVCE_PID -echo "----------------------------------------------" -echo " restart vsomeipd " -echo "----------------------------------------------" -sleep 2 - -export VSOMEIP_CONFIGURATION=restart_routing_test_service.json -../daemon/./vsomeipd & -DAEMON_PID=$! - -echo "----------------------------------------------" -echo " restart service " -echo "----------------------------------------------" -sleep 1 - -# Start the service again -export VSOMEIP_APPLICATION_NAME=restart_routing_test_service -export VSOMEIP_CONFIGURATION=restart_routing_test_service.json -./restart_routing_test_service & -SERIVCE_PID=$! - -wait $SERIVCE_PID || ((FAIL+=1)) -wait $CLIENT1_PID || ((FAIL+=1)) -wait $CLIENT2_PID || ((FAIL+=1)) -wait $CLIENT3_PID || ((FAIL+=1)) -wait $CLIENT4_PID || ((FAIL+=1)) - -kill $DAEMON_PID -wait $DAEMON_PID - -# Check if client and server both exited sucessfully and the service didnt't -# have any open tcp/udp sockets -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/routing_tests/conf/external_local_routing_test_client_external.json.in b/test/routing_tests/conf/external_local_routing_test_client_external.json.in deleted file mode 100644 index 958f196..0000000 --- a/test/routing_tests/conf/external_local_routing_test_client_external.json.in +++ /dev/null @@ -1,44 +0,0 @@ -{ - "unicast" : "@TEST_IP_SLAVE@", - "netmask" : "255.255.255.0", - "diagnosis" : "0x16", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "true", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "true" - }, - - "applications" : - [ - { - "name" : "external_local_routing_test_client_external", - "id" : "0x1644" - } - ], - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678", - "unicast" : "@TEST_IP_MASTER@", - "unreliable" : "30509" - } - ], - - "routing" : "external_local_routing_test_client_external", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30491", - "protocol" : "udp" - } -} diff --git a/test/routing_tests/conf/external_local_routing_test_service.json.in b/test/routing_tests/conf/external_local_routing_test_service.json.in deleted file mode 100644 index a4deb82..0000000 --- a/test/routing_tests/conf/external_local_routing_test_service.json.in +++ /dev/null @@ -1,42 +0,0 @@ -{ - "unicast" : "@TEST_IP_MASTER@", - "diagnosis":"0x12", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "external_local_routing_test_service", - "id" : "0x1277" - } - ], - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678", - "unreliable" : "30509" - } - ], - - "routing" : "external_local_routing_test_service", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} diff --git a/test/routing_tests/conf/local_routing_test_starter.sh.bat.in b/test/routing_tests/conf/local_routing_test_starter.sh.bat.in deleted file mode 100755 index ca8582f..0000000 --- a/test/routing_tests/conf/local_routing_test_starter.sh.bat.in +++ /dev/null @@ -1,69 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# Parameter 1: the pid to check -check_tcp_udp_sockets_are_closed () -{ - # Check that the service does not listen on any TCP/UDP socket - # or has any active connection via a TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] - then - ((FAIL+=1)) - fi - - SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] - then - ((FAIL+=1)) - fi -} - -# Start the service -export VSOMEIP_APPLICATION_NAME=local_routing_test_service -export VSOMEIP_CONFIGURATION=local_routing_test_service.json -./local_routing_test_service & -SERIVCE_PID=$! -sleep 1; - -check_tcp_udp_sockets_are_closed $SERIVCE_PID - -# Start the client -export VSOMEIP_APPLICATION_NAME=local_routing_test_client -export VSOMEIP_CONFIGURATION=local_routing_test_client.json -./local_routing_test_client & -CLIENT_PID=$! - -check_tcp_udp_sockets_are_closed $SERIVCE_PID -check_tcp_udp_sockets_are_closed $CLIENT_PID - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if client and server both exited successfully and the service didnt't -# have any open -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/routing_tests/conf/local_routing_test_starter.sh.in b/test/routing_tests/conf/local_routing_test_starter.sh.in deleted file mode 100755 index 457c60c..0000000 --- a/test/routing_tests/conf/local_routing_test_starter.sh.in +++ /dev/null @@ -1,79 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# Parameter 1: the pid to check -check_tcp_udp_sockets_are_closed () -{ - # Check that the service does not listen on any TCP/UDP socket - # or has any active connection via a TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] - then - ((FAIL+=1)) - fi - - SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] - then - ((FAIL+=1)) - fi -} - -export VSOMEIP_CONFIGURATION=local_routing_test_service.json -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! - -WAIT_PIDS=() -# Start the service -export VSOMEIP_APPLICATION_NAME=local_routing_test_service -./local_routing_test_service & -SERIVCE_PID=$! -WAIT_PIDS+=($!) -sleep 1; - -check_tcp_udp_sockets_are_closed $SERIVCE_PID - -# Start the client -export VSOMEIP_APPLICATION_NAME=local_routing_test_client -export VSOMEIP_CONFIGURATION=local_routing_test_client.json -./local_routing_test_client & -CLIENT_PID=$! -WAIT_PIDS+=($!) - -check_tcp_udp_sockets_are_closed $SERIVCE_PID -check_tcp_udp_sockets_are_closed $CLIENT_PID - -# Wait until client and service are finished -for job in ${WAIT_PIDS[*]} -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -kill $PID_VSOMEIPD -sleep 1 - -# Check if client and server both exited successfully and the service didnt't -# have any open -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/routing_tests/external_local_routing_test_client_external_start.sh b/test/routing_tests/external_local_routing_test_client_external_start.sh deleted file mode 100755 index b267b47..0000000 --- a/test/routing_tests/external_local_routing_test_client_external_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=external_local_routing_test_client_external -export VSOMEIP_CONFIGURATION=external_local_routing_test_client_external.json -./local_routing_test_client diff --git a/test/routing_tests/external_local_routing_test_service.cpp b/test/routing_tests/external_local_routing_test_service.cpp deleted file mode 100644 index ce8b9ef..0000000 --- a/test/routing_tests/external_local_routing_test_service.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// 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 "external_local_routing_test_service.hpp" - -external_local_routing_test_service::external_local_routing_test_service(bool _use_static_routing) : - app_(vsomeip::runtime::get()->create_application()), - is_registered_(false), - use_static_routing_(_use_static_routing), - blocked_(false), - number_received_messages_local_(0), - number_received_messages_external_(0), - offer_thread_(std::bind(&external_local_routing_test_service::run, this)) -{ -} - -bool external_local_routing_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(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID, - std::bind(&external_local_routing_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID, - std::bind(&external_local_routing_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&external_local_routing_test_service::on_state, this, - std::placeholders::_1)); - - VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF"); - return true; -} - -void external_local_routing_test_service::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void external_local_routing_test_service::stop() -{ - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); -} - -void external_local_routing_test_service::join_offer_thread() -{ - offer_thread_.join(); -} - -void external_local_routing_test_service::offer() -{ - app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void external_local_routing_test_service::stop_offer() -{ - app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void external_local_routing_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; - } -} - -void external_local_routing_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() << "]"; - - ASSERT_EQ(_request->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID); - ASSERT_EQ(_request->get_method(), vsomeip_test::TEST_SERVICE_METHOD_ID); - - // Check the protocol version this shall be set to 0x01 according to the spec. - // TR_SOMEIP_00052 - ASSERT_EQ(_request->get_protocol_version(), 0x01); - // Check the message type this shall be 0xx (REQUEST) according to the spec. - // TR_SOMEIP_00055 - ASSERT_EQ(_request->get_message_type(), vsomeip::message_type_e::MT_REQUEST); - - if(_request->get_client() == vsomeip_test::TEST_CLIENT_CLIENT_ID) - { - number_received_messages_local_++; - // check the session id. - ASSERT_EQ(_request->get_session(), - static_cast<vsomeip::session_t>(number_received_messages_local_)); - } - else if (_request->get_client() == vsomeip_test::TEST_CLIENT_EXTERNAL_CLIENT_ID) - { - number_received_messages_external_++; - // check the session id. - ASSERT_EQ(_request->get_session(), - static_cast<vsomeip::session_t>(number_received_messages_external_)); - } - - // send response - std::shared_ptr<vsomeip::message> its_response = - vsomeip::runtime::get()->create_response(_request); - - app_->send(its_response, true); - - if(number_received_messages_local_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND - && number_received_messages_external_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND) - { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); - } - ASSERT_LT(number_received_messages_local_, - vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1); - ASSERT_LT(number_received_messages_external_, - vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1); -} - -void external_local_routing_test_service::run() -{ - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - condition_.wait(its_lock); - - blocked_ = false; - if(use_static_routing_) - { - offer(); - } - - while (!blocked_) { - condition_.wait(its_lock); - } - - std::thread t2([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 2));}); - t2.join(); - app_->stop(); -} - -TEST(someip_external_local_routing_test, receive_ten_messages_over_local_and_external_socket) -{ - bool use_static_routing = true; - external_local_routing_test_service test_service(use_static_routing); - 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/routing_tests/external_local_routing_test_service.hpp b/test/routing_tests/external_local_routing_test_service.hpp deleted file mode 100644 index a25025e..0000000 --- a/test/routing_tests/external_local_routing_test_service.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// 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/. - -#ifndef EXTERNALLOCALROUTINGTESTSERVICE_HPP_ -#define EXTERNALLOCALROUTINGTESTSERVICE_HPP_ -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> - -#include "../someip_test_globals.hpp" - -class external_local_routing_test_service -{ -public: - external_local_routing_test_service(bool _use_static_routing); - bool init(); - void start(); - void stop(); - void offer(); - void stop_offer(); - void join_offer_thread(); - void on_state(vsomeip::state_type_e _state); - void on_message(const std::shared_ptr<vsomeip::message> &_request); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - bool use_static_routing_; - - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - std::uint32_t number_received_messages_local_; - std::uint32_t number_received_messages_external_; - std::thread offer_thread_; -}; - -#endif /* EXTERNALLOCALROUTINGTESTSERVICE_HPP_ */ diff --git a/test/routing_tests/external_local_routing_test_service_start.sh b/test/routing_tests/external_local_routing_test_service_start.sh deleted file mode 100755 index 81b2ef1..0000000 --- a/test/routing_tests/external_local_routing_test_service_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=external_local_routing_test_service -export VSOMEIP_CONFIGURATION=external_local_routing_test_service.json -./external_local_routing_test_service diff --git a/test/routing_tests/external_local_routing_test_starter.sh b/test/routing_tests/external_local_routing_test_starter.sh deleted file mode 100755 index af94ab6..0000000 --- a/test/routing_tests/external_local_routing_test_starter.sh +++ /dev/null @@ -1,126 +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 client and service with -# one command. This is necessary as ctest - which is used to run the -# tests - isn't able to start two binaries for one testcase. Therefore -# the testcase simply executes this script. This script then runs client -# and service and checks that both exit sucessfully. - -FAIL=0 - -# Parameter 1: the pid to check -check_tcp_udp_sockets_are_open () -{ - # Check that the service does listen on at least one TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -lt 1 ] - then - ((FAIL+=1)) - fi -} - -# Parameter 1: the pid to check -check_tcp_udp_sockets_are_closed () -{ - # Check that the service does not listen on any TCP/UDP socket - # or has any active connection via a TCP/UDP socket - # awk is used to avoid the case when a inode number is the same as a PID. The awk - # program filters the netstat output down to the protocol (1st field) and - # the PID/Program name (last field) fields. - SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_LISTENING -ne 0 ] - then - ((FAIL+=1)) - fi - - SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l) - if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ] - then - ((FAIL+=1)) - fi -} - -# Start the service -export VSOMEIP_APPLICATION_NAME=external_local_routing_test_service -export VSOMEIP_CONFIGURATION=external_local_routing_test_service.json -./external_local_routing_test_service & -SERIVCE_PID=$! -sleep 1; - -check_tcp_udp_sockets_are_open $SERIVCE_PID - -# Start the client (we reuse the one from the local_routing_test to check -# the local routing functionality). -export VSOMEIP_APPLICATION_NAME=local_routing_test_client -export VSOMEIP_CONFIGURATION=local_routing_test_client.json -./local_routing_test_client & -CLIENT_PID=$! - -check_tcp_udp_sockets_are_open $SERIVCE_PID -sleep 1 -check_tcp_udp_sockets_are_closed $CLIENT_PID - -# wait that local client finishes -sleep 2 - -# Display a message to show the user that he must now call the external client -# to finish the test successfully -kill -0 $CLIENT_PID &> /dev/null -CLIENT_STILL_THERE=$? -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\"" & - 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" & - else - cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** external_local_routing_test_client_external_start.sh -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** external_local_routing_test_client_external.json and -** external_local_routing_test_service.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message - fi -fi - -if [ ! -z "$USE_DOCKER" ]; then - FAIL=0 -fi - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - 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 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/routing_tests/local_routing_test_client.cpp b/test/routing_tests/local_routing_test_client.cpp deleted file mode 100644 index 5bd83fe..0000000 --- a/test/routing_tests/local_routing_test_client.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// 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 "local_routing_test_client.hpp" - -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), - number_of_sent_messages_(0), - number_of_acknowledged_messages_(0), - sender_(std::bind(&local_routing_test_client::run, this)) -{ -} - -bool local_routing_test_client::init() -{ - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - - app_->register_state_handler( - std::bind(&local_routing_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD, - std::bind(&local_routing_test_client::on_message, this, - std::placeholders::_1)); - - app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - std::bind(&local_routing_test_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - return true; -} - -void local_routing_test_client::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void local_routing_test_client::stop() -{ - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); -} - -void local_routing_test_client::join_sender_thread(){ - sender_.join(); - - ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_); -} - -void local_routing_test_client::on_state(vsomeip::state_type_e _state) -{ - if(_state == vsomeip::state_type_e::ST_REGISTERED) - { - app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); - } -} - -void local_routing_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 << "." << _instance << "] is " - << (_is_available ? "available." : "NOT available."); - - if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service - && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) - { - if(is_available_ && !_is_available) - { - is_available_ = false; - } - else if(_is_available && !is_available_) - { - is_available_ = true; - send(); - } - } -} - -void local_routing_test_client::on_message(const std::shared_ptr<vsomeip::message>& _response) -{ - VSOMEIP_INFO << "Received a response from Service [" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_session() << "]"; - number_of_acknowledged_messages_++; - if(number_of_acknowledged_messages_ == number_of_messages_to_send_) { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); - } -} - -void local_routing_test_client::send() -{ - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ = true; - condition_.notify_one(); -} - -void local_routing_test_client::run() -{ - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - { - condition_.wait(its_lock); - } - blocked_ = false; - 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); - - for (uint32_t i = 0; i < number_of_messages_to_send_; i++) - { - app_->send(request_, true); - 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() - << "] sent a request to Service [" << std::setw(4) - << std::setfill('0') << std::hex << request_->get_service() - << "." << std::setw(4) << std::setfill('0') << std::hex - << request_->get_instance() << "]"; - number_of_sent_messages_++; - } - blocked_ = false; - // wait until all messages have been acknowledged - while (!blocked_) - { - condition_.wait(its_lock); - } - stop(); -} - -TEST(someip_local_routing_test, send_ten_messages_to_service_and_receive_reply) -{ - bool use_tcp = false; - local_routing_test_client test_client_(use_tcp); - if (test_client_.init()) { - test_client_.start(); - test_client_.join_sender_thread(); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/routing_tests/local_routing_test_client.hpp b/test/routing_tests/local_routing_test_client.hpp deleted file mode 100644 index b135dea..0000000 --- a/test/routing_tests/local_routing_test_client.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// 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/. - -#ifndef LOCALROUTINGTESTCLIENT_HPP_ -#define LOCALROUTINGTESTCLIENT_HPP_ - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> - -#include "../someip_test_globals.hpp" - -class local_routing_test_client -{ -public: - local_routing_test_client(bool _use_tcp); - bool init(); - void start(); - void stop(); - void join_sender_thread(); - void on_state(vsomeip::state_type_e _state); - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available); - void on_message(const std::shared_ptr<vsomeip::message> &_response); - void send(); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - 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_; - std::uint32_t number_of_sent_messages_; - std::uint32_t number_of_acknowledged_messages_; - std::thread sender_; -}; - -#endif /* LOCALROUTINGTESTCLIENT_HPP_ */ diff --git a/test/routing_tests/local_routing_test_client.json b/test/routing_tests/local_routing_test_client.json deleted file mode 100644 index 2b4bdaa..0000000 --- a/test/routing_tests/local_routing_test_client.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "netmask" : "255.255.255.0", - "diagnosis":"0x12", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "true", - "path" : "/var/log/vsomeip.log" - }, - - "dlt" : "true" - }, - - "applications" : - [ - { - "name" : "local_routing_test_client", - "id" : "0x1255" - } - ], - - "services" : - [ - ], - - "routing" : "vsomeipd", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30491", - "protocol" : "udp" - } -}
\ No newline at end of file diff --git a/test/routing_tests/local_routing_test_client_start.sh b/test/routing_tests/local_routing_test_client_start.sh deleted file mode 100755 index ed4023e..0000000 --- a/test/routing_tests/local_routing_test_client_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=local_routing_test_client -export VSOMEIP_CONFIGURATION=local_routing_test_client.json -./local_routing_test_client diff --git a/test/routing_tests/local_routing_test_service.cpp b/test/routing_tests/local_routing_test_service.cpp deleted file mode 100644 index 4f7962d..0000000 --- a/test/routing_tests/local_routing_test_service.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// 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 "local_routing_test_service.hpp" - -local_routing_test_service::local_routing_test_service(bool _use_static_routing) : - app_(vsomeip::runtime::get()->create_application()), - is_registered_(false), - use_static_routing_(_use_static_routing), - blocked_(false), - number_of_received_messages_(0), - offer_thread_(std::bind(&local_routing_test_service::run, this)) -{ -} - -bool local_routing_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(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID, - std::bind(&local_routing_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&local_routing_test_service::on_state, this, - std::placeholders::_1)); - - VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF"); - return true; -} - -void local_routing_test_service::start() -{ - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void local_routing_test_service::stop() -{ - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); -} - -void local_routing_test_service::join_offer_thread() -{ - offer_thread_.join(); -} - -void local_routing_test_service::offer() -{ - app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void local_routing_test_service::stop_offer() -{ - app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void local_routing_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 local_routing_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() << "]"; - - number_of_received_messages_++; - - ASSERT_EQ(_request->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID); - ASSERT_EQ(_request->get_method(), vsomeip_test::TEST_SERVICE_METHOD_ID); - - // Check the protocol version this shall be set to 0x01 according to the spec. - // TR_SOMEIP_00052 - ASSERT_EQ(_request->get_protocol_version(), 0x01); - // Check the message type this shall be 0xx (REQUEST) according to the spec. - // TR_SOMEIP_00055 - ASSERT_EQ(_request->get_message_type(), vsomeip::message_type_e::MT_REQUEST); - - // check the session id. - ASSERT_EQ(_request->get_session(), static_cast<vsomeip::session_t>(number_of_received_messages_)); - - - // send response - std::shared_ptr<vsomeip::message> its_response = - vsomeip::runtime::get()->create_response(_request); - - app_->send(its_response, true); - - if(number_of_received_messages_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND) - { - std::lock_guard<std::mutex> its_lock(mutex_); - blocked_ =true; - condition_.notify_one(); - } - ASSERT_LT(number_of_received_messages_, - vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1); -} - -void local_routing_test_service::run() -{ - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - condition_.wait(its_lock); - - blocked_ = false; - if(use_static_routing_) - { - offer(); - } - while (!blocked_) - condition_.wait(its_lock); - - std::thread t2([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));}); - t2.join(); - app_->stop(); -} - -TEST(someip_local_routing_test, receive_ten_messages_over_local_uds_socket) -{ - bool use_static_routing = true; - local_routing_test_service test_service(use_static_routing); - 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/routing_tests/local_routing_test_service.hpp b/test/routing_tests/local_routing_test_service.hpp deleted file mode 100644 index 531fdb7..0000000 --- a/test/routing_tests/local_routing_test_service.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// 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/. - -#ifndef LOCALROUTINGTESTSERVICE_HPP_ -#define LOCALROUTINGTESTSERVICE_HPP_ -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <functional> - -#include "../someip_test_globals.hpp" - -class local_routing_test_service -{ -public: - local_routing_test_service(bool _use_static_routing); - bool init(); - void start(); - void stop(); - void offer(); - void stop_offer(); - void join_offer_thread(); - void on_state(vsomeip::state_type_e _state); - void on_message(const std::shared_ptr<vsomeip::message> &_request); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - bool use_static_routing_; - - bool blocked_; - std::uint32_t number_of_received_messages_; - std::mutex mutex_; - std::condition_variable condition_; - std::thread offer_thread_; -}; - -#endif /* LOCALROUTINGTESTSERVICE_HPP_ */ diff --git a/test/routing_tests/local_routing_test_service.json b/test/routing_tests/local_routing_test_service.json deleted file mode 100644 index f5da8c6..0000000 --- a/test/routing_tests/local_routing_test_service.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "unicast" : "127.0.0.1", - "diagnosis":"0x12", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : - { - "enable" : "false", - "path" : "/tmp/vsomeip.log" - }, - - "dlt" : "false" - }, - - "applications" : - [ - { - "name" : "local_routing_test_service", - "id" : "0x1277" - } - ], - - "services" : - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ], - - "routing" : "vsomeipd", - "service-discovery" : - { - "enable" : "false", - "multicast" : "224.0.0.1", - "port" : "30490", - "protocol" : "udp" - } -} diff --git a/test/routing_tests/local_routing_test_service_start.sh b/test/routing_tests/local_routing_test_service_start.sh deleted file mode 100755 index c59364c..0000000 --- a/test/routing_tests/local_routing_test_service_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=local_routing_test_service -export VSOMEIP_CONFIGURATION=local_routing_test_service.json -./local_routing_test_service diff --git a/test/security_tests/conf/security_test_config.json.in b/test/security_tests/conf/security_test_config.json.in deleted file mode 100644 index 693bf58..0000000 --- a/test/security_tests/conf/security_test_config.json.in +++ /dev/null @@ -1,71 +0,0 @@ -{ - "unicast" : "localhost", - "logging" : - { - "level" : "info", - "console" : "true", - "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" }, - "dlt" : "false" - }, - "applications" : - [ - { - "name" : "service-sample", - "id" : "0x1277" - }, - { - "name" : "client-sample", - "id" : "0x1255" - } - ], - "security" : - { - "check_credentials" : "true", - "policies" : - [ - { - "client" : "0x1277", - "credentials" : { "uid" : "@TEST_UID@", "gid" : "@TEST_GID@" }, - "allow" : - { - "offers": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ] - } - }, - { - "client" : "0x1255", - "credentials" : { "uid" : "@TEST_UID@", "gid" : "@TEST_GID@" }, - "allow" : - { - "requests": - [ - { - "service" : "0x1234", - "instance" : "0x5678" - } - ] - } - } - ] - }, - "routing" : "service-sample", - "service-discovery" : - { - "enable" : "true", - "multicast" : "224.244.224.245", - "port" : "30490", - "protocol" : "udp", - "initial_delay_min" : "10", - "initial_delay_max" : "100", - "repetitions_base_delay" : "200", - "repetitions_max" : "3", - "ttl" : "3", - "cyclic_offer_delay" : "2000", - "request_response_delay" : "1500" - } -} diff --git a/test/security_tests/security_test_client.cpp b/test/security_tests/security_test_client.cpp deleted file mode 100644 index 924f13c..0000000 --- a/test/security_tests/security_test_client.cpp +++ /dev/null @@ -1,158 +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_test_client.hpp" - -security_test_client::security_test_client() - : app_(vsomeip::runtime::get()->create_application()), - is_available_(false), - sender_(std::bind(&security_test_client::run, this)), - received_responses_(0) { - -} - -bool security_test_client::init() { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - - app_->register_state_handler( - std::bind(&security_test_client::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD, - std::bind(&security_test_client::on_message, this, - std::placeholders::_1)); - - app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - std::bind(&security_test_client::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - return true; -} - -void security_test_client::start() { - VSOMEIP_INFO << "Starting..."; - - app_->start(); -} - -void security_test_client::stop() { - VSOMEIP_INFO << "Stopping..."; - - shutdown_service(); - - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - app_->clear_all_handler(); - app_->stop(); -} - -void security_test_client::on_state(vsomeip::state_type_e _state) { - if(_state == vsomeip::state_type_e::ST_REGISTERED) { - app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); - } -} - -void security_test_client::on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available) { - - VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() - << " : Service [" << std::setw(4) << std::setfill('0') << std::hex - << _service << "." << _instance << "] is " - << (_is_available ? "available." : "NOT available."); - - if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service - && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) { - std::unique_lock<std::mutex> its_lock(mutex_); - if(is_available_ && !_is_available) { - is_available_ = false; - } - else if(_is_available && !is_available_) { - is_available_ = true; - condition_.notify_one(); - } - } -} - -void security_test_client::on_message(const std::shared_ptr<vsomeip::message> &_response) { - VSOMEIP_INFO << "Received a response from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() - << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() - << "]"; - - if (_response->get_service() == vsomeip_test::TEST_SERVICE_SERVICE_ID && - _response->get_instance() == vsomeip_test::TEST_SERVICE_INSTANCE_ID) { - received_responses_++; - if (received_responses_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS) { - VSOMEIP_WARNING << std::hex << app_->get_client() - << ": Received all messages ~> going down!"; - } - } -} - -void security_test_client::run() { - for (uint32_t i = 0; i < vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS; ++i) { - { - std::unique_lock<std::mutex> its_lock(mutex_); - while (!is_available_) - { - condition_.wait(its_lock); - } - } - - auto request = vsomeip::runtime::get()->create_request(false); - 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); - - 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_SECURITY_TESTS, - received_responses_); - - stop(); -} - -void security_test_client::join_sender_thread() -{ - if (sender_.joinable()) { - sender_.join(); - } -} - -void security_test_client::shutdown_service() { - auto request = vsomeip::runtime::get()->create_request(false); - 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); -} - -TEST(someip_security_test, basic_request_response) -{ - security_test_client test_client; - if (test_client.init()) { - test_client.start(); - test_client.join_sender_thread(); - } -} - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -}
\ No newline at end of file diff --git a/test/security_tests/security_test_client.hpp b/test/security_tests/security_test_client.hpp deleted file mode 100644 index ed010fa..0000000 --- a/test/security_tests/security_test_client.hpp +++ /dev/null @@ -1,50 +0,0 @@ - -// 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/. - -#ifndef SECURITY_TEST_CLIENT_HPP -#define SECURITY_TEST_CLIENT_HPP - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include "../someip_test_globals.hpp" - -#include <thread> -#include <mutex> -#include <condition_variable> -#include <atomic> - -class security_test_client { -public: - security_test_client(); - bool init(); - void start(); - void stop(); - - void on_state(vsomeip::state_type_e _state); - void on_availability(vsomeip::service_t _service, - vsomeip::instance_t _instance, bool _is_available); - void on_message(const std::shared_ptr<vsomeip::message> &_response); - - void run(); - void join_sender_thread(); - -private: - void shutdown_service(); - - std::shared_ptr<vsomeip::application> app_; - - std::mutex mutex_; - std::condition_variable condition_; - bool is_available_; - - std::thread sender_; - - std::atomic<std::uint32_t> received_responses_; -}; - -#endif // SECURITY_TEST_CLIENT_HPP diff --git a/test/security_tests/security_test_client_start.sh b/test/security_tests/security_test_client_start.sh deleted file mode 100755 index e87ca31..0000000 --- a/test/security_tests/security_test_client_start.sh +++ /dev/null @@ -1,9 +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/. - -export VSOMEIP_APPLICATION_NAME=client-sample -export VSOMEIP_CONFIGURATION=vsomeip-security.json -./security_test_client diff --git a/test/security_tests/security_test_service.cpp b/test/security_tests/security_test_service.cpp deleted file mode 100644 index 99fb14e..0000000 --- a/test/security_tests/security_test_service.cpp +++ /dev/null @@ -1,133 +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_test_service.hpp" - -security_test_service::security_test_service() : - app_(vsomeip::runtime::get()->create_application()), - is_registered_(false), - blocked_(false), - number_of_received_messages_(0), - offer_thread_(std::bind(&security_test_service::run, this)) { -} - -bool security_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(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID, - std::bind(&security_test_service::on_message, this, - std::placeholders::_1)); - - app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, - vsomeip_test::TEST_SERVICE_INSTANCE_ID, - vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN, - std::bind(&security_test_service::on_message_shutdown, this, - std::placeholders::_1)); - - app_->register_state_handler( - std::bind(&security_test_service::on_state, this, - std::placeholders::_1)); - return true; -} - -void security_test_service::start() { - VSOMEIP_INFO << "Starting..."; - app_->start(); -} - -void security_test_service::stop() { - VSOMEIP_INFO << "Stopping..."; - app_->clear_all_handler(); - app_->stop(); -} - -void security_test_service::join_offer_thread() { - if (offer_thread_.joinable()) { - offer_thread_.join(); - } -} - -void security_test_service::offer() { - app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void security_test_service::stop_offer() { - app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); -} - -void security_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_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request) { - ASSERT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _request->get_service()); - ASSERT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _request->get_method()); - - 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() << "]"; - - // 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_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_test_service::run() { - std::unique_lock<std::mutex> its_lock(mutex_); - while (!blocked_) - condition_.wait(its_lock); - - offer(); -} - -TEST(someip_security_test, basic_request_response) { - security_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/security_test_service.hpp b/test/security_tests/security_test_service.hpp deleted file mode 100644 index 21f1f7c..0000000 --- a/test/security_tests/security_test_service.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// 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/. - -#ifndef SECURITY_TEST_SERVICE_HPP -#define SECURITY_TEST_SERVICE_HPP - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> - -#include "../someip_test_globals.hpp" - -#include <thread> -#include <mutex> -#include <condition_variable> - -class security_test_service { -public: - security_test_service(); - bool init(); - void start(); - void stop(); - void offer(); - void stop_offer(); - void join_offer_thread(); - void on_state(vsomeip::state_type_e _state); - void on_message(const std::shared_ptr<vsomeip::message> &_request); - void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request); - void run(); - -private: - std::shared_ptr<vsomeip::application> app_; - bool is_registered_; - - std::mutex mutex_; - std::condition_variable condition_; - bool blocked_; - std::uint32_t number_of_received_messages_; - std::thread offer_thread_; -}; - -#endif // SECURITY_TEST_SERVICE_HPP diff --git a/test/security_tests/security_test_start.sh b/test/security_tests/security_test_start.sh deleted file mode 100755 index ac4f51f..0000000 --- a/test/security_tests/security_test_start.sh +++ /dev/null @@ -1,15 +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/. - -export VSOMEIP_CONFIGURATION=security_test_config.json - -export VSOMEIP_APPLICATION_NAME=service-sample -./security_test_service & - -sleep 1 - -export VSOMEIP_APPLICATION_NAME=client-sample -./security_test_client diff --git a/test/someip_test_globals.hpp b/test/someip_test_globals.hpp deleted file mode 100644 index 8e7af4b..0000000 --- a/test/someip_test_globals.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// 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/. - -#ifndef SOMEIP_TEST_GLOBALS_HPP_ -#define SOMEIP_TEST_GLOBALS_HPP_ - -#include <vsomeip/vsomeip.hpp> - -#include "../implementation/logging/include/logger.hpp" - -namespace vsomeip_test -{ - -// Service -constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID = 0x1234; -constexpr vsomeip::instance_t TEST_SERVICE_INSTANCE_ID = 0x5678; -constexpr vsomeip::method_t TEST_SERVICE_METHOD_ID = 0x8421; -constexpr vsomeip::method_t TEST_SERVICE_METHOD_ID_SHUTDOWN = 0x7777; -constexpr vsomeip::client_t TEST_SERVICE_CLIENT_ID = 0x1277; - -// Client local -constexpr vsomeip::client_t TEST_CLIENT_CLIENT_ID = 0x1255; - -// Client external -constexpr vsomeip::client_t TEST_CLIENT_EXTERNAL_CLIENT_ID = 0x1644; - - -constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND = 10; -constexpr vsomeip::session_t TEST_INITIAL_SESSION_ID = 0x1; - -constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS = 1000; -constexpr vsomeip::byte_t PAYLOAD_TEST_DATA = 0xDD; -constexpr std::uint32_t MAX_PAYLOADSIZE = 1024*128; -// TR_SOMEIP_00061 -constexpr std::uint32_t MAX_PAYLOADSIZE_UDP = 1400; - -constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS = 32; - -constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS = 32; -} - -#endif /* SOMEIP_TEST_GLOBALS_HPP_ */ diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in deleted file mode 100644 index f3aa9de..0000000 --- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in +++ /dev/null @@ -1,80 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"subscribe_notify_one_test_service_one", - "id":"0x1111" - }, - { - "name":"subscribe_notify_one_test_service_two", - "id":"0x2222" - }, - { - "name":"subscribe_notify_one_test_service_three", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x1111", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - } - ], - "routing":"subscribe_notify_one_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" - }, - "supports_selective_broadcasts" : - { - "address" : "@TEST_IP_SLAVE@" - } -}
\ No newline at end of file diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in deleted file mode 100644 index b684f56..0000000 --- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in +++ /dev/null @@ -1,104 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"subscribe_notify_one_test_service_one", - "id":"0x1111" - }, - { - "name":"subscribe_notify_one_test_service_two", - "id":"0x2222" - }, - { - "name":"subscribe_notify_one_test_service_three", - "id":"0x3333" - } - ], - "services": - [ - { - "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_one_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" - }, - "supports_selective_broadcasts" : - { - "address" : "@TEST_IP_SLAVE@" - } -}
\ No newline at end of file diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in deleted file mode 100644 index c588106..0000000 --- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in +++ /dev/null @@ -1,80 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"subscribe_notify_one_test_service_four", - "id":"0x4444" - }, - { - "name":"subscribe_notify_one_test_service_five", - "id":"0x5555" - }, - { - "name":"subscribe_notify_one_test_service_six", - "id":"0x6666" - } - ], - "services": - [ - { - "service":"0x4444", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - } - ], - "routing":"subscribe_notify_one_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" - }, - "supports_selective_broadcasts" : - { - "address" : "@TEST_IP_MASTER@" - } -}
\ No newline at end of file diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in deleted file mode 100644 index dbe0635..0000000 --- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in +++ /dev/null @@ -1,104 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "applications": - [ - { - "name":"subscribe_notify_one_test_service_four", - "id":"0x4444" - }, - { - "name":"subscribe_notify_one_test_service_five", - "id":"0x5555" - }, - { - "name":"subscribe_notify_one_test_service_six", - "id":"0x6666" - } - ], - "services": - [ - { - "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_one_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" - }, - "supports_selective_broadcasts" : - { - "address" : "@TEST_IP_MASTER@" - } -}
\ No newline at end of file diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp b/test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp deleted file mode 100644 index 047ded7..0000000 --- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp +++ /dev/null @@ -1,35 +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 SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ -#define SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ - -namespace subscribe_notify_one_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, 7> service_infos = {{ - // placeholder to be consistent w/ client ids, service ids, app names - { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }, - // node 1 - { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 }, - { 0x2222, 0x1, 0x2222, 0x2222, 0x2000 }, - { 0x3333, 0x1, 0x3333, 0x3333, 0x3000 }, - // node 2 - { 0x4444, 0x1, 0x4444, 0x4444, 0x4000 }, - { 0x5555, 0x1, 0x5555, 0x5555, 0x5000 }, - { 0x6666, 0x1, 0x6666, 0x6666, 0x6000 } -}}; - -static constexpr int notifications_to_send = 10; -} - -#endif /* SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ */ 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 deleted file mode 100755 index c551b55..0000000 --- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh +++ /dev/null @@ -1,106 +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. - -if [ $# -lt 2 ] -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" - 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 -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_APPLICATION_NAME=subscribe_notify_one_test_service_two -export VSOMEIP_CONFIGURATION=$2 -./subscribe_notify_one_test_service 2 $1 & - -export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_three -export VSOMEIP_CONFIGURATION=$2 -./subscribe_notify_one_test_service 3 $1 & - -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 "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" & -else - cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** subscribe_notify_one_test_slave_starter.sh $1 $CLIENT_JSON_FILE -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** subscribe_notify_one_test_diff_client_ids_diff_ports_master.json and -** subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - 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 - exit 0 -else - exit 1 -fi 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 deleted file mode 100644 index 5266648..0000000 --- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp +++ /dev/null @@ -1,512 +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 <unordered_set> -#include <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/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) : - service_info_(_service_info), - subscription_type_(_subscription_type), - app_(vsomeip::runtime::get()->create_application()), - wait_until_registered_(true), - wait_until_other_services_available_(true), - wait_until_notified_from_other_services_(true), - offer_thread_(std::bind(&subscribe_notify_one_test_service::run, this)), - wait_for_stop_(true), - stop_thread_(std::bind(&subscribe_notify_one_test_service::wait_for_stop, this)), - wait_for_notify_(true), - notify_thread_(std::bind(&subscribe_notify_one_test_service::notify_one, this)), - subscription_state_handler_called_(0), - subscription_error_occured_(false) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&subscribe_notify_one_test_service::on_state, this, - std::placeholders::_1)); - - // offer event - 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); - - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.method_id, - std::bind(&subscribe_notify_one_test_service::on_request, this, - std::placeholders::_1)); - - // register subscription handler to detect whether or not all other - // other services have subscribed - 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)); - - // register availability for all other services and request their event. - for(const auto& i : subscribe_notify_one_test::service_infos) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) { - continue; - } - app_->register_message_handler(i.service_id, - i.instance_id, vsomeip::ANY_METHOD, - std::bind(&subscribe_notify_one_test_service::on_message, this, - std::placeholders::_1)); - app_->register_availability_handler(i.service_id, i.instance_id, - std::bind(&subscribe_notify_one_test_service::on_availability, this, - 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); - - 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); - 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); - - 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; - } - - app_->start(); - } - - ~subscribe_notify_one_test_service() { - offer_thread_.join(); - stop_thread_.join(); - } - - void offer() { - app_->offer_service(service_info_.service_id, service_info_.instance_id); - } - - void stop_offer() { - 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 " - << (_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) { - auto its_service = other_services_available_.find(std::make_pair(_service, _instance)); - 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 - << service_info_.service_id << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is available."; - - } - } - - 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;})) { - std::lock_guard<std::mutex> its_lock(mutex_); - wait_until_other_services_available_ = false; - condition_.notify_one(); - } - } - } - - void on_subscription_state_change(const vsomeip::service_t _service, const vsomeip::instance_t _instance, - const vsomeip::eventgroup_t _eventgroup, const vsomeip::event_t _event, const uint16_t _error) { - (void)_service; - (void)_instance; - (void)_eventgroup; - (void)_event; - if (!_error) { - subscription_state_handler_called_++; - } else { - subscription_error_occured_ = true; - VSOMEIP_WARNING << 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) { - 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) { - return true; - } - - if (_subscribed) { - subscribers_.insert(_client); - } else { - subscribers_.erase(_client); - } - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] " << "Client: " << _client - << " subscribed, now have " << std::dec << subscribers_.size() - << " subscribers" ; - - 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_); - wait_for_notify_ = false; - notify_condition_.notify_one(); - } - return true; - } - - void on_request(const std::shared_ptr<vsomeip::message> &_message) { - if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) { - VSOMEIP_DEBUG << "Received a request 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() << "]"; - std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get() - ->create_response(_message); - app_->send(its_response); - } - } - - 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 << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] " - << "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())] << ")"; - - - 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_tcp_and_udp()) { - notify = true; - } - break; - } - - if(notify) { - std::lock_guard<std::mutex> its_lock(stop_mutex_); - wait_for_stop_ = false; - stop_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) - { - return v.second == subscribe_notify_one_test::notifications_to_send; - } - ); - } - - bool all_notifications_received_tcp_and_udp() { - std::uint32_t received_twice(0); - std::uint32_t received_normal(0); - for(const auto &v : other_services_received_notification_) { - if (v.second == subscribe_notify_one_test::notifications_to_send * 2) { - received_twice++; - } else if(v.second == subscribe_notify_one_test::notifications_to_send) { - received_normal++; - } - } - - if( received_twice == (subscribe_notify_one_test::service_infos.size() - 1) / 2 - && received_normal == (subscribe_notify_one_test::service_infos.size() - 1) / 2 - 1) { - // 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 - << service_info_.service_id << "] " - << "Received notifications:" - << " Normal: " << received_normal - << " Twice: " << received_twice; - return true; - } - return false; - } - - 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_other_services_available_) { - condition_.wait(its_lock); - } - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Subscribing"; - // subscribe to events of other services - uint32_t subscribe_count = 0; - for(const subscribe_notify_one_test::service_info& i: subscribe_notify_one_test::service_infos) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) { - continue; - } - - ++subscribe_count; - app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id, - vsomeip::DEFAULT_MAJOR, subscription_type_); - - VSOMEIP_DEBUG << "[" << std::hex << service_info_.service_id - << "] subscribing to Service/Instance/Eventgroup [" - << std::setw(4) << std::setfill('0') << std::hex << i.service_id << "/" - << std::setw(4) << std::setfill('0') << std::hex << i.instance_id - << "/" << std::setw(4) << std::setfill('0') << std::hex << i.eventgroup_id <<"]"; - - } - - while (wait_until_notified_from_other_services_) { - condition_.wait(its_lock); - } - - // It is possible that we run in the case a subscription is NACKED - // due to TCP endpoint not completely connected when subscription - // is processed in the server - due to resubscribing the error handler - // count may differ from expected value, but its not a real but as - // the subscription takes places anyways and all events will be received. - if (!subscription_error_occured_) { - // 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=" - << std::dec << subscription_state_handler_called_; - } - } - - void notify_one() { - std::unique_lock<std::mutex> its_lock(notify_mutex_); - while(wait_for_notify_) { - notify_condition_.wait(its_lock); - } - - // sleep a while before starting to notify this is necessary as it's not - // possible to detect if _all_ clients on the remote side have - // successfully subscribed as we only receive once subscription per - // remote node no matter how many clients subscribed to this eventgroup - // 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(); - - vsomeip::byte_t its_data[10] = {0}; - for (uint32_t j = 0; j < i+1; ++j) { - its_data[j] = static_cast<uint8_t>(j); - } - its_payload->set_data(its_data, i+1); - - for (vsomeip::client_t client : subscribers_) { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Notifying client: " - << client << " : " << i+1; - app_->notify_one(service_info_.service_id, service_info_.instance_id, - service_info_.event_id, its_payload, client); - } - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - } - } - - void wait_for_stop() { - 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 - << service_info_.service_id - << "] Received notifications from all other services, going down"; - - // wait until all notifications have been sent out - notify_thread_.join(); - - // let offer thread exit - { - std::lock_guard<std::mutex> its_lock(mutex_); - wait_until_notified_from_other_services_ = false; - condition_.notify_one(); - } - - stop_offer(); - - // ensure that the service which hosts the routing doesn't exit to early - if (app_->is_routing()) { - for (const auto& i : subscribe_notify_one_test::service_infos) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) { - continue; - } - while (app_->is_available(i.service_id, i.instance_id, - vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR)) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - } - } - - for(const auto& i : subscribe_notify_one_test::service_infos) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (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_->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); - } - std::this_thread::sleep_for(std::chrono::seconds(1)); - app_->clear_all_handler(); - app_->stop(); - } - -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_; - - bool wait_until_registered_; - bool wait_until_other_services_available_; - bool wait_until_notified_from_other_services_; - std::mutex mutex_; - std::condition_variable condition_; - std::thread offer_thread_; - - bool wait_for_stop_; - std::mutex stop_mutex_; - std::condition_variable stop_condition_; - std::thread stop_thread_; - - bool wait_for_notify_; - std::mutex notify_mutex_; - std::condition_variable notify_condition_; - std::thread notify_thread_; - - std::unordered_set<vsomeip::client_t> subscribers_; - std::atomic<uint32_t> subscription_state_handler_called_; - std::atomic<bool> subscription_error_occured_; - - std::mutex subscribers_mutex_; -}; - -static int service_number; -static vsomeip::subscription_type_e subscription_type; - -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); -} - -#ifndef _WIN32 -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" << 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; - } - 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 deleted file mode 100755 index 47d0b2d..0000000 --- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh +++ /dev/null @@ -1,72 +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. - -if [ $# -lt 2 ] -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" - 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 -./subscribe_notify_one_test_service 4 $1 & - -export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_five -export VSOMEIP_CONFIGURATION=$2 -./subscribe_notify_one_test_service 5 $1 & - -export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_six -export VSOMEIP_CONFIGURATION=$2 -./subscribe_notify_one_test_service 6 $1 & - -# Wait until all applications are finished -for job in $(jobs -p) -do - # Fail gets incremented if one of the binaries exits - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in deleted file mode 100644 index 370cf98..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in +++ /dev/null @@ -1,60 +0,0 @@ -{ - "unicast":"@TEST_IP_MASTER@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "services": - [ - { - "service":"0x1111", - "instance":"0x0001", - "unreliable":"30001", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - } - ], - "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_diff_ports_autoconfig_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in deleted file mode 100644 index 46de8ff..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in +++ /dev/null @@ -1,60 +0,0 @@ -{ - "unicast":"@TEST_IP_SLAVE@", - "logging": - { - "level":"warning", - "console":"true", - "file": - { - "enable":"false", - "path":"/tmp/vsomeip.log" - }, - "dlt":"false" - }, - "services": - [ - { - "service":"0x4444", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - } - ], - "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_diff_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in deleted file mode 100644 index 87299aa..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - } - ], - "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_diff_ports_master_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in deleted file mode 100644 index 785bec0..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in +++ /dev/null @@ -1,100 +0,0 @@ -{ - "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", - "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", - "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.json.in deleted file mode 100644 index fa4c5a3..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1111", - "instance":"0x0002", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x1111", - "instance":"0x0003", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - } - ], - "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_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.json.in deleted file mode 100644 index 66f1a83..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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":"0x2222", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0002", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0003", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - } - ], - "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_diff_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in deleted file mode 100644 index 5b110aa..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - } - ], - "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_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 deleted file mode 100644 index d431acf..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in +++ /dev/null @@ -1,100 +0,0 @@ -{ - "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", - "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", - "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_partial_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in deleted file mode 100644 index 81bb18e..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - } - ], - "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_partial_same_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in deleted file mode 100644 index 98ce9a6..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - } - ], - "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_diff_client_ids_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in deleted file mode 100644 index 253b55e..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "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_master_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in deleted file mode 100644 index 376642e..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in +++ /dev/null @@ -1,100 +0,0 @@ -{ - "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", - "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", - "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.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in deleted file mode 100644 index 556b10f..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "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_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 deleted file mode 100644 index a0a4b2c..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in +++ /dev/null @@ -1,100 +0,0 @@ -{ - "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", - "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", - "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 deleted file mode 100644 index 0b0051a..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in +++ /dev/null @@ -1,31 +0,0 @@ -{ - "unicast" : "@TEST_IP_MASTER@", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" }, - "dlt" : "false" - }, - "applications" : - [ - { - "name" : "subscribe_notify_test_client", - "id" : "0x9999" - } - ], - "routing" : "vsomeipd", - "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" : "0", - "cyclic_offer_delay" : "1000", - "ttl" : "3" - } -} 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 deleted file mode 100644 index 558a873..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in +++ /dev/null @@ -1,39 +0,0 @@ -{ - "unicast" : "@TEST_IP_SLAVE@", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" }, - "dlt" : "false" - }, - "applications" : - [ - { - "name" : "subscribe_notify_test_service", - "id" : "0x8888" - } - ], - "services" : - [ - { - "service" : "0xcafe", - "instance" : "0x1", - "reliable" : { "port":"30509", "enable-magic-cookies":"false" } - } - ], - "routing" : "vsomeipd", - "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" : "0", - "cyclic_offer_delay" : "1000", - "ttl" : "3" - } -} 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 deleted file mode 100644 index 1828a7a..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in +++ /dev/null @@ -1,39 +0,0 @@ -{ - "unicast" : "@TEST_IP_SLAVE@", - "logging" : - { - "level" : "debug", - "console" : "true", - "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" }, - "dlt" : "false" - }, - "applications" : - [ - { - "name" : "subscribe_notify_test_service", - "id" : "0x8888" - } - ], - "services" : - [ - { - "service" : "0xcafe", - "instance" : "0x1", - "unreliable" : "30509" - } - ], - "routing" : "vsomeipd", - "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" : "0", - "cyclic_offer_delay" : "1000", - "ttl" : "3" - } -} diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in deleted file mode 100644 index 87299aa..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40001", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30002", - "reliable": - { - "port":"40002", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30003", - "reliable": - { - "port":"40003", - "enable-magic-cookies":"false" - } - } - ], - "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_same_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in deleted file mode 100644 index bc13f01..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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":"0x1111" - }, - { - "name":"subscribe_notify_test_service_five", - "id":"0x2222" - }, - { - "name":"subscribe_notify_test_service_six", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x4444", - "instance":"0x0001", - "unreliable":"30004", - "reliable": - { - "port":"40004", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30005", - "reliable": - { - "port":"40005", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30006", - "reliable": - { - "port":"40006", - "enable-magic-cookies":"false" - } - } - ], - "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_same_client_ids_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in deleted file mode 100644 index 253b55e..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x2222", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x3333", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "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_same_client_ids_same_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in deleted file mode 100644 index c203e80..0000000 --- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in +++ /dev/null @@ -1,76 +0,0 @@ -{ - "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":"0x1111" - }, - { - "name":"subscribe_notify_test_service_five", - "id":"0x2222" - }, - { - "name":"subscribe_notify_test_service_six", - "id":"0x3333" - } - ], - "services": - [ - { - "service":"0x4444", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x5555", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - }, - { - "service":"0x6666", - "instance":"0x0001", - "unreliable":"30000", - "reliable": - { - "port":"40000", - "enable-magic-cookies":"false" - } - } - ], - "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/subscribe_notify_test_globals.hpp b/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp deleted file mode 100644 index 761c3c4..0000000 --- a/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp +++ /dev/null @@ -1,55 +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 SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ -#define SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ - -namespace subscribe_notify_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, 7> service_infos = {{ - // placeholder to be consistent w/ client ids, service ids, app names - { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }, - // node 1 - { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 }, - { 0x2222, 0x1, 0x2222, 0x2222, 0x2000 }, - { 0x3333, 0x1, 0x3333, 0x3333, 0x3000 }, - // node 2 - { 0x4444, 0x1, 0x4444, 0x4444, 0x4000 }, - { 0x5555, 0x1, 0x5555, 0x5555, 0x5000 }, - { 0x6666, 0x1, 0x6666, 0x6666, 0x6000 } -}}; - -static constexpr std::array<service_info, 7> service_infos_same_service_id = {{ - // placeholder to be consistent w/ client ids, service ids, app names - { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }, - // node 1 - { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 }, - { 0x1111, 0x2, 0x2222, 0x2222, 0x2000 }, - { 0x1111, 0x3, 0x3333, 0x3333, 0x3000 }, - // node 2 - { 0x2222, 0x1, 0x4444, 0x4444, 0x4000 }, - { 0x2222, 0x2, 0x5555, 0x5555, 0x5000 }, - { 0x2222, 0x3, 0x6666, 0x6666, 0x6000 } -}}; - -static constexpr int notifications_to_send = 10; - -// one_event_two_eventgroups globals -static constexpr struct service_info service_info_subscriber_based_notification = - { 0xCAFE, 0x1, 0x8888, 0x8111, 0x1}; -static constexpr vsomeip::method_t shutdown_method_id = 0x6666; -static constexpr vsomeip::method_t set_method_id = 0x7777; - -} - -#endif /* SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ */ diff --git a/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh deleted file mode 100755 index 1e41c8e..0000000 --- a/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh +++ /dev/null @@ -1,111 +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. - -if [ $# -lt 2 ] -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 "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 -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_APPLICATION_NAME=subscribe_notify_test_service_two -export VSOMEIP_CONFIGURATION=$2 -./subscribe_notify_test_service 2 $1 $3 & - -export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_three -export VSOMEIP_CONFIGURATION=$2 -./subscribe_notify_test_service 3 $1 $3 & - -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 "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" & -else - cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** subscribe_notify_test_slave_starter.sh $1 $CLIENT_JSON_FILE $3 -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** subscribe_notify_test_diff_client_ids_diff_ports_master.json and -** subscribe_notify_test_diff_client_ids_diff_ports_slave.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -if [ ! -z "$USE_DOCKER" ]; then - FAIL=0 -fi - -# Wait until client and service are finished -for job in $(jobs -p) -do - # Fail gets incremented if either client or service exit - # with a non-zero exit code - 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 - exit 0 -else - exit 1 -fi 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 deleted file mode 100644 index 0b88e25..0000000 --- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp +++ /dev/null @@ -1,380 +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 VSOMEIP_ENABLE_SIGNAL_HANDLING -#include <csignal> -#endif -#include <chrono> -#include <condition_variable> -#include <iomanip> -#include <iostream> -#include <sstream> -#include <thread> -#include <utility> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include <gtest/gtest.h> - -#include "subscribe_notify_test_globals.hpp" - -class subscribe_notify_test_one_event_two_eventgroups_client { -public: - subscribe_notify_test_one_event_two_eventgroups_client( - struct subscribe_notify_test::service_info _info, bool _use_tcp) : - app_( - vsomeip::runtime::get()->create_application( - "subscribe_notify_test_client")), - info_(_info), - use_tcp_(_use_tcp), - wait_availability_(true), - wait_set_value_(true), - wait_shutdown_response_(true), - run_thread_(std::bind(&subscribe_notify_test_one_event_two_eventgroups_client::run, this)) { - } - ~subscribe_notify_test_one_event_two_eventgroups_client() { - run_thread_.join(); - } - - bool init() { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - - app_->register_state_handler( - std::bind( - &subscribe_notify_test_one_event_two_eventgroups_client::on_state, - this, std::placeholders::_1)); - - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind( - &subscribe_notify_test_one_event_two_eventgroups_client::on_message, - this, std::placeholders::_1)); - - app_->register_availability_handler(info_.service_id, info_.instance_id, - std::bind( - &subscribe_notify_test_one_event_two_eventgroups_client::on_availability, - this, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - - std::set<vsomeip::eventgroup_t> its_groups; - // 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); - 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); - app_->request_event(info_.service_id, info_.instance_id, - static_cast<vsomeip::event_t>(info_.event_id+2), its_groups, true); - - - - return true; - } - - void start() { - app_->start(); - } - - void stop() { - app_->clear_all_handler(); - app_->unsubscribe(info_.service_id, info_.instance_id, info_.eventgroup_id); - app_->unsubscribe(info_.service_id, info_.instance_id, static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id+1)); - app_->release_event(info_.service_id, info_.instance_id, info_.event_id); - app_->release_event(info_.service_id, info_.instance_id, static_cast<vsomeip::event_t>(info_.event_id+1)); - app_->release_event(info_.service_id, info_.instance_id, static_cast<vsomeip::event_t>(info_.event_id+2)); - app_->release_service(info_.service_id, info_.instance_id); - app_->stop(); - } - - void on_state(vsomeip::state_type_e _state) { - if (_state == vsomeip::state_type_e::ST_REGISTERED) { - app_->request_service(info_.service_id, info_.instance_id); - } - } - - 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."); - if (_service == info_.service_id && _instance == info_.instance_id && _is_available) { - std::lock_guard<std::mutex> its_lock(availability_mutex_); - wait_availability_ = false; - availability_condition_.notify_one(); - } - } - - void on_message(const std::shared_ptr<vsomeip::message> &_response) { - std::stringstream its_message; - its_message << "Received a message [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_method() << "] from Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_session() - << "] = "; - std::shared_ptr<vsomeip::payload> its_payload = - _response->get_payload(); - its_message << "(" << std::dec << its_payload->get_length() << ") "; - for (uint32_t i = 0; i < its_payload->get_length(); ++i) - its_message << std::hex << std::setw(2) << std::setfill('0') - << (int) its_payload->get_data()[i] << " "; - VSOMEIP_DEBUG << its_message.str(); - ASSERT_EQ(info_.service_id, _response->get_service()); - - if (_response->get_method() == info_.method_id - || _response->get_method() == subscribe_notify_test::shutdown_method_id) { - ASSERT_EQ(vsomeip::message_type_e::MT_RESPONSE, _response->get_message_type()); - ASSERT_EQ(vsomeip::return_code_e::E_OK, _response->get_return_code()); - std::lock_guard<std::mutex> its_lock(shutdown_response_mutex_); - wait_shutdown_response_ = false; - shutdown_response_condition_.notify_one(); - } else if (_response->get_method() == subscribe_notify_test::set_method_id) { - std::lock_guard<std::mutex> its_lock(set_value_mutex_); - wait_set_value_ = false; - set_value_condition_.notify_one(); - } else if (_response->get_method() >= info_.event_id - && _response->get_method() <= static_cast<vsomeip::event_t>(info_.event_id + 3)) { - 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"; - } - number_received_events_[_response->get_method()]++; - events_condition_.notify_one(); - } else { - ADD_FAILURE() << "Received unknown method id: " << std::setw(4) - << std::setfill('0') << std::hex << _response->get_method(); - } - - } - - void set_field_at_service(vsomeip::byte_t _value) { - std::shared_ptr<vsomeip::runtime> its_runtime = vsomeip::runtime::get(); - std::shared_ptr<vsomeip::message> its_request = its_runtime->create_request(false); - its_request->set_service(info_.service_id); - its_request->set_instance(info_.instance_id); - its_request->set_method(subscribe_notify_test::set_method_id); - its_request->set_reliable(use_tcp_); - std::shared_ptr<vsomeip::payload> its_payload = its_runtime->create_payload(&_value, sizeof(_value)); - its_request->set_payload(its_payload); - app_->send(its_request); - } - - void call_method_at_service(vsomeip::method_t _method) { - std::shared_ptr<vsomeip::runtime> its_runtime = vsomeip::runtime::get(); - std::shared_ptr<vsomeip::message> its_request = its_runtime->create_request(false); - its_request->set_service(info_.service_id); - its_request->set_instance(info_.instance_id); - its_request->set_method(_method); - its_request->set_reliable(use_tcp_); - app_->send(its_request); - } - - void wait_on_condition(std::unique_lock<std::mutex>&& _lock, bool *_predicate, std::condition_variable&& _condition, std::uint32_t _timeout) { - while (*_predicate) { - if (std::cv_status::timeout == _condition.wait_for(_lock, std::chrono::seconds(_timeout))) { - ADD_FAILURE() << "Condition variable wasn't notified within time (" - << _timeout << "sec)"; - } - } - *_predicate = true; - } - - void subscribe_at_service() { - // subscribe to both eventgroups - app_->subscribe(info_.service_id, info_.instance_id, info_.eventgroup_id); - app_->subscribe(info_.service_id, info_.instance_id, static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id+1)); - } - - void unsubscribe_at_service() { - app_->unsubscribe(info_.service_id, info_.instance_id, info_.eventgroup_id); - app_->unsubscribe(info_.service_id, info_.instance_id, static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id+1)); - } - - void wait_for_events(std::unique_lock<std::mutex>&& _lock, - std::uint32_t _expected_number_received_events, - std::condition_variable&& _condition) { - std::cv_status its_status(std::cv_status::no_timeout); - while (received_events_.size() != _expected_number_received_events - && its_status != std::cv_status::timeout) { - its_status = _condition.wait_for(_lock, std::chrono::seconds(15)); - if (std::cv_status::timeout == its_status) { - ADD_FAILURE() << "Didn't receive expected number of events: " - << _expected_number_received_events - << " within time. Instead received: " << received_events_.size(); - } - } - ASSERT_EQ(size_t(_expected_number_received_events), received_events_.size()); - } - - void check_received_events_payload(vsomeip::byte_t _value) { - for (const auto &p : received_events_) { - ASSERT_EQ(vsomeip::length_t(1), p->get_length()); - ASSERT_EQ(vsomeip::byte_t(_value), *p->get_data()); - } - received_events_.clear(); - } - - void check_received_events_number(std::set<std::pair<vsomeip::event_t, std::uint32_t>> _expected) { - for (const auto &e : _expected) { - auto event = number_received_events_.find(e.first); - ASSERT_NE(number_received_events_.end(), event); - ASSERT_EQ(e.second, event->second); - } - number_received_events_.clear(); - } - - void run() { - std::unique_lock<std::mutex> its_availability_lock(availability_mutex_); - wait_on_condition(std::move(its_availability_lock), &wait_availability_, std::move(availability_condition_), 300); - // service is available now - - for (int i = 0; i < 3; i++) { - // set value - set_field_at_service(0x1); - std::unique_lock<std::mutex> its_set_value_lock(set_value_mutex_); - wait_on_condition(std::move(its_set_value_lock), &wait_set_value_, std::move(set_value_condition_), 30); - - // subscribe - std::unique_lock<std::mutex> its_events_lock(events_mutex_); - subscribe_at_service(); - wait_for_events(std::move(its_events_lock), 4, std::move(events_condition_)); - check_received_events_payload(0x1); - - std::set<std::pair<vsomeip::event_t, std::uint32_t>> its_expected; - its_expected.insert({info_.event_id, 1}); - its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+1), 1}); - // Initial event for the event which is member of both eventgroups has to be sent twice - its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+2), 2}); - - check_received_events_number(its_expected); - its_expected.clear(); - - // set value again - set_field_at_service(0x2); - wait_on_condition(std::move(its_set_value_lock), &wait_set_value_, std::move(set_value_condition_), 30); - - wait_for_events(std::move(its_events_lock), 3, std::move(events_condition_)); - check_received_events_payload(0x2); - its_expected.insert({info_.event_id, 1}); - its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+1), 1}); - its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+2), 1}); - - check_received_events_number(its_expected); - its_expected.clear(); - - - // set value again - set_field_at_service(0x3); - wait_on_condition(std::move(its_set_value_lock), &wait_set_value_, std::move(set_value_condition_), 30); - wait_for_events(std::move(its_events_lock), 3, std::move(events_condition_)); - check_received_events_payload(0x3); - its_expected.insert({info_.event_id, 1}); - its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+1), 1}); - its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+2), 1}); - check_received_events_number(its_expected); - - unsubscribe_at_service(); - // sleep some time to ensure the unsubscription was processed by the - // remote routing_manager before setting the field again in the next - // loop. - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } - std::unique_lock<std::mutex> its_shutdown_lock(shutdown_response_mutex_); - call_method_at_service(subscribe_notify_test::shutdown_method_id); - wait_on_condition(std::move(its_shutdown_lock), &wait_shutdown_response_, std::move(shutdown_response_condition_), 30); - stop(); - } - -private: - std::shared_ptr<vsomeip::application> app_; - struct subscribe_notify_test::service_info info_; - bool use_tcp_; - - bool wait_availability_; - std::mutex availability_mutex_; - std::condition_variable availability_condition_; - - bool wait_set_value_; - std::mutex set_value_mutex_; - std::condition_variable set_value_condition_; - - bool wait_shutdown_response_; - std::mutex shutdown_response_mutex_; - std::condition_variable shutdown_response_condition_; - - std::mutex events_mutex_; - std::condition_variable events_condition_; - - std::vector<std::shared_ptr<vsomeip::payload>> received_events_; - std::map<vsomeip::event_t, std::uint32_t> number_received_events_; - std::thread run_thread_; -}; - -#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING - subscribe_notify_test_one_event_two_eventgroups_client *its_client_ptr(nullptr); - void handle_signal(int _signal) { - if (its_client_ptr != nullptr && - (_signal == SIGINT || _signal == SIGTERM)) - its_client_ptr->stop(); - } -#endif - -static bool use_tcp; - -TEST(someip_subscribe_notify_test_one_event_two_eventgroups, subscribe_to_service) -{ - subscribe_notify_test_one_event_two_eventgroups_client its_client( - subscribe_notify_test::service_info_subscriber_based_notification, use_tcp); -#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING - its_client_ptr = &its_client; - signal(SIGINT, handle_signal); - signal(SIGTERM, handle_signal); -#endif - if (its_client.init()) { - its_client.start(); - } -} - -#ifndef _WIN32 -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 << "[UDP, 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; - } else { - std::cerr << "Wrong subscription type passed, exiting" << std::endl; - std::cerr << "Valid subscription types include:" << std::endl; - std::cerr << "[UDP, TCP]" << std::endl; - return 1; - } - - return RUN_ALL_TESTS(); -} -#endif 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 deleted file mode 100755 index c983369..0000000 --- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh +++ /dev/null @@ -1,88 +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. - -if [ $# -lt 2 ]; then - echo "Please pass a json file and a subscription type to this script." - echo "Valid subscription types include:" - echo " [UDP, TCP]" - echo "For example: $0 UDP subscribe_notify_test_one_event_two_eventgroups_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 -if [ $1 == "UDP" ]; then - SLAVE_JSON_FILE=${MASTER_JSON_FILE/master/udp_slave} -elif [ $1 == "TCP" ]; then - SLAVE_JSON_FILE=${MASTER_JSON_FILE/master/tcp_slave} -fi - -FAIL=0 - -export VSOMEIP_CONFIGURATION=$2 -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! - -# Start the client -./subscribe_notify_test_one_event_two_eventgroups_client $1 & -PID_CLIENT=$! -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\"" & - 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" & -else - cat <<End-of-message -******************************************************************************* -******************************************************************************* -** Please now run: -** subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh $SLAVE_JSON_FILE -** from an external host to successfully complete this test. -** -** You probably will need to adapt the 'unicast' settings in -** subscribe_notify_test_diff_client_ids_diff_ports_master.json and -** subscribe_notify_test_diff_client_ids_diff_ports_slave.json to your personal setup. -******************************************************************************* -******************************************************************************* -End-of-message -fi - -if [ ! -z "$USE_DOCKER" ]; then - FAIL=0 -fi - -# wait until client exits successfully -wait $PID_CLIENT || FAIL=$(($FAIL+1)) - - -# kill daemon -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 -if [ $FAIL -eq 0 ]; then - exit 0 -else - exit 1 -fi 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 deleted file mode 100644 index 1d7b0c3..0000000 --- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp +++ /dev/null @@ -1,212 +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 VSOMEIP_ENABLE_SIGNAL_HANDLING -#include <csignal> -#endif -#include <chrono> -#include <condition_variable> -#include <iomanip> -#include <iostream> -#include <sstream> -#include <thread> -#include <atomic> - -#include <gtest/gtest.h> -#include "../../implementation/logging/include/logger.hpp" - -#include <vsomeip/vsomeip.hpp> - -#include "subscribe_notify_test_globals.hpp" - -class subscribe_notify_test_one_event_two_eventgroups_service { -public: - subscribe_notify_test_one_event_two_eventgroups_service(subscribe_notify_test::service_info _info) : - app_(vsomeip::runtime::get()->create_application()), - wait_for_shutdown_(true), - info_(_info), - notify_thread_(std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::wait_for_shutdown, this)) { - } - - ~subscribe_notify_test_one_event_two_eventgroups_service() { - notify_thread_.join(); - } - - bool init() { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return false; - } - app_->register_state_handler( - std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::on_state, this, - std::placeholders::_1)); - - app_->register_message_handler( - info_.service_id, - info_.instance_id, - subscribe_notify_test::set_method_id, - std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::on_set, this, - std::placeholders::_1)); - - app_->register_message_handler( - info_.service_id, - info_.instance_id, - info_.method_id, - std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::on_message, this, - std::placeholders::_1)); - - app_->register_message_handler( - info_.service_id, - info_.instance_id, - subscribe_notify_test::shutdown_method_id, - std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::on_shutdown, this, - std::placeholders::_1)); - - std::set<vsomeip::eventgroup_t> its_groups; - // the service offers three events in two eventgroups - // 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); - app_->offer_event(info_.service_id, info_.instance_id, - static_cast<vsomeip::event_t>(info_.event_id + 2), its_groups, true); - 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); - app_->offer_event(info_.service_id, info_.instance_id, - static_cast<vsomeip::event_t>(info_.event_id + 2), its_groups, true); - payload_ = vsomeip::runtime::get()->create_payload(); - - return true; - } - - void start() { - app_->start(); - } - -#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING - /* - * Handle signal to shutdown - */ - void stop() { - { - std::lock_guard<std::mutex> its_lock(shutdown_mutex_); - wait_for_shutdown_ = false; - shutdown_condition_.notify_one(); - } - app_->clear_all_handler(); - stop_offer(); - notify_thread_.join(); - app_->stop(); - } -#endif - - void offer() { - app_->offer_service(info_.service_id, info_.instance_id); - } - - void stop_offer() { - app_->stop_offer_service(info_.service_id, info_.instance_id); - } - - void on_state(vsomeip::state_type_e _state) { - std::cout << "Application " << app_->get_name() << " is " - << (_state == vsomeip::state_type_e::ST_REGISTERED ? - "registered." : "deregistered.") << std::endl; - - if (_state == vsomeip::state_type_e::ST_REGISTERED) { - offer(); - } - } - - void on_shutdown(const std::shared_ptr<vsomeip::message> &_message) { - std::shared_ptr<vsomeip::message> its_response - = vsomeip::runtime::get()->create_response(_message); - its_response->set_payload(payload_); - app_->send(its_response, true); - { - std::lock_guard<std::mutex> its_lock(shutdown_mutex_); - wait_for_shutdown_ = false; - shutdown_condition_.notify_one(); - } - } - - void on_set(const std::shared_ptr<vsomeip::message> &_message) { - std::shared_ptr<vsomeip::message> its_response - = vsomeip::runtime::get()->create_response(_message); - payload_ = _message->get_payload(); - its_response->set_payload(payload_); - app_->send(its_response, true); - 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); - } - - void wait_for_shutdown() { - { - std::unique_lock<std::mutex> its_lock(shutdown_mutex_); - while (wait_for_shutdown_) { - shutdown_condition_.wait(its_lock); - } - wait_for_shutdown_= true; - } - - app_->clear_all_handler(); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - stop_offer(); - app_->stop(); - } - -private: - std::shared_ptr<vsomeip::application> app_; - - std::mutex shutdown_mutex_; - bool wait_for_shutdown_; - std::condition_variable shutdown_condition_; - - std::shared_ptr<vsomeip::payload> payload_; - - subscribe_notify_test::service_info info_; - - std::thread notify_thread_; -}; - -#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING - subscribe_notify_test_one_event_two_eventgroups_service *its_service_ptr(nullptr); - void handle_signal(int _signal) { - if (its_service_ptr != nullptr && - (_signal == SIGINT || _signal == SIGTERM)) - its_service_ptr->stop(); - } -#endif - - -TEST(someip_subscribe_notify_test_one_event_two_eventgroups, wait_for_attribute_set) -{ - subscribe_notify_test_one_event_two_eventgroups_service its_service( - subscribe_notify_test::service_info_subscriber_based_notification); -#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING - its_service_ptr = &its_service; - signal(SIGINT, handle_signal); - signal(SIGTERM, handle_signal); -#endif - if (its_service.init()) { - its_service.start(); - } -} - -#ifndef _WIN32 -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif - - 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 deleted file mode 100755 index 8138612..0000000 --- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh +++ /dev/null @@ -1,45 +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. - -if [ $# -lt 1 ]; then - echo "Please pass a json file to this script." - echo "For example: $0 subscribe_notify_test_one_event_two_eventgroups_slave.json" - exit 1 -fi - -FAIL=0 - -export VSOMEIP_CONFIGURATION=$1 -# start daemon -../daemon/./vsomeipd & -PID_VSOMEIPD=$! - -# Start the services -./subscribe_notify_test_one_event_two_eventgroups_service & -PID_SERVICE=$! - -# wait until service exits successfully -wait $PID_SERVICE || FAIL=$(($FAIL+1)) - - -# kill daemon -kill $PID_VSOMEIPD -wait $PID_VSOMEIPD || FAIL=$(($FAIL+1)) - -echo "" - -# Check if both exited successfully -if [ $FAIL -eq 0 ]; then - exit 0 -else - exit 1 -fi diff --git a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp b/test/subscribe_notify_tests/subscribe_notify_test_service.cpp deleted file mode 100644 index 968d9ed..0000000 --- a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp +++ /dev/null @@ -1,520 +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 <atomic> - -#include <gtest/gtest.h> - -#include <vsomeip/vsomeip.hpp> -#include "../../implementation/logging/include/logger.hpp" - -#include "subscribe_notify_test_globals.hpp" - - -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), - wait_until_notified_from_other_services_(true), - offer_thread_(std::bind(&subscribe_notify_test_service::run, this)), - wait_for_stop_(true), - stop_thread_(std::bind(&subscribe_notify_test_service::wait_for_stop, this)), - wait_for_notify_(true), - notify_thread_(std::bind(&subscribe_notify_test_service::notify, this)), - subscription_state_handler_called_(0), - subscription_error_occured_(false) { - if (!app_->init()) { - ADD_FAILURE() << "Couldn't initialize application"; - return; - } - app_->register_state_handler( - std::bind(&subscribe_notify_test_service::on_state, this, - std::placeholders::_1)); - app_->register_message_handler(service_info_.service_id, - service_info_.instance_id, service_info_.method_id, - std::bind(&subscribe_notify_test_service::on_request, this, - std::placeholders::_1)); - app_->register_message_handler(vsomeip::ANY_SERVICE, - vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, - std::bind(&subscribe_notify_test_service::on_message, this, - std::placeholders::_1)); - - // offer event - 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); - - - // register availability for all other services and request their event. - for(const auto& i : service_infos_) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) { - continue; - } - app_->request_service(i.service_id, i.instance_id); - app_->register_availability_handler(i.service_id, i.instance_id, - std::bind(&subscribe_notify_test_service::on_availability, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - - auto handler = std::bind(&subscribe_notify_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); - - - 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); - - 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; - } - - // register subscription handler to detect whether or not all other - // other services have subscribed - 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)); - - app_->start(); - } - - ~subscribe_notify_test_service() { - offer_thread_.join(); - stop_thread_.join(); - } - - void offer() { - app_->offer_service(service_info_.service_id, service_info_.instance_id); - } - - void stop_offer() { - 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 " - << (_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) { - auto its_service = other_services_available_.find(std::make_pair(_service, _instance)); - 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 - << service_info_.service_id << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is available."; - - } - } - - 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;})) { - std::lock_guard<std::mutex> its_lock(mutex_); - wait_until_other_services_available_ = false; - condition_.notify_one(); - } - } - } - - void on_subscription_state_change(const vsomeip::service_t _service, const vsomeip::instance_t _instance, - const vsomeip::eventgroup_t _eventgroup, const vsomeip::event_t _event, const uint16_t _error) { - (void)_service; - (void)_instance; - (void)_eventgroup; - (void)_event; - - if (!_error) { - subscription_state_handler_called_++; - } else { - subscription_error_occured_ = true; - VSOMEIP_WARNING << 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) { - std::lock_guard<std::mutex> its_lock(subscribers_mutex_); - static bool notified(false); - if (_subscribed) { - subscribers_.insert(_client); - } else { - subscribers_.erase(_client); - } - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] " << "Client: " - << std::setw(4) << std::setfill('0') << std::hex << _client - << (_subscribed ? " subscribed" : " unsubscribed") - << ", now have " << std::dec << subscribers_.size() - << " subscribers" ; - // check if all other services have subscribed: - // -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 ) - { - // notify the notify thread to start sending out notifications - std::lock_guard<std::mutex> its_lock(notify_mutex_); - wait_for_notify_ = false; - notify_condition_.notify_one(); - notified = true; - } - return true; - } - - void on_request(const std::shared_ptr<vsomeip::message> &_message) { - if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) { - VSOMEIP_DEBUG << "Received a request 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() << "]"; - std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get() - ->create_response(_message); - app_->send(its_response); - } - } - - 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 << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] " - << "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())] << ")"; - - 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) { - std::lock_guard<std::mutex> its_lock(stop_mutex_); - wait_for_stop_ = false; - stop_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) - { - return v.second == subscribe_notify_test::notifications_to_send; - } - ); - } - - bool all_notifications_received_tcp_and_udp() { - std::uint32_t received_twice(0); - std::uint32_t received_normal(0); - for(const auto &v : other_services_received_notification_) { - if (v.second == subscribe_notify_test::notifications_to_send * 2) { - received_twice++; - } else if(v.second == subscribe_notify_test::notifications_to_send) { - received_normal++; - } - } - - if( received_twice == (service_infos_.size() - 1) / 2 - && received_normal == (service_infos_.size() - 1) / 2 - 1) { - // 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 - << service_info_.service_id << "] " - << "Received notifications:" - << " Normal: " << received_normal - << " Twice: " << received_twice; - return true; - } - return false; - } - - 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_other_services_available_) { - condition_.wait(its_lock); - } - - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Subscribing"; - // subscribe to events of other services - uint32_t subscribe_count = 0; - for(const subscribe_notify_test::service_info& i: service_infos_) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) { - continue; - } - ++subscribe_count; - app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id, - vsomeip::DEFAULT_MAJOR, subscription_type_); - VSOMEIP_DEBUG << "[" << std::hex << service_info_.service_id - << "] subscribing to Service/Instance/Eventgroup [" - << std::setw(4) << std::setfill('0') << std::hex << i.service_id << "/" - << std::setw(4) << std::setfill('0') << std::hex << i.instance_id - << "/" << std::setw(4) << std::setfill('0') << std::hex << i.eventgroup_id <<"]"; - } - - while (wait_until_notified_from_other_services_) { - condition_.wait(its_lock); - } - - // It is possible that we run in the case a subscription is NACKED - // due to TCP endpoint not completely connected when subscription - // is processed in the server - due to resubscribing the error handler - // count may differ from expected value, but its not a real but as - // the subscription takes places anyways and all events will be received. - if (!subscription_error_occured_) { - ASSERT_EQ(subscribe_count, subscription_state_handler_called_); - } else { - VSOMEIP_WARNING << "Subscription state handler check skipped: CallCount=" - << std::dec << subscription_state_handler_called_; - } - } - - void notify() { - std::unique_lock<std::mutex> its_lock(notify_mutex_); - while(wait_for_notify_) { - notify_condition_.wait(its_lock); - } - - // sleep a while before starting to notify this is necessary as it's not - // possible to detect if _all_ clients on the remote side have - // successfully subscribed as we only receive once subscription per - // remote node no matter how many clients subscribed to this eventgroup - // on the remote node - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - - 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_test::notifications_to_send; i++) { - std::shared_ptr<vsomeip::payload> its_payload = - vsomeip::runtime::get()->create_payload(); - - vsomeip::byte_t its_data[10] = {0}; - for (uint32_t j = 0; j < i+1; ++j) { - its_data[j] = static_cast<uint8_t>(j); - } - its_payload->set_data(its_data, i+1); - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Notifying: " << i+1; - app_->notify(service_info_.service_id, service_info_.instance_id, - service_info_.event_id, its_payload); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - } - - void wait_for_stop() { - std::unique_lock<std::mutex> its_lock(stop_mutex_); - while (wait_for_stop_) { - stop_condition_.wait(its_lock); - } - - // wait until all notifications have been sent out - notify_thread_.join(); - - VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id - << "] Received notifications from all other services, going down"; - - // let offer thread exit - { - std::lock_guard<std::mutex> its_lock(mutex_); - wait_until_notified_from_other_services_ = false; - condition_.notify_one(); - } - - stop_offer(); - - // ensure that the service which hosts the routing doesn't exit to early - if (app_->is_routing()) { - for (const auto& i : service_infos_) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) { - continue; - } - while (app_->is_available(i.service_id, i.instance_id, - vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR)) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - } - } - - std::this_thread::sleep_for(std::chrono::seconds(1)); - for(const auto& i : service_infos_) { - if ((i.service_id == service_info_.service_id - && i.instance_id == service_info_.instance_id) - || (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_->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(); - } - -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_; - - bool wait_until_registered_; - bool wait_until_other_services_available_; - bool wait_until_notified_from_other_services_; - std::mutex mutex_; - std::condition_variable condition_; - std::thread offer_thread_; - - bool wait_for_stop_; - std::mutex stop_mutex_; - std::condition_variable stop_condition_; - std::thread stop_thread_; - - std::set<vsomeip::client_t> subscribers_; - bool wait_for_notify_; - std::mutex notify_mutex_; - std::condition_variable notify_condition_; - std::thread notify_thread_; - std::atomic<uint32_t> subscription_state_handler_called_; - std::atomic<bool> subscription_error_occured_; - - std::mutex subscribers_mutex_; -}; - -static int service_number; -static vsomeip::subscription_type_e subscription_type; -static bool use_same_service_id; - -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); - } -} - -#ifndef _WIN32 -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; - 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; - } - - if (argc >= 4 && std::string("SAME_SERVICE_ID") == std::string(argv[3])) { - use_same_service_id = true; - } else { - use_same_service_id = false; - } - return RUN_ALL_TESTS(); -} -#endif diff --git a/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh deleted file mode 100755 index 9865536..0000000 --- a/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh +++ /dev/null @@ -1,73 +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. - -if [ $# -lt 2 ] -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_APPLICATION_NAME=subscribe_notify_test_service_five -export VSOMEIP_CONFIGURATION=$2 -./subscribe_notify_test_service 5 $1 $3 & - -export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_six -export VSOMEIP_CONFIGURATION=$2 -./subscribe_notify_test_service 6 $1 $3 & - -# Wait until all applications are finished -for job in $(jobs -p) -do - # Fail gets incremented if one of the binaries exits - # with a non-zero exit code - wait $job || ((FAIL+=1)) -done - -# Check if both exited successfully -if [ $FAIL -eq 0 ] -then - exit 0 -else - exit 1 -fi |