Skip to content

Commit

Permalink
updated test format
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Feb 9, 2024
1 parent 39c0de3 commit 423b7ad
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 41 deletions.
4 changes: 3 additions & 1 deletion ros_packages/mrs_uav_gazebo_simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ endif()
## | Testing |
## --------------------------------------------------------------

if(CATKIN_ENABLE_TESTING)
if(CATKIN_ENABLE_TESTING AND MRS_ENABLE_TESTING)

message(WARNING "Testing enabled.")

add_subdirectory(test)

Expand Down
34 changes: 0 additions & 34 deletions ros_packages/mrs_uav_gazebo_simulation/test/all_tests.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ 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
catkin build --this -DMRS_ENABLE_TESTING=1 --no-deps --catkin-make-args tests
25 changes: 25 additions & 0 deletions ros_packages/mrs_uav_gazebo_simulation/test/gather_coverage.sh
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
8 changes: 8 additions & 0 deletions ros_packages/mrs_uav_gazebo_simulation/test/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/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

catkin test --this -i -p 1 -s
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ mrs_uav_managers:

# loaded state estimator plugins
state_estimators: [
"gps_garmin",
"gps_baro",
]

initial_state_estimator: "gps_garmin" # will be used as the first state estimator
agl_height_estimator: "garmin_agl" # only slightly filtered height for checking min height (not used in control feedback)
initial_state_estimator: "gps_baro" # will be used as the first state estimator
agl_height_estimator: "" # only slightly filtered height for checking min height (not used in control feedback)

uav_manager:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ socket_name: mrs
attach: false
tmux_options: -f /etc/ctu-mrs/tmux.conf
# you can modify these
pre_window: export UAV_NAME=uav1; export RUN_TYPE=simulation; export UAV_TYPE=x500
pre_window: export UAV_NAME=uav1; export RUN_TYPE=simulation; export UAV_TYPE=naki
startup_window: status
windows:
- roscore:
Expand All @@ -16,7 +16,7 @@ windows:
layout: tiled
panes:
- waitForRos; roslaunch mrs_uav_gazebo_simulation simulation.launch world_name:=grass_plane gui:=true
- waitForGazebo; rosservice call /mrs_drone_spawner/spawn "1 --$UAV_TYPE --enable-rangefinder"
- waitForGazebo; rosservice call /mrs_drone_spawner/spawn "1 --$UAV_TYPE"
- waitForControl; gz camera -c gzclient_camera -f $UAV_NAME; history -s gz camera -c gzclient_camera -f $UAV_NAME
- status:
layout: tiled
Expand Down

0 comments on commit 423b7ad

Please sign in to comment.