Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controller_manager_srvs tests: Add text to assertions #1023

Merged
merged 1 commit into from
May 19, 2023

Conversation

fmauch
Copy link
Contributor

@fmauch fmauch commented May 15, 2023

This should make debugging failed tests easier.

With this test a flip in a test matrix such as

list_hardware_components_and_check(
// actuator, sensor, system
std::vector<uint8_t>(
{LFC_STATE::PRIMARY_STATE_ACTIVE, LFC_STATE::PRIMARY_STATE_INACTIVE,
LFC_STATE::PRIMARY_STATE_UNCONFIGURED}),
std::vector<std::string>({ACTIVE, INACTIVE, UNCONFIGURED}),
std::vector<std::vector<std::vector<bool>>>({
// is available
{{true, true}, {true, true, true}}, // actuator
{{}, {true}}, // sensor
{{false, false, false, false}, {false, false, false, false, false, false, false}}, // system
}),
std::vector<std::vector<std::vector<bool>>>({
// is claimed
{{false, false}, {false, false, false}}, // actuator
{{}, {false}}, // sensor
{{false, false, false, false}, {false, false, false, false, false, false, false}}, // system
}));

will produce a test output such as

/home/mauch/robot_folders/checkout/ros2_control/colcon_ws/src/ros2_control/controller_manager/test/test_hardware_management_srvs.cpp:133: Failure                                                                                           
Expected equality of these values:                                                                                                                                                                                                          
  interfaces[i].is_available                                                                                                                                                                                                                
    Which is: true                                                                                                                                                                                                                          
  is_available_status[i]                                                                                                                                                                                                                    
    Which is: false                                                                                                                                                                                                                         
At joint1/velocity                                                                                                                                                                                                                          
[  FAILED  ] TestControllerManagerHWManagementSrvs.list_hardware_components (104 ms)

while without this change it would only have been

/home/mauch/robot_folders/checkout/ros2_control/colcon_ws/src/ros2_control/controller_manager/test/test_hardware_management_srvs.cpp:133: Failure                                                                                           
Expected equality of these values:                                                                                                                                                                                                          
  interfaces[i].is_available                                                                                                                                                                                                                
    Which is: true                                                                                                                                                                                                                          
  is_available_status[i]                                                                                                                                                                                                                    
    Which is: false                                                                                                                                                                                                                                                                                                            
[  FAILED  ] TestControllerManagerHWManagementSrvs.list_hardware_components (104 ms)

which makes debugging this a lot harder, since the referenced line is from the reused function instead of the actual calling block.

This should make debugging failed tests easier.
@codecov-commenter
Copy link

Codecov Report

Merging #1023 (c741f00) into master (925f5f3) will decrease coverage by 1.95%.
The diff coverage is 35.54%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #1023      +/-   ##
==========================================
- Coverage   34.61%   32.67%   -1.95%     
==========================================
  Files          52       91      +39     
  Lines        2981     9560    +6579     
  Branches     1855     6440    +4585     
==========================================
+ Hits         1032     3124    +2092     
- Misses        310      711     +401     
- Partials     1639     5725    +4086     
Flag Coverage Δ
unittests 32.67% <35.54%> (-1.95%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
controller_manager/src/controller_manager.cpp 38.27% <ø> (-1.44%) ⬇️
controller_manager/src/ros2_control_node.cpp 0.00% <0.00%> (ø)
..._interface/include/hardware_interface/actuator.hpp 100.00% <ø> (ø)
...re_interface/include/hardware_interface/sensor.hpp 100.00% <ø> (ø)
...re_interface/include/hardware_interface/system.hpp 100.00% <ø> (ø)
hardware_interface/src/resource_manager.cpp 49.91% <ø> (-3.72%) ⬇️
hardware_interface/src/sensor.cpp 50.52% <ø> (ø)
hardware_interface/src/system.cpp 55.45% <ø> (ø)
...rface/test/mock_components/test_generic_system.cpp 9.14% <ø> (ø)
...dware_interface/test/test_component_interfaces.cpp 32.44% <ø> (+4.25%) ⬆️
... and 68 more

... and 19 files with indirect coverage changes

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah these are very nice, thank you!

@bmagyar bmagyar merged commit 775dd6a into ros-controls:master May 19, 2023
1 check passed
@bmagyar
Copy link
Member

bmagyar commented May 19, 2023

@Mergifyio backport humble

@mergify
Copy link
Contributor

mergify bot commented May 19, 2023

backport humble

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 19, 2023
This should make debugging failed tests easier.

(cherry picked from commit 775dd6a)

# Conflicts:
#	controller_manager/test/test_hardware_management_srvs.cpp
bmagyar added a commit that referenced this pull request May 29, 2023
#1029)

* Add text to assertions references (#1023)

This should make debugging failed tests easier.

(cherry picked from commit 775dd6a)

# Conflicts:
#	controller_manager/test/test_hardware_management_srvs.cpp

* plugin_name -> class_type

* plugin_name -> class_type

---------

Co-authored-by: Felix Exner (fexner) <[email protected]>
Co-authored-by: Bence Magyar <[email protected]>
flochre pushed a commit to flochre/ros2_control that referenced this pull request Jul 5, 2023
…ontrols#1023) (ros-controls#1029)

* Add text to assertions references (ros-controls#1023)

This should make debugging failed tests easier.

(cherry picked from commit 775dd6a)

# Conflicts:
#	controller_manager/test/test_hardware_management_srvs.cpp

* plugin_name -> class_type

* plugin_name -> class_type

---------

Co-authored-by: Felix Exner (fexner) <[email protected]>
Co-authored-by: Bence Magyar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants