mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 16:03:33 +08:00
lib/matrix: delete unused and add testing to PX4
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
include(gtest.cmake)
|
||||
#include(gtest.cmake)
|
||||
|
||||
add_compile_options(
|
||||
-Wno-double-promotion
|
||||
-Wno-float-equal
|
||||
)
|
||||
|
||||
set(tests
|
||||
setIdentity
|
||||
@@ -15,7 +20,6 @@ set(tests
|
||||
attitude
|
||||
filter
|
||||
integration
|
||||
sparseVector
|
||||
squareMatrix
|
||||
helper
|
||||
hatvee
|
||||
@@ -24,44 +28,19 @@ set(tests
|
||||
upperRightTriangle
|
||||
dual
|
||||
pseudoInverse
|
||||
)
|
||||
)
|
||||
|
||||
add_custom_target(test_build)
|
||||
foreach(test_name ${tests})
|
||||
add_executable(${test_name}
|
||||
${test_name}.cpp)
|
||||
add_test(test_${test_name} ${test_name})
|
||||
add_dependencies(test_build ${test_name})
|
||||
add_executable(test-matrix_${test_name} ${test_name}.cpp)
|
||||
|
||||
add_test(NAME test-matrix_${test_name}
|
||||
COMMAND test-matrix_${test_name}
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_dependencies(test_build test-matrix_${test_name})
|
||||
add_dependencies(test_results test-matrix_${test_name})
|
||||
endforeach()
|
||||
target_link_libraries(sparseVector gtest_main)
|
||||
|
||||
if (${CMAKE_BUILD_TYPE} STREQUAL "Coverage")
|
||||
|
||||
add_custom_target(coverage_build
|
||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
COMMAND lcov --capture --directory . --output-file coverage.info --rc lcov_branch_coverage=1
|
||||
COMMAND lcov --rc lcov_branch_coverage=1 --summary coverage.info
|
||||
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
||||
DEPENDS test_build
|
||||
)
|
||||
|
||||
add_custom_target(coverage_html
|
||||
COMMAND genhtml coverage.info --output-directory out --branch-coverage
|
||||
COMMAND x-www-browser out/index.html
|
||||
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
||||
DEPENDS coverage_build
|
||||
)
|
||||
|
||||
set(coverage_deps
|
||||
coverage_build)
|
||||
|
||||
if (COV_HTML)
|
||||
list(APPEND coverage_deps coverage_html)
|
||||
endif()
|
||||
|
||||
add_custom_target(coverage
|
||||
DEPENDS ${coverage_deps}
|
||||
)
|
||||
endif()
|
||||
|
||||
# vim: set et fenc=utf-8 ft=cmake ff=unix sts=0 sw=4 ts=4 :
|
||||
px4_add_unit_gtest(SRC sparseVector.cpp)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8.4)
|
||||
|
||||
project(googletest-download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googletest
|
||||
URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip
|
||||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
|
||||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
# Wrap download, configure and build steps in a script to log output
|
||||
LOG_DOWNLOAD ON
|
||||
LOG_CONFIGURE ON
|
||||
LOG_BUILD ON
|
||||
)
|
||||
@@ -1,12 +0,0 @@
|
||||
set_directory_properties(PROPERTIES COMPILE_OPTIONS "")
|
||||
|
||||
# Download and unpack googletest at configure time
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in googletest-download/CMakeLists.txt)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . RESULT_VARIABLE result1 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build . RESULT_VARIABLE result2 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download)
|
||||
if(result1 OR result2)
|
||||
message(FATAL_ERROR "Preparing googletest failed: ${result1} ${result2}")
|
||||
endif()
|
||||
|
||||
# Add googletest, defines gtest and gtest_main targets
|
||||
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src ${CMAKE_CURRENT_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL)
|
||||
Reference in New Issue
Block a user