diff options
author | Felix Herrmann <fherrmann@de.adit-jv.com> | 2020-05-25 15:30:41 +0200 |
---|---|---|
committer | Saya Sugiura <39760799+ssugiura@users.noreply.github.com> | 2020-07-06 10:04:07 +0900 |
commit | b100074e1fe1c80f57fe295b7f05d6186e279004 (patch) | |
tree | 5c227c5a982f5c41c21c7d792d288134a1cb0e94 /tests/CMakeLists.txt | |
parent | 03a35d3d7d7730c881e5ac20a2087c0ab8914d47 (diff) | |
download | DLT-daemon-b100074e1fe1c80f57fe295b7f05d6186e279004.tar.gz |
execute unittests with cmake
now you can do make test after make :)
=== Sample build and test:
$ cmake -Bbuild -H. \
-DDLT_IPC=UNIX_SOCKET \
-DWITH_DLT_ADAPTOR=ON \
-DWITH_DLT_UNIT_TESTS=ON \
-DWITH_DLT_CXX11_EXT=ON \
-DWITH_DLT_MONITOR=OFF \
-DWITH_DLT_USE_IPv6=OFF
$ cd build
$ make
$ make test
Running tests...
Test project /home/fherrmann/git/dlt-daemon/build
Start 1: gtest_dlt_common
1/5 Test #1: gtest_dlt_common ................. Passed 0.02 sec
Start 2: gtest_dlt_user
2/5 Test #2: gtest_dlt_user ................... Passed 1.01 sec
Start 3: gtest_dlt_daemon_common
3/5 Test #3: gtest_dlt_daemon_common .......... Passed 0.01 sec
Start 4: dlt_env_ll_unit_test
4/5 Test #4: dlt_env_ll_unit_test ............. Passed 0.04 sec
Start 5: gtest_dlt_daemon_event_handler
5/5 Test #5: gtest_dlt_daemon_event_handler ... Passed 1.01 sec
100% tests passed, 0 tests failed out of 5
Total Test time (real) = 2.09 sec
===
Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com>
Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r-- | tests/CMakeLists.txt | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index db9160c..53b3949 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,3 @@ -# Setup testing -enable_testing() - #add_compile_options(-g -fsanitize=address) add_compile_options(-isystem ${gtest_SOURCE_DIR}/include) @@ -20,29 +17,51 @@ if(WITH_SYSTEMD OR WITH_SYSTEMD_WATCHDOG OR WITH_SYSTEMD_JOURNAL) 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}) + 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) -target_link_libraries(gtest_dlt_common ${DLT_LIBRARIES}) -target_link_libraries(gtest_dlt_user ${DLT_LIBRARIES}) -target_link_libraries(gtest_dlt_daemon_common ${DLT_LIBRARIES}) -target_link_libraries(dlt_test_receiver dlt) -target_link_libraries(dlt_env_ll_unit_test ${DLT_LIBRARIES}) -target_link_libraries(dlt-test-preregister-context ${DLT_LIBRARIES}) -target_link_libraries(gtest_dlt_daemon_gateway ${DLT_DAEMON_LIBRARIES}) -target_link_libraries(gtest_dlt_daemon_event_handler ${DLT_DAEMON_LIBRARIES}) -target_link_libraries(gtest_dlt_daemon_offline_log ${DLT_DAEMON_LIBRARIES}) - if(WITH_DLT_SHM_ENABLE) target_link_libraries(gtest_dlt_shm ${DLT_DAEMON_LIBRARIES}) endif(WITH_DLT_SHM_ENABLE) |