Skip to content

Commit d9c43fd

Browse files
Andeshogkluge7
andauthored
test: add unit tests and node test for dp controller (#590)
* test: check that failed tests makes the pipeline fail * test: passing tests passes the pipeline * test: add initial tests for calculation of tau in dp controller * test: add various tests for the calculation of tau in the dp controller, capturing coupling relationships and rotations * refactor: move simulator tests into a dedicated folder * test: add ros node test folder and workflow * update workflow name * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * only run ros node test on pull request and push to main * Remove commented line from ROS node tests workflow --------- Co-authored-by: Andreas Kluge Svendsrud <89779148+kluge7@users.noreply.github.com>
1 parent ca380b0 commit d9c43fd

11 files changed

Lines changed: 540 additions & 2 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: ROS Node Test
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [ opened, synchronize, reopened, ready_for_review ]
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '0 1 * * *' # Runs daily at 01:00 UTC
11+
jobs:
12+
call_reusable_workflow:
13+
strategy:
14+
matrix:
15+
test_script:
16+
- "tests/ros_node_tests/dp_node_test.sh"
17+
uses: vortexntnu/vortex-ci/.github/workflows/reusable-ros2-simulator-test.yml@main
18+
with:
19+
vcs_repos_file: "tests/dependencies.repos"
20+
setup_script: "tests/setup.sh"
21+
test_script: "${{ matrix.test_script }}"

.github/workflows/simulator-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
strategy:
1414
matrix:
1515
test_script:
16-
- "tests/waypoint_navigation/simulator_test.sh"
17-
#- "tests/los_test/simulator_test.sh"
16+
- "tests/simulator_tests/waypoint_navigation/simulator_test.sh"
17+
#- "tests/simulator_tests/los_test/simulator_test.sh"
1818
uses: vortexntnu/vortex-ci/.github/workflows/reusable-ros2-simulator-test.yml@main
1919
with:
2020
vcs_repos_file: "tests/dependencies.repos"

control/dp_adapt_backs_controller/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,8 @@ install(DIRECTORY
6767
DESTINATION share/${PROJECT_NAME}/
6868
)
6969

70+
if(BUILD_TESTING)
71+
add_subdirectory(test)
72+
endif()
73+
7074
ament_package()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cmake_minimum_required(VERSION 3.8)
2+
3+
find_package(GTest REQUIRED)
4+
include(GoogleTest)
5+
6+
set(TEST_BINARY_NAME ${PROJECT_NAME}_test)
7+
add_executable(
8+
${TEST_BINARY_NAME}
9+
dp_adapt_backs_controller_tests.cpp
10+
)
11+
12+
target_link_libraries(
13+
${TEST_BINARY_NAME}
14+
PRIVATE
15+
${LIB_NAME}
16+
GTest::GTest
17+
)
18+
19+
ament_target_dependencies(${TEST_BINARY_NAME} PUBLIC Eigen3 tf2)
20+
21+
gtest_discover_tests(${TEST_BINARY_NAME})

0 commit comments

Comments
 (0)