Skip to content

Commit

Permalink
Sync and update ROS1 and ROS2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asherikov committed Dec 22, 2024
1 parent bc223d7 commit 08b334f
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 70 deletions.
91 changes: 48 additions & 43 deletions ccws/tests/test_main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,9 @@ test:
${MAKE} dep_install PKG=test_pkg
${MAKE} test_pkg BUILD_PROFILE=test_profile
# ---
# reset
${MAKE} bp_purge
${MAKE} wspurge
${MAKE} wsinit REPOS="https://github.com/asherikov/staticoma.git"
# ---
# add dependencies to the workspace and build deb package
${MAKE} dep_to_repolist PKG=staticoma
${MAKE} dep_to_repolist
${MAKE} wsupdate
${MAKE} dep_install PKG=staticoma
${MAKE} dep_install
${MAKE} bp_install_build BUILD_PROFILE=deb
${MAKE} staticoma BUILD_PROFILE=deb BASE_BUILD_PROFILE=reldebug
${MAKE} deb_lint PKG=staticoma BUILD_PROFILE=deb BASE_BUILD_PROFILE=reldebug
sudo dpkg -i artifacts/*/*.deb
dpkg --get-selections | grep staticoma | cut -f 1 | xargs sudo apt purge --yes
# ---
# drop downloaded ROS packages, we are going to install binaries
${MAKE} wsclean
mv "${WORKSPACE_SRC}/staticoma" ./
rm -Rf "${WORKSPACE_SRC}"/*
mv staticoma "${WORKSPACE_SRC}"
${MAKE} dep_install PKG=staticoma
# ---
# workspace cmake toolchain
mkdir -p "${WORKSPACE_SRC}/.ccws/"
echo 'message(FATAL_ERROR "toolchain inclusion")' > "${WORKSPACE_SRC}/.ccws/toolchain.cmake"
# should fail
! ${MAKE} staticoma
rm -Rf "${WORKSPACE_SRC}/.ccws"
${MAKE} -f ${THIS_MAKEFILE} test_dependencies
${MAKE} -f ${THIS_MAKEFILE} test_deb
${MAKE} -f ${THIS_MAKEFILE} test_cmake_toolchain
# ---
# test various build profiles
${MAKE} -f ${THIS_MAKEFILE} build_with_profile BUILD_PROFILE=addr_undef_sanitizers
Expand All @@ -58,12 +31,6 @@ test:
${MAKE} bp_install_build BUILD_PROFILE=clangd
${MAKE} BUILD_PROFILE=clangd BASE_BUILD_PROFILE=reldebug
# ---
# cppcheck
cp -R ccws/examples/.ccws "${WORKSPACE_SRC}"
${MAKE} bp_install_build BUILD_PROFILE=cppcheck
${MAKE} BUILD_PROFILE=cppcheck BASE_BUILD_PROFILE=reldebug
rm -Rf "${WORKSPACE_SRC}/.ccws"
# ---
# check valgrind exec profile
${MAKE} ep_install EXEC_PROFILE=valgrind
${MAKE} wstest EXEC_PROFILE=valgrind
Expand All @@ -72,6 +39,21 @@ test:
${MAKE} ep_install EXEC_PROFILE=core_pattern
${MAKE} wstest EXEC_PROFILE="core_pattern valgrind"
# ---
# documentation
${MAKE} bp_install_build BUILD_PROFILE=doxygen
${MAKE} PKG=staticoma BUILD_PROFILE=doxygen
${MAKE} BUILD_PROFILE=doxygen
${MAKE} graph PKG=staticoma
${MAKE} graph
${MAKE} cache_clean
${MAKE} wsclean
# ---
# cppcheck
cp -R ccws/examples/.ccws "${WORKSPACE_SRC}"
${MAKE} bp_install_build BUILD_PROFILE=cppcheck
${MAKE} BUILD_PROFILE=cppcheck BASE_BUILD_PROFILE=reldebug
rm -Rf "${WORKSPACE_SRC}/.ccws"
# ---
# static checks
${MAKE} bp_install_build BUILD_PROFILE=static_checks
# must fail without exceptions
Expand All @@ -82,15 +64,38 @@ test:
# must succeed without package exceptions
rm "${WORKSPACE_SRC}/.ccws/static_checks.exceptions.packages"
${MAKE} BUILD_PROFILE=static_checks

test_dependencies:
# reset
${MAKE} bp_purge
${MAKE} wspurge
${MAKE} wsinit REPOS="https://github.com/asherikov/staticoma.git"
# ---
# documentation
${MAKE} bp_install_build BUILD_PROFILE=doxygen
${MAKE} PKG=staticoma BUILD_PROFILE=doxygen
${MAKE} BUILD_PROFILE=doxygen
${MAKE} graph PKG=staticoma
${MAKE} graph
${MAKE} cache_clean
# add dependencies to the workspace and build deb package
${MAKE} dep_to_repolist
${MAKE} wsupdate
${MAKE} dep_install

test_deb:
${MAKE} bp_install_build BUILD_PROFILE=deb
${MAKE} staticoma BUILD_PROFILE=deb BASE_BUILD_PROFILE=reldebug
${MAKE} deb_lint PKG=staticoma BUILD_PROFILE=deb BASE_BUILD_PROFILE=reldebug
sudo dpkg -i artifacts/*/*.deb
dpkg --get-selections | grep staticoma | cut -f 1 | xargs sudo apt purge --yes
# ---
# drop downloaded ROS packages, we are going to install binaries
${MAKE} wsclean
mv "${WORKSPACE_SRC}/staticoma" ./
rm -Rf "${WORKSPACE_SRC}"/*
mv staticoma "${WORKSPACE_SRC}"

test_cmake_toolchain:
# workspace cmake toolchain
cp -R ccws/examples/.ccws "${WORKSPACE_SRC}/"
echo 'message(FATAL_ERROR "toolchain inclusion")' > "${WORKSPACE_SRC}/.ccws/toolchain.cmake"
# should fail
! ${MAKE} examples_rclcpp_minimal_subscriber
rm -Rf "${WORKSPACE_SRC}/.ccws"

build_with_profile:
${MAKE} wsclean
Expand Down
78 changes: 51 additions & 27 deletions ccws/tests/test_main_ros2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,15 @@ test:
${MAKE} wsinit
${MAKE} new PKG=test_pkg EMAIL=example@example.org AUTHOR=example
${MAKE} wsscrape_all
#${MAKE} dep_to_repolist PKG=test_pkg
${MAKE} dep_to_repolist PKG=test_pkg
${MAKE} wsupdate
${MAKE} log_output TARGET=wsstatus
#${MAKE} dep_install PKG=test_pkg
#${MAKE} test_pkg BUILD_PROFILE=test_profile
${MAKE} dep_install PKG=test_pkg
${MAKE} test_pkg BUILD_PROFILE=test_profile
# ---
# dependencies
${MAKE} -f ${THIS_MAKEFILE} test_dependencies
# ---
# workspace cmake toolchain
cp -R ccws/examples/.ccws "${WORKSPACE_SRC}/"
echo 'message(FATAL_ERROR "toolchain inclusion")' > "${WORKSPACE_SRC}/.ccws/toolchain.cmake"
# should fail
! ${MAKE} examples_rclcpp_minimal_subscriber
rm -Rf "${WORKSPACE_SRC}/.ccws"
# ---
# static checks
${MAKE} bp_install_build BUILD_PROFILE=static_checks
# ---
# deb
${MAKE} bp_install_build BUILD_PROFILE=deb
${MAKE} examples_rclcpp_minimal_subscriber BUILD_PROFILE=deb BASE_BUILD_PROFILE=reldebug
${MAKE} deb_lint PKG=examples_rclcpp_minimal_subscriber BUILD_PROFILE=deb BASE_BUILD_PROFILE=reldebug
${MAKE} -f ${THIS_MAKEFILE} test_deb
${MAKE} -f ${THIS_MAKEFILE} test_cmake_toolchain
# ---
# test various build profiles
sudo apt install ros-${ROS_DISTRO}-ros2cli # used to test setup.bash
Expand All @@ -45,6 +31,10 @@ test:
${MAKE} -f ${THIS_MAKEFILE} build_with_profile BUILD_PROFILE=scan_build
${MAKE} -f ${THIS_MAKEFILE} build_with_profile BUILD_PROFILE=reldebug
# ---
# clangd
${MAKE} bp_install_build BUILD_PROFILE=clangd
${MAKE} BUILD_PROFILE=clangd BASE_BUILD_PROFILE=reldebug
# ---
# check valgrind exec profile
${MAKE} ep_install EXEC_PROFILE=valgrind
${MAKE} wstest EXEC_PROFILE=valgrind
Expand All @@ -53,34 +43,68 @@ test:
${MAKE} ep_install EXEC_PROFILE=core_pattern
${MAKE} wstest EXEC_PROFILE="core_pattern valgrind"
# ---
# clangd
${MAKE} bp_install_build BUILD_PROFILE=clangd
${MAKE} BUILD_PROFILE=clangd BASE_BUILD_PROFILE=reldebug
# ---
# documentation
${MAKE} bp_install_build BUILD_PROFILE=doxygen
${MAKE} PKG=examples_rclcpp_minimal_subscriber BUILD_PROFILE=doxygen
${MAKE} BUILD_PROFILE=doxygen
${MAKE} graph PKG=examples_rclcpp_minimal_subscriber
${MAKE} graph
${MAKE} cache_clean
test -z "${WORKSPACE_SRC}" || (test -d "${WORKSPACE_SRC}" && ls "${WORKSPACE_SRC}")
${MAKE} wsclean
# ---
${MAKE} wspurge
${MAKE} wsinit
${MAKE} add REPO="https://github.com/asherikov/ariles.git" VERSION="pkg_ws_2"
${MAKE} build_all
# ---
# cppcheck
cp -R ccws/examples/.ccws "${WORKSPACE_SRC}"
${MAKE} bp_install_build BUILD_PROFILE=cppcheck
${MAKE} BUILD_PROFILE=cppcheck BASE_BUILD_PROFILE=reldebug
rm -Rf "${WORKSPACE_SRC}/.ccws"
# ---
# static checks
${MAKE} bp_install_build BUILD_PROFILE=static_checks
${MAKE} BUILD_PROFILE=static_checks

test_dependencies:
${MAKE} bp_purge
${MAKE} wspurge
${MAKE} bp_install_build
${MAKE} new PKG=test_dependencies
cp -R ccws/tests/dependencies/package.xml "${WORKSPACE_SRC}/test_dependencies"
${MAKE} dep_install PKG=test_dependencies
${MAKE} wspurge
${MAKE} add REPO="https://github.com/ros2/examples" VERSION="${ROS_DISTRO}"
${MAKE} wsupdate
${MAKE} dep_install PKG=examples_rclcpp_minimal_subscriber
${MAKE} dep_to_repolist
${MAKE} dep_install
${MAKE} wsupdate
# ---
# drop downloaded ROS packages, we are going to install binaries
${MAKE} wsclean
mv "${WORKSPACE_SRC}/examples" ./
rm -Rf "${WORKSPACE_SRC}"/*
mv examples "${WORKSPACE_SRC}"

test_deb:
${MAKE} bp_install_build BUILD_PROFILE=deb
${MAKE} examples_rclcpp_minimal_subscriber BUILD_PROFILE=deb BASE_BUILD_PROFILE=reldebug
${MAKE} deb_lint PKG=examples_rclcpp_minimal_subscriber BUILD_PROFILE=deb BASE_BUILD_PROFILE=reldebug
sudo dpkg -i artifacts/*/*.deb
dpkg --get-selections | grep minimal-subscriber | cut -f 1 | xargs sudo apt purge --yes

test_cmake_toolchain:
# workspace cmake toolchain
cp -R ccws/examples/.ccws "${WORKSPACE_SRC}/"
echo 'message(FATAL_ERROR "toolchain inclusion")' > "${WORKSPACE_SRC}/.ccws/toolchain.cmake"
# should fail
! ${MAKE} examples_rclcpp_minimal_subscriber
rm -Rf "${WORKSPACE_SRC}/.ccws"

build_with_profile:
${MAKE} wsclean
${MAKE} bp_install_build
#${MAKE} build_all
${MAKE} build_all
${MAKE} examples_rclcpp_minimal_subscriber
# workspace test
${MAKE} wstest
Expand Down

0 comments on commit 08b334f

Please sign in to comment.