-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
482 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,256 +1,31 @@ | ||
find_package(rostest REQUIRED) | ||
|
||
# TimeoutManager | ||
add_subdirectory(./attitude_converter) | ||
|
||
add_rostest_gtest(TimeoutManagerTest | ||
timeout_manager/timeout_manager.test | ||
timeout_manager/test.cpp | ||
) | ||
add_subdirectory(./geometry) | ||
|
||
target_link_libraries(TimeoutManagerTest | ||
MrsLib_TimeoutManager | ||
MrsLib_Utils | ||
${catkin_LIBRARIES} | ||
) | ||
add_subdirectory(./math) | ||
|
||
add_dependencies(TimeoutManagerTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
add_subdirectory(./median_filter) | ||
|
||
# MathTest | ||
add_subdirectory(./param_loader) | ||
|
||
add_rostest_gtest(MathTest | ||
math/math.test | ||
math/test.cpp | ||
) | ||
add_subdirectory(./publisher_handler) | ||
|
||
target_link_libraries(MathTest | ||
MrsLib_Math | ||
${catkin_LIBRARIES} | ||
) | ||
add_subdirectory(./repredictor) | ||
|
||
add_dependencies(MathTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
add_subdirectory(./service_client_handler) | ||
|
||
# GeometryTest | ||
add_subdirectory(./subscribe_handler) | ||
|
||
add_rostest_gtest(GeometryTest | ||
geometry/geometry.test | ||
geometry/test.cpp | ||
) | ||
add_subdirectory(./timeout_manager) | ||
|
||
target_link_libraries(GeometryTest | ||
MrsLib_Geometry | ||
${catkin_LIBRARIES} | ||
) | ||
add_subdirectory(./timer) | ||
|
||
add_dependencies(GeometryTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
add_subdirectory(./transformer) | ||
|
||
# AttitudeConverterTest | ||
add_subdirectory(./ukf) | ||
|
||
add_rostest_gtest(AttitudeConverterTest | ||
attitude_converter/attitude_converter.test | ||
attitude_converter/test.cpp | ||
) | ||
add_subdirectory(./utils) | ||
|
||
target_link_libraries(AttitudeConverterTest | ||
MrsLib_AttitudeConverter | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(AttitudeConverterTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# UtilsTest | ||
|
||
add_rostest_gtest(UtilsTest | ||
utils/utils.test | ||
utils/test.cpp | ||
) | ||
|
||
target_link_libraries(UtilsTest | ||
MrsLib_Utils | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(UtilsTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# UkfTest | ||
|
||
add_rostest_gtest(UkfTest | ||
ukf/ukf.test | ||
ukf/test.cpp | ||
) | ||
|
||
target_link_libraries(UkfTest | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(UkfTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# TransformerTest | ||
|
||
add_rostest_gtest(TransformerTest | ||
transformer/transformer.test | ||
transformer/test.cpp | ||
) | ||
|
||
target_link_libraries(TransformerTest | ||
MrsLib_Transformer | ||
MrsLib_Geometry | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(TransformerTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# ParamLoaderTest | ||
|
||
add_rostest_gtest(ParamLoaderTest | ||
param_loader/param_loader.test | ||
param_loader/test.cpp | ||
) | ||
|
||
target_link_libraries(ParamLoaderTest | ||
MrsLib_ParamLoader | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(ParamLoaderTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# SubscribeHandlerTest | ||
|
||
add_rostest_gtest(SubscribeHandlerTest | ||
subscribe_handler/subscribe_handler.test | ||
subscribe_handler/test.cpp | ||
) | ||
|
||
target_link_libraries(SubscribeHandlerTest | ||
MrsLib_TimeoutManager | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(SubscribeHandlerTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# RepredictorTest | ||
|
||
add_rostest_gtest(RepredictorTest | ||
repredictor/repredictor.test | ||
repredictor/test.cpp | ||
) | ||
|
||
target_link_libraries(RepredictorTest | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(RepredictorTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# TimerTest | ||
|
||
add_rostest_gtest(TimerTest | ||
timer/timer.test | ||
timer/test.cpp | ||
) | ||
|
||
target_link_libraries(TimerTest | ||
MrsLib_Timer | ||
MrsLib_Utils | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(TimerTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# MedianFilterTest | ||
|
||
add_rostest_gtest(MedianFilterTest | ||
median_filter/median_filter.test | ||
median_filter/test.cpp | ||
) | ||
|
||
target_link_libraries(MedianFilterTest | ||
MrsLib_MedianFilter | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(MedianFilterTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# ServiceClientHandlerTest | ||
|
||
add_rostest_gtest(ServiceClientHandlerTest | ||
service_client_handler/service_client_handler.test | ||
service_client_handler/test.cpp | ||
) | ||
|
||
target_link_libraries(ServiceClientHandlerTest | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(ServiceClientHandlerTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# PublisherHandlerTest | ||
|
||
add_rostest_gtest(PublisherHandlerTest | ||
publisher_handler/publisher_handler.test | ||
publisher_handler/test.cpp | ||
) | ||
|
||
target_link_libraries(PublisherHandlerTest | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(PublisherHandlerTest | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
# add_rostest_gtest(VectorConverterTest | ||
# vector_converter/vector_converter.test | ||
# vector_converter/test.cpp | ||
# ) | ||
# | ||
# target_link_libraries(VectorConverterTest | ||
# ${catkin_LIBRARIES} | ||
# ) | ||
# | ||
# target_include_directories(VectorConverterTest PRIVATE | ||
# ${pcl_ros_INCLUDE_DIRS} | ||
# ) | ||
# | ||
# add_dependencies(VectorConverterTest | ||
# ${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
# ${catkin_EXPORTED_TARGETS} | ||
# ) | ||
add_subdirectory(./vector_converter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
get_filename_component(TEST_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME) | ||
|
||
catkin_add_executable_with_gtest(test_${TEST_NAME} | ||
test.cpp | ||
) | ||
|
||
target_link_libraries(test_${TEST_NAME} | ||
MrsLib_AttitudeConverter | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(test_${TEST_NAME} | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
add_rostest(${TEST_NAME}.test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
<launch> | ||
|
||
<test pkg="mrs_lib" type="AttitudeConverterTest" test-name="attitude_converter_test" time-limit="10.0"> | ||
<arg name="this_path" default="$(dirname)" /> | ||
|
||
<!-- automatically deduce the test name --> | ||
<arg name="test_name" default="$(eval arg('this_path').split('/')[-1])" /> | ||
|
||
<!-- automatically deduce the package name --> | ||
<arg name="import_eval" default="eval('_' + '_import_' + '_')"/> | ||
<arg name="package_eval" default="eval(arg('import_eval') + '(\'rospkg\')').get_package_name(arg('this_path'))" /> | ||
<arg name="package" default="$(eval eval(arg('package_eval')))" /> | ||
|
||
<test pkg="$(arg package)" type="test_$(arg test_name)" test-name="$(arg test_name)" time-limit="60.0"> | ||
</test> | ||
|
||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG | ||
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR | ||
|
||
# build the package | ||
catkin build --this # it has to be fully built normally before building with --catkin-make-args tests | ||
catkin build --this -DMRS_ENABLE_TESTING=1 --no-deps --catkin-make-args tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
while [ ! -e ".catkin_tools" ]; do | ||
cd .. | ||
if [[ `pwd` == "/" ]]; then | ||
# we reached the root and didn't find the build/COLCON_IGNORE file - that's a fail! | ||
echo "$0: could not find the root of the current workspace". | ||
return 1 | ||
fi | ||
done | ||
|
||
WORKSPACE_NAME=${PWD##*/} | ||
|
||
cd build | ||
|
||
lcov --capture --directory . --output-file coverage.info | ||
lcov --remove coverage.info "*/test/*" --output-file coverage.info.removed | ||
lcov --extract coverage.info.removed "*/${WORKSPACE_NAME}/src/*" --output-file coverage.info.cleaned | ||
genhtml --title "MRS UAV System - Test coverage report" --demangle-cpp --legend --frames --show-details -o coverage_html coverage.info.cleaned | tee /tmp/genhtml.log | ||
|
||
COVERAGE_PCT=`cat /tmp/genhtml.log | tail -n 1 | awk '{print $2}'` | ||
|
||
echo "Coverage: $COVERAGE_PCT" | ||
|
||
xdg-open coverage_html/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
get_filename_component(TEST_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME) | ||
|
||
catkin_add_executable_with_gtest(test_${TEST_NAME} | ||
test.cpp | ||
) | ||
|
||
target_link_libraries(test_${TEST_NAME} | ||
MrsLib_Geometry | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
add_dependencies(test_${TEST_NAME} | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
${catkin_EXPORTED_TARGETS} | ||
) | ||
|
||
add_rostest(${TEST_NAME}.test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
<launch> | ||
|
||
<test pkg="mrs_lib" type="GeometryTest" test-name="geometry_test" time-limit="10.0"> | ||
<arg name="this_path" default="$(dirname)" /> | ||
|
||
<!-- automatically deduce the test name --> | ||
<arg name="test_name" default="$(eval arg('this_path').split('/')[-1])" /> | ||
|
||
<!-- automatically deduce the package name --> | ||
<arg name="import_eval" default="eval('_' + '_import_' + '_')"/> | ||
<arg name="package_eval" default="eval(arg('import_eval') + '(\'rospkg\')').get_package_name(arg('this_path'))" /> | ||
<arg name="package" default="$(eval eval(arg('package_eval')))" /> | ||
|
||
<test pkg="$(arg package)" type="test_$(arg test_name)" test-name="$(arg test_name)" time-limit="60.0"> | ||
</test> | ||
|
||
</launch> |
Oops, something went wrong.