Skip to content
Snippets Groups Projects
Commit 5f6b95f4 authored by Olivier Stasse's avatar Olivier Stasse
Browse files

[tests] Fix the way the test library is build and the Path in launch files.

parent 9089b48b
No related branches found
No related tags found
No related merge requests found
Pipeline #31146 failed
...@@ -14,7 +14,6 @@ if(BUILD_TESTING) ...@@ -14,7 +14,6 @@ if(BUILD_TESTING)
add_library(impl_test_sot_mock_device SHARED impl_test_sot_mock_device.cpp) add_library(impl_test_sot_mock_device SHARED impl_test_sot_mock_device.cpp)
set_target_properties(impl_test_sot_mock_device PROPERTIES INSTALL_RPATH set_target_properties(impl_test_sot_mock_device PROPERTIES INSTALL_RPATH
$ORIGIN) $ORIGIN)
# target_include_directories(impl_test_sot_mock_device PUBLIC include)
target_link_libraries( target_link_libraries(
impl_test_sot_mock_device PUBLIC sot-core::sot-core impl_test_sot_mock_device PUBLIC sot-core::sot-core
dynamic-graph-python::dynamic-graph-python) dynamic-graph-python::dynamic-graph-python)
...@@ -32,15 +31,12 @@ if(BUILD_TESTING) ...@@ -32,15 +31,12 @@ if(BUILD_TESTING)
dynamic_graph_bridge-impl_test_sot_mock_device-wrap SOURCE_PYTHON_MODULE dynamic_graph_bridge-impl_test_sot_mock_device-wrap SOURCE_PYTHON_MODULE
"${CMAKE_CURRENT_SOURCE_DIR}/impl_test_sot_mock_device-python-module-py.cc") "${CMAKE_CURRENT_SOURCE_DIR}/impl_test_sot_mock_device-python-module-py.cc")
install(
TARGETS ${plugin_library_name}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${DYNAMIC_GRAPH_PLUGINDIR})
# Library for sot_external_interface # Library for sot_external_interface
add_library(impl_test_library SHARED impl_test_sot_external_interface.cpp) add_library(impl_test_library SHARED impl_test_sot_external_interface.cpp)
target_include_directories(impl_test_library PUBLIC include) target_include_directories(impl_test_library PUBLIC include)
target_link_libraries(impl_test_library PUBLIC sot-core::sot-core) target_link_libraries(impl_test_library PUBLIC impl_test_sot_mock_device
sot-core::sot-core)
ament_target_dependencies(impl_test_library PUBLIC dynamic_graph_bridge_msgs ament_target_dependencies(impl_test_library PUBLIC dynamic_graph_bridge_msgs
rclcpp rcl_interfaces std_srvs) rclcpp rcl_interfaces std_srvs)
# Executable for SotLoaderBasic test # Executable for SotLoaderBasic test
......
...@@ -31,7 +31,7 @@ from launch_ros.actions import Node ...@@ -31,7 +31,7 @@ from launch_ros.actions import Node
def generate_test_description(): def generate_test_description():
"""Load a simple urdf, parameters and the library.""" """Load a simple urdf, parameters and the library."""
ld = LaunchDescription() ld = LaunchDescription()
print("After launch description")
robot_description_content_path = PathJoinSubstitution( robot_description_content_path = PathJoinSubstitution(
[ [
get_package_share_directory("dynamic_graph_bridge"), get_package_share_directory("dynamic_graph_bridge"),
...@@ -39,11 +39,10 @@ def generate_test_description(): ...@@ -39,11 +39,10 @@ def generate_test_description():
"dgb_minimal_robot.urdf", "dgb_minimal_robot.urdf",
], ],
) )
print("Before robot_description_content")
robot_description_content = Path.open( robot_description_content_path = Path(robot_description_content_path.perform(None))
robot_description_content_path.perform(None), robot_description_content = robot_description_content_path.open().read()
).read() print("Before params")
params = { params = {
"state_vector_map": ["joint1", "joint2"], "state_vector_map": ["joint1", "joint2"],
"robot_description": robot_description_content, "robot_description": robot_description_content,
......
...@@ -33,17 +33,19 @@ def generate_test_description(): ...@@ -33,17 +33,19 @@ def generate_test_description():
It also set parameters state_vector_map and robot_description It also set parameters state_vector_map and robot_description
""" """
print("start generate_test_description")
ld = LaunchDescription() ld = LaunchDescription()
robot_description_content_path = ( robot_description_pathjs_str = PathJoinSubstitution(
Path(get_package_share_directory("dynamic_graph_bridge")) [
/ "urdf" get_package_share_directory("dynamic_graph_bridge"),
/ "dgb_minimal_robot.urdf" "urdf",
"dgb_minimal_robot.urdf",
],
) )
assert robot_description_content_path.exists() robot_description_path = Path(robot_description_pathjs_str.perform(None))
robot_description_content = Path.open( robot_description_content = robot_description_path.open().read()
PathJoinSubstitution(str(robot_description_content_path)).perform(None), print("After building robot_description_content")
).read()
terminating_process = Node( terminating_process = Node(
package="dynamic_graph_bridge", package="dynamic_graph_bridge",
executable="test_sot_loader_basic", executable="test_sot_loader_basic",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment