mirror of https://github.com/gnss-sdr/gnss-sdr
Add options to enable/disable building of unit and system testing
Unit Testing is enabled by default. In some memory-constrained environments it can be useful to disable its building. It can be disabled by setting -DENABLE_UNIT_TESTING=OFF System testing is disabled by default. It can be build by setting -DENABLE_SYSTEM_TESTING=ON
This commit is contained in:
parent
3a10f3c26b
commit
ff4c323b01
|
@ -59,6 +59,9 @@ if(ENABLE_PACKAGING)
|
|||
set(ENABLE_GENERIC_ARCH ON)
|
||||
endif(ENABLE_PACKAGING)
|
||||
|
||||
# Testing
|
||||
option(ENABLE_SYSTEM_TESTING "Builds system tests" OFF)
|
||||
option(ENABLE_UNIT_TESTING "Builds unit tests" ON)
|
||||
|
||||
###############################
|
||||
# GNSS-SDR version information
|
||||
|
@ -296,6 +299,7 @@ endif(NOT ENABLE_GENERIC_ARCH)
|
|||
# Googletest - https://github.com/google/googletest
|
||||
################################################################################
|
||||
enable_testing()
|
||||
if(ENABLE_UNIT_TESTING OR ENABLE_SYSTEM_TESTING)
|
||||
if(EXISTS $ENV{GTEST_DIR})
|
||||
set(GTEST_DIR $ENV{GTEST_DIR})
|
||||
endif(EXISTS $ENV{GTEST_DIR})
|
||||
|
@ -319,6 +323,7 @@ else(GTEST_DIR)
|
|||
message (STATUS " when doing 'make'. ")
|
||||
endif(LIBGTEST_DEV_DIR)
|
||||
endif(GTEST_DIR)
|
||||
endif(ENABLE_UNIT_TESTING OR ENABLE_SYSTEM_TESTING)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -19,5 +19,7 @@
|
|||
add_subdirectory(algorithms)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(main)
|
||||
if(ENABLE_UNIT_TESTING OR ENABLE_SYSTEM_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif(ENABLE_UNIT_TESTING OR ENABLE_SYSTEM_TESTING)
|
||||
add_subdirectory(utils)
|
||||
|
|
|
@ -164,7 +164,7 @@ endif(ENABLE_CUDA)
|
|||
|
||||
add_definitions(-DTEST_PATH="${CMAKE_SOURCE_DIR}/src/tests/")
|
||||
|
||||
|
||||
if(ENABLE_UNIT_TESTING)
|
||||
add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc)
|
||||
|
||||
add_custom_command(TARGET run_tests POST_BUILD
|
||||
|
@ -192,7 +192,7 @@ target_link_libraries(run_tests ${CLANG_FLAGS}
|
|||
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
|
||||
${GNSS_SDR_TEST_OPTIONAL_LIBS}
|
||||
)
|
||||
|
||||
endif(ENABLE_UNIT_TESTING)
|
||||
|
||||
#########################################################
|
||||
# Adding Tests to Ctest
|
||||
|
@ -375,6 +375,7 @@ add_dependencies(check control_thread_test flowgraph_test gnss_block_test
|
|||
|
||||
|
||||
# Addition of System Tests
|
||||
if(ENABLE_SYSTEM_TESTING)
|
||||
add_executable(ttff
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/system-tests/ttff_gps_l1.cc )
|
||||
if(NOT ${GTEST_DIR_LOCAL})
|
||||
|
@ -387,9 +388,17 @@ target_link_libraries(ttff
|
|||
${GFLAGS_LIBS}
|
||||
${GLOG_LIBRARIES}
|
||||
${GTEST_LIBRARIES}
|
||||
${GNURADIO_RUNTIME_LIBRARIES}
|
||||
${GNURADIO_BLOCKS_LIBRARIES}
|
||||
${GNURADIO_FILTER_LIBRARIES}
|
||||
${GNURADIO_ANALOG_LIBRARIES}
|
||||
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
|
||||
gnss_sp_libs
|
||||
gnss_rx
|
||||
gnss_system_parameters
|
||||
)
|
||||
add_custom_command(TARGET ttff POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ttff>
|
||||
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:ttff>
|
||||
)
|
||||
endif(ENABLE_SYSTEM_TESTING)
|
Loading…
Reference in New Issue