Skip to content
3 changes: 3 additions & 0 deletions .devcontainer/base-dev/base-dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ RUN apt-get update \
build-essential \
cmake \
git \
libbson-dev \
libbson-1.0-0 \
libmongoc-1.0-0\
libmongoc-dev \
ninja-build \
wget \
Expand Down
5 changes: 5 additions & 0 deletions .devcontainer/base-dev/update-bashrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ echo " source $ROS_WORKSPACE/install/local_setup.bash" >> $HOME/.bashrc
echo "else" >> $HOME/.bashrc
echo " echo -e \"\\\e[1;33mWARNING: Can't find the ROS workspace overlay: build then run 'source $ROS_WORKSPACE/install/local_setup.bash'\\\e[0m\"" >> $HOME/.bashrc
echo "fi" >> $HOME/.bashrc

echo "" >> $HOME/.bashrc
echo "# set up links for ompl python bindings and ROS type supports" >> $HOME/.bashrc
echo "sudo ln -sf /usr/share/libompl.so /usr/lib/libompl.so" >> $HOME/.bashrc
echo "export LD_LIBRARY_PATH=/usr/share:/workspaces/sailbot_workspace/install/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc
12 changes: 11 additions & 1 deletion sailbot.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
},
// Test tasks
{
"label": "test",
"label": "Test All",
"detail": "Run all unit tests and show results.",
"type": "shell",
"command": "${workspaceFolder:sailbot_workspace}/scripts/test.sh",
Expand All @@ -412,6 +412,16 @@
"isDefault": true
}
},
{
"label": "Test Package",
"detail": "Run unit tests for a specific package and show results.",
"type": "shell",
"command": "${workspaceFolder:sailbot_workspace}/scripts/test.sh -p ${input:package}",
"group": {
"kind": "test",
"isDefault": true
}
},
// Clean
{
"label": "clean",
Expand Down
9 changes: 7 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ colcon build \
--cmake-args "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" "-DSTATIC_ANALYSIS=$STATIC_ANALYSIS" "-DUNIT_TEST=$UNIT_TEST" "--no-warn-unused-cli"

if [[ "$PACKAGE" == "local_pathfinding" || "$PACKAGE" == "" ]]; then
echo "Building ompl python bindings..."
/workspaces/sailbot_workspace/src/local_pathfinding/src/build/py_bindings.sh
# check if the ompl python bindings have already been built once
if [ ! -f /workspaces/sailbot_workspace/install/lib/python3.10/site-packages/pyompl*.so ]; then
echo "Building ompl python bindings..."
/workspaces/sailbot_workspace/src/local_pathfinding/src/build/py_bindings.sh
else
echo "ompl python bindings already built. If you want to rebuild them run: /local_pathfinding/src/build/py_bindings.sh"
fi
fi
5 changes: 0 additions & 5 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,4 @@ if wget -q --spider --timeout=1 http://google.com; then
fi
rosdep install --from-paths src --ignore-src -y --rosdistro $ROS_DISTRO

echo "" >> $HOME/.bashrc
echo "# set up links for ompl python bindings" >> $HOME/.bashrc
echo "sudo ln -sf /usr/share/libompl.so /usr/lib/libompl.so" >> $HOME/.bashrc
echo "export LD_LIBRARY_PATH=/usr/share:$LD_LIBRARY_PATH" >> $HOME/.bashrc

source $HOME/.bashrc
33 changes: 32 additions & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,40 @@
set -e
export LD_LIBRARY_PATH=/usr/share:$LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
echo "PYTHON_PATH: $PYTHONPATH"
echo "locating pyompl shared object"
find . -name "pyompl*.so"

# Display a help message for using this script
function helpMessage() {
echo -e "Test ROS package(s) in the Sailbot Workspace."
echo -e "Usage: ./test.sh [OPTION] ..."
echo -e "Example: ./test.sh -p local_pathfinding\n"
echo -e "Options (All Optional):"
echo -e "\t-p <PACKAGE_NAME>: Test a ROS package. Can only specify one package. If argument not included, all packages are tested."
echo -e "\t-h: Display this message."
}

function signal_handler() {
if [ -n "$(pgrep -f virtual_iridium)" ]; then
pkill -f virtual_iridium
fi
}

# Package to test if selecting an individual package
# If still empty after argument parsing, all ROS packages are tested
PACKAGE=""

# Parse command-line options (all are optional arguments)
while getopts "hp:q" flag; do
case ${flag} in
p ) PACKAGE="${OPTARG}" ;;
h ) helpMessage; exit 0 ;;
\? ) echo "Invalid option: -${flag}"; helpMessage; exit 1 ;;
: ) echo "Option -${flag} requires an argument"; helpMessage; exit 1 ;;
esac
done

# Test failures terminate the script
# Catch the signal so child processes can be cleaned up
trap 'exit' INT TERM
Expand All @@ -33,6 +60,10 @@ export RCUTILS_COLORIZED_OUTPUT="1"

echo "ROS_LOG_DIR is set to: $ROS_LOG_DIR"

colcon test --packages-ignore virtual_iridium --merge-install --event-handlers console_cohesion+
colcon test \
${PACKAGE:+--packages-select $PACKAGE} \
--packages-ignore virtual_iridium \
--merge-install \
--event-handlers console_cohesion+
colcon test-result
exit 0
Loading