diff options
Diffstat (limited to 'src/components/application_manager/test/CMakeLists.txt')
-rw-r--r-- | src/components/application_manager/test/CMakeLists.txt | 186 |
1 files changed, 107 insertions, 79 deletions
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt index 473ae6765e..118cda4fcb 100644 --- a/src/components/application_manager/test/CMakeLists.txt +++ b/src/components/application_manager/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2014, Ford Motor Company +# Copyright (c) 2015, Ford Motor Company # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -31,66 +31,61 @@ # TODO{ALeshin}: APPLINK-10792. Do not write tests which use # application manager(AM) singleton while refactoring of AM is finished. -# Replace include for mocking singltone -get_property(the_include_dirs DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES) -set(class_to_mock ${CMAKE_SOURCE_DIR}/src/components/application_manager/include) -list(FIND the_include_dirs ${class_to_mock} find_idx) -if(find_idx GREATER -1) - LIST_REPLACE(the_include_dirs ${find_idx} ${AM_MOCK_DIR}/include) -endif() -set_property(DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES ${the_include_dirs}) - -include_directories( - ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/include - ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include - ${COMPONENTS_DIR}/application_manager/include/application_manager/ - ${COMPONENTS_DIR}/application_manager/include/application_manager/policies -) - -set(testSources - #${AM_TEST_DIR}/command_impl_test.cc - ${COMPONENTS_DIR}/application_manager/test/mobile_message_handler_test.cc - #${AM_TEST_DIR}/request_info_test.cc -) - -set(mockedSources - ${AM_MOCK_DIR}/src/application_manager_impl.cc -) - -set(AM_SOURCES - ${AM_SOURCE_DIR}/src/policies/policy_handler.cc - ${AM_SOURCE_DIR}/src/policies/policy_event_observer.cc - - ${AM_SOURCE_DIR}/src/commands/command_impl.cc - ${AM_SOURCE_DIR}/src/commands/command_request_impl.cc - ${AM_SOURCE_DIR}/src/commands/command_response_impl.cc - ${AM_SOURCE_DIR}/src/commands/command_notification_impl.cc - ${AM_SOURCE_DIR}/src/commands/command_notification_from_mobile_impl.cc - ${AM_SOURCE_DIR}/src/commands/pending.cc - - ${AM_SOURCE_DIR}/src/usage_statistics.cc - ${AM_SOURCE_DIR}/src/request_info.cc - ${AM_SOURCE_DIR}/src/message.cc - ${AM_SOURCE_DIR}/src/application_impl.cc - ${AM_SOURCE_DIR}/src/state_controller.cc - ${AM_SOURCE_DIR}/src/mobile_command_factory.cc - ${AM_SOURCE_DIR}/src/message_helper.cc - ${AM_SOURCE_DIR}/src/hmi_command_factory.cc - ${AM_SOURCE_DIR}/src/hmi_capabilities.cc - ${AM_SOURCE_DIR}/src/application_data_impl.cc - ${AM_SOURCE_DIR}/src/request_controller.cc - ${AM_SOURCE_DIR}/src/resume_ctrl.cpp - ${AM_SOURCE_DIR}/src/mobile_message_handler.cc -) +if (BUILD_TESTS) + include_directories( - ${AM_SOURCE_DIR}/policy/src/policy/policy_table/table_struct + ${GMOCK_INCLUDE_DIRECTORY} + ${CMAKE_BINARY_DIR}/src/components/ + ${COMPONENTS_DIR}/application_manager/include/ + ${COMPONENTS_DIR}/utils/include/ + ${COMPONENTS_DIR}/resumption/include/ + ${COMPONENTS_DIR}/utils/include/ + ${COMPONENTS_DIR}/policy/include/ + ${COMPONENTS_DIR}/media_manager/include/ + ${COMPONENTS_DIR}/security_manager/include/ + ${COMPONENTS_DIR}/policy/test/include/ + ${COMPONENTS_DIR}/application_manager/test/include/ + ) + + set(testSources + ${AM_TEST_DIR}/mobile_message_handler_test.cc + ${AM_TEST_DIR}/mobile_message_handler_v1_test.cc + ${AM_TEST_DIR}/request_info_test.cc + ${AM_TEST_DIR}/resumption_sql_queries_test.cc + ${AM_TEST_DIR}/event_engine_test.cc + ${AM_TEST_DIR}/policy_event_observer_test.cc + ${AM_TEST_DIR}/application_impl_test.cc + ${AM_TEST_DIR}/hmi_capabilities_test.cc + ${AM_TEST_DIR}/application_state_test.cc + ${AM_TEST_DIR}/usage_statistics_test.cc + ${AM_TEST_DIR}/policy_handler_test.cc + ${AM_TEST_DIR}/mock_message_helper.cc + ) + set (request_controller_SOURCES + ${AM_TEST_DIR}/request_controller/request_controller_test.cc ) + set(testLibraries - gmock + ApplicationManager + Utils + dbms + jsoncpp + Policy + connectionHandler + HMI_API + MOBILE_API + v4_protocol_v1_2_no_extra + SmartObjects + formatters gmock_main UsageStatistics dl ProtocolLibrary + ConfigProfile + MediaManager + Resumption + ProtocolHandler + SecurityManager ) set(test_exec_libraries @@ -113,32 +108,65 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "QNX") list(REMOVE_ITEM test_exec_libraries dl) endif() -if(ENABLE_LOG) - list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) - list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) - list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) - list(APPEND LIBRARIES expat -L${EXPAT_LIBS_DIRECTORY}) -endif() + set(testLibraries + Utils + ApplicationManager + jsoncpp + Policy + connectionHandler + HMI_API + MOBILE_API + v4_protocol_v1_2_no_extra + SmartObjects + formatters + gmock_main + UsageStatistics + dl + ProtocolLibrary + ConfigProfile + MediaManager + Resumption + ProtocolHandler + SecurityManager + ) -add_library("ApplicationManagerTest" ${mockedSources} ${testSources}) + if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") + list(REMOVE_ITEM test_exec_libraries dl) + endif() -target_link_libraries("ApplicationManagerTest" ${testLibraries} AMHMICommandsLibrary - AMMobileCommandsLibrary - AMEventEngine - AMPolicyLibrary) + if (ENABLE_LOG) + list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) + list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) + list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) + list(APPEND LIBRARIES expat -L${EXPAT_LIBS_DIRECTORY}) + endif() -create_test("application_manager_test" "${testSources}" "${ApplicationManagerTest}") -target_link_libraries("application_manager_test" - ApplicationManagerTest ${test_exec_libraries} - ApplicationManager - ProtocolLibrary - connectionHandler - ConfigProfile - jsoncpp - MediaManager - ProtocolHandler - Resumption -) + file(COPY smartDeviceLink_test2.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -#add_executable(application_manager_test ${testSources}) -#target_link_libraries(application_manager_test ApplicationManagerTest ${test_exec_libraries}) +add_custom_command( +OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libPolicy.so + COMMAND ${CMAKE_COMMAND} -E + copy ${COMPONENTS_DIR}/policy/libPolicy.so ${CMAKE_CURRENT_BINARY_DIR}) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR}") + create_test("application_manager_test" "${testSources}" "${testLibraries}" ) +# TODO [AKozoriz] : Fix not buildable tests + set(ResumptionData_SOURCES + ${AM_TEST_DIR}/resumption/resumption_data_test.cc + ${AM_TEST_DIR}/resumption/resumption_data_db_test.cc + ${AM_TEST_DIR}/resumption/resumption_data_json_test.cc + ${AM_TEST_DIR}/resumption/resume_ctrl_test.cc + ${AM_TEST_DIR}/mock_message_helper.cc + ) + + file(COPY hmi_capabilities.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resumption) + file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/resumption) + create_test("resumption/data_resumption_test" "${ResumptionData_SOURCES}" "${testLibraries}") + + add_subdirectory(state_controller) +endif() |