forked from sriramprasadkothapalli/project_clearpath
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdo-tests.bash
More file actions
40 lines (27 loc) · 1.04 KB
/
do-tests.bash
File metadata and controls
40 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
# Source ROS 2 setup file
source /opt/ros/humble/setup.bash
# Create a workspace directory
mkdir -p ~/ros2_ws/src
# Copy the project files to the workspace
cp -r . ~/ros2_ws/src/project_clearpath
# Change to the workspace directory
cd ~/ros2_ws
# Set gazebo_msgs_DIR if needed
export gazebo_msgs_DIR=/opt/ros/humble/share/gazebo_msgs/cmake
# Clean up any previous builds
rm -rf install log build
# Build the project with coverage flags using merged layout
colcon build --cmake-args -DCMAKE_CXX_FLAGS="--coverage" -DCMAKE_C_FLAGS="--coverage" -DCMAKE_BUILD_TYPE=Debug
# Source the workspace
source install/setup.bash
colcon test --event-handlers console_direct+
# Generate coverage report if tests pass
lcov --capture --directory build --output-file coverage.info
lcov --extract coverage.info '*/libs/debris/*' '*/test/*' --output-file filtered_coverage.info
genhtml filtered_coverage.info --output-directory coverage_report
# Print location of the generated file
echo "Coverage report generated at:"
pwd
ls -l filtered_coverage.info