Skip to content

Commit

Permalink
refactored tests agains new mrs_uav_testing api
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Dec 16, 2023
1 parent 18ab312 commit 0a092aa
Show file tree
Hide file tree
Showing 55 changed files with 506 additions and 1,389 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set(CATKIN_DEPENDENCIES
sensor_msgs
std_msgs
tf2_geometry_msgs
mrs_uav_testing
)

find_package(catkin REQUIRED COMPONENTS
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<depend>sensor_msgs</depend>
<depend>std_msgs</depend>
<depend>tf2_geometry_msgs</depend>
<depend>mrs_uav_testing</depend>

<exec_depend>pluginlib</exec_depend>
<exec_depend>tf2_ros</exec_depend>
Expand Down
82 changes: 4 additions & 78 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,83 +1,9 @@
find_package(rostest REQUIRED)

# Corrections test
add_subdirectory(gps_baro)

## DOES NOT COMPILE
# add_rostest_gtest(CorrectionsTest
# corrections/corrections.test
# corrections/test_corrections.cpp
# )
add_subdirectory(gps_garmin)

# target_link_libraries(CorrectionsTest
# mrs_lib
# ${catkin_LIBRARIES}
# )
add_subdirectory(rtk)

# add_dependencies(CorrectionsTest
# ${${PROJECT_NAME}_EXPORTED_TARGETS}
# ${catkin_EXPORTED_TARGETS}
# )

# GpsBaro basic

add_rostest_gtest(GpsBaro_basic
gps_baro/basic/gps_baro_basic.test
gps_baro/basic/test.cpp
)

target_link_libraries(GpsBaro_basic
${catkin_LIBRARIES}
)

add_dependencies(GpsBaro_basic
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)

# GpsGarmin basic

add_rostest_gtest(GpsGarmin_basic
gps_garmin/basic/gps_garmin_basic.test
gps_garmin/basic/test.cpp
)

target_link_libraries(GpsGarmin_basic
${catkin_LIBRARIES}
)

add_dependencies(GpsGarmin_basic
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)

# Rtk basic

add_rostest_gtest(Rtk_basic
rtk/basic/rtk_basic.test
rtk/basic/test.cpp
)

target_link_libraries(Rtk_basic
${catkin_LIBRARIES}
)

add_dependencies(Rtk_basic
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)

# RtkGarmin basic

add_rostest_gtest(RtkGarmin_basic
rtk_garmin/basic/rtk_garmin_basic.test
rtk_garmin/basic/test.cpp
)

target_link_libraries(RtkGarmin_basic
${catkin_LIBRARIES}
)

add_dependencies(RtkGarmin_basic
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)
add_subdirectory(rtk_garmin)
29 changes: 3 additions & 26 deletions test/all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,8 @@ set -e
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR

PACKAGE="mrs_uav_state_estimators"
VERBOSE=1

[ "$VERBOSE" = "0" ] && TEXT_OUTPUT=""
[ "$VERBOSE" = "1" ] && TEXT_OUTPUT="-t"

# build the package
catkin build $PACKAGE # it has to be fully built normally before building with --catkin-make-args tests
catkin build $PACKAGE --no-deps --catkin-make-args tests

TEST_FILES=$(find . -name "*.test" -type f -printf "%f\n")

for TEST_FILE in `echo $TEST_FILES`; do

echo "$0: running test '$TEST_FILE'"

# folder for test results
TEST_RESULT_PATH=$(realpath /tmp/$RANDOM)
mkdir -p $TEST_RESULT_PATH

# run the test
rostest $PACKAGE $TEST_FILE $TEXT_OUTPUT --results-filename=$PACKAGE.test --results-base-dir="$TEST_RESULT_PATH"

# evaluate the test results
echo test result path is $TEST_RESULT_PATH
catkin_test_results "$TEST_RESULT_PATH"
catkin build --this # it has to be fully built normally before building with --catkin-make-args tests
catkin build --this --no-deps --catkin-make-args tests

done
catkin test --this -i -p 1 -s
10 changes: 10 additions & 0 deletions test/compile_tests.sh
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 --no-deps --catkin-make-args tests
25 changes: 0 additions & 25 deletions test/coverage.sh

This file was deleted.

1 change: 1 addition & 0 deletions test/gps_baro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(gps_baro_basic)
15 changes: 0 additions & 15 deletions test/gps_baro/basic/config/network_config.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions test/gps_baro/basic/config/simulator.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions test/gps_baro/basic/gps_baro_basic.test

This file was deleted.

30 changes: 0 additions & 30 deletions test/gps_baro/basic/launch/mrs_uav_system.launch

This file was deleted.

Loading

0 comments on commit 0a092aa

Please sign in to comment.