summaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
blob: 26edca432e62e195f7b6079ad2703e21f2942fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#add_compile_options(-g -fsanitize=address)
add_compile_options(-isystem ${gtest_SOURCE_DIR}/include)

configure_file(${PROJECT_SOURCE_DIR}/tests/testfile.dlt ${PROJECT_BINARY_DIR}/tests COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/tests/testfilter.txt ${PROJECT_BINARY_DIR}/tests COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/tests/testfile_filetransfer.txt ${PROJECT_BINARY_DIR}/tests COPYONLY)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
    set(LIBRARIES gtest gtest_main)
else()
    set(LIBRARIES gtest socket)
endif()

set(DLT_LIBRARIES ${LIBRARIES} dlt)
set(DLT_DAEMON_LIBRARIES ${LIBRARIES} dlt_daemon)
set(DLT_CONTROL_LIBRARIES ${LIBRARIES} dlt dlt_control_common_lib)

if(WITH_SYSTEMD OR WITH_SYSTEMD_WATCHDOG OR WITH_SYSTEMD_JOURNAL)
  add_definitions( -DSD_EXPORT_SYMBOLS )
endif()

add_executable(gtest_dlt_common gtest_dlt_common.cpp)
target_link_libraries(gtest_dlt_common ${DLT_LIBRARIES})
add_test(NAME gtest_dlt_common
    COMMAND gtest_dlt_common
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

if(WITH_EXTENDED_FILTERING)
    configure_file(${PROJECT_SOURCE_DIR}/tests/testfile_extended.dlt ${PROJECT_BINARY_DIR}/tests COPYONLY)
    configure_file(${PROJECT_SOURCE_DIR}/tests/testfilter.json ${PROJECT_BINARY_DIR}/tests COPYONLY)
    add_executable(gtest_dlt_json_filter gtest_dlt_json_filter.cpp)
    target_link_libraries(gtest_dlt_json_filter ${DLT_CONTROL_LIBRARIES})
    add_test(NAME gtest_dlt_json_filter
        COMMAND gtest_dlt_json_filter
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()

add_executable(gtest_dlt_user gtest_dlt_user.cpp)
target_link_libraries(gtest_dlt_user ${DLT_LIBRARIES})
add_test(NAME gtest_dlt_user
    COMMAND gtest_dlt_user
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(gtest_dlt_daemon_common gtest_dlt_daemon_common.cpp ../src/daemon/dlt_daemon_common.c)
target_link_libraries(gtest_dlt_daemon_common ${DLT_LIBRARIES})
add_test(NAME gtest_dlt_daemon_common
    COMMAND gtest_dlt_daemon_common
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(dlt_test_receiver dlt_test_receiver.c)
target_link_libraries(dlt_test_receiver dlt)

add_executable(dlt_env_ll_unit_test dlt_env_ll_unit_test.cpp)
target_link_libraries(dlt_env_ll_unit_test ${DLT_LIBRARIES})
add_test(NAME dlt_env_ll_unit_test
    COMMAND gtest_dlt_common
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(dlt-test-preregister-context dlt-test-preregister-context.c)
target_link_libraries(dlt-test-preregister-context ${DLT_LIBRARIES})

add_executable(gtest_dlt_daemon_gateway gtest_dlt_daemon_gateway.cpp ${systemd_SRCS})
target_link_libraries(gtest_dlt_daemon_gateway ${DLT_DAEMON_LIBRARIES})

add_executable(gtest_dlt_daemon_event_handler gtest_dlt_daemon_event_handler.cpp ${systemd_SRCS})
target_link_libraries(gtest_dlt_daemon_event_handler ${DLT_DAEMON_LIBRARIES})
add_test(NAME gtest_dlt_daemon_event_handler
    COMMAND gtest_dlt_daemon_event_handler
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(gtest_dlt_daemon_offline_log gtest_dlt_daemon_offline_log.cpp ${systemd_SRCS})
target_link_libraries(gtest_dlt_daemon_offline_log ${DLT_DAEMON_LIBRARIES})

if(WITH_DLT_SHM_ENABLE)
    add_executable(gtest_dlt_shm gtest_dlt_shm.cpp)
endif(WITH_DLT_SHM_ENABLE)

if(WITH_DLT_SHM_ENABLE)
    target_link_libraries(gtest_dlt_shm ${DLT_DAEMON_LIBRARIES})
endif(WITH_DLT_SHM_ENABLE)

if(WITH_DLT_CXX11_EXT)
  add_executable(dlt-test-cpp-extension dlt-test-cpp-extension.cpp)
  target_link_libraries(dlt-test-cpp-extension ${DLT_LIBRARIES})
endif()