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

ament_cmake binarydeb job cannot find own package for tests #688

Open
v-lopez opened this issue Sep 14, 2022 · 0 comments
Open

ament_cmake binarydeb job cannot find own package for tests #688

v-lopez opened this issue Sep 14, 2022 · 0 comments

Comments

@v-lopez
Copy link

v-lopez commented Sep 14, 2022

I am releasing a repository in our private buildfarm using bloom, and the dh_auto_test is failing because my package has tests built with launch_test that rely on launching a node from the package being released.

The release continues afterwards because test failures are ignored in dh_auto_test, but I would like to understand the problem.

The test run fine on prerelease jobs.

The test part of my CMakeLists looks like this:

if(BUILD_TESTING)
   ..... 
   # find dependencies here
   .....
    ament_add_gtest_executable(ros2_services_test test/ros2_services_test.cpp)
    target_link_libraries(ros2_services_test register_ros2_services)

    add_launch_test(
      test/ros2_services_test.launch.py
      TARGET "ros2_services_test-test"
    )
endif()

And part of the ros2_services_test.launch.py:

def generate_test_description():
    # dut = device under test, aka the actual test
    grpc_bridge_node = Node(package='my_pkg',
                            executable='ros2_bridge_node',
                            output='both',
                            env=proc_env,)
    dut_process = Node(package='my_pkg',
                       executable='ros2_services_test',
                       output='both',
                       env=proc_env,)
    return LaunchDescription([
        grpc_bridge_node,
        dut_process,
        launch_testing.actions.ReadyToTest(),
    ]), {'dut_process': dut_process}

Finally, the test failure in the binarydeb:

 1: Test command: /usr/bin/python3 "-u" "/opt/ros/galactic/share/ament_cmake_test/cmake/run_test.py" "/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu/test_results/my_pkg/ros2_services_test-test.xunit.xml" "--package-name" "my_pkg" "--output-file" "/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu/launch_test/ros2_services_test-test.txt" "--command" "/usr/bin/python3" "-m" "launch_testing.launch_test" "/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/test/ros2_services_test.launch.py" "--junit-xml=/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu/test_results/my_pkg/ros2_services_test-test.xunit.xml" "--package-name=my_pkg"
 1: Test timeout computed to be: 60
 1: -- run_test.py: invoking following command in '/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu':
 1:  - /usr/bin/python3 -m launch_testing.launch_test /tmp/binarydeb/ros-galactic-my-pkg-0.0.7/test/ros2_services_test.launch.py --junit-xml=/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu/test_results/my_pkg/ros2_services_test-test.xunit.xml --package-name=my_pkg
 1: [INFO] [launch]: All log files can be found below /home/buildfarm/.ros/log/2022-09-14-09-30-04-374031-agent2-389
 1: [INFO] [launch]: Default logging verbosity is set to INFO
 1: ERROR:asyncio:Task exception was never retrieved
 1: future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py:226> exception=PackageNotFoundError("package 'my_pkg' not found, searching: ['/opt/ros/galactic']")>
 1: Traceback (most recent call last):
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/ament_index_python/packages.py", line 50, in get_package_prefix
 1:     content, package_prefix = get_resource('packages', package_name)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/ament_index_python/resources.py", line 48, in get_resource
 1:     raise LookupError(
 1: LookupError: Could not find the resource 'my_pkg' of type 'packages'
 1: 
 1: During handling of the above exception, another exception occurred:
 1: 
 1: Traceback (most recent call last):
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
 1:     await self.__process_event(next_event)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
 1:     visit_all_entities_and_collect_futures(entity, self.__context))
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
 1:     futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
 1:     futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
 1:     futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
 1:   [Previous line repeated 1 more time]
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
 1:     sub_entities = entity.visit(context)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/action.py", line 108, in visit
 1:     return self.execute(context)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch_ros/actions/node.py", line 484, in execute
 1:     ret = super().execute(context)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/actions/execute_process.py", line 837, in execute
 1:     self.__expand_substitutions(context)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/actions/execute_process.py", line 681, in __expand_substitutions
 1:     cmd = [perform_substitutions(context, x) for x in self.__cmd]
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/actions/execute_process.py", line 681, in <listcomp>
 1:     cmd = [perform_substitutions(context, x) for x in self.__cmd]
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in perform_substitutions
 1:     return ''.join([context.perform_substitution(sub) for sub in subs])
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in <listcomp>
 1:     return ''.join([context.perform_substitution(sub) for sub in subs])
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_context.py", line 197, in perform_substitution
 1:     return substitution.perform(self)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch_ros/substitutions/executable_in_package.py", line 76, in perform
 1:     package_prefix = super().perform(context)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch_ros/substitutions/find_package.py", line 79, in perform
 1:     result = self.find(package)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/launch_ros/substitutions/find_package.py", line 96, in find
 1:     return get_package_prefix(package_name)
 1:   File "/opt/ros/galactic/lib/python3.8/site-packages/ament_index_python/packages.py", line 52, in get_package_prefix
 1:     raise PackageNotFoundError(
 1: ament_index_python.packages.PackageNotFoundError: "package 'my_pkg' not found, searching: ['/opt/ros/galactic']"
 1: Processes under test stopped before tests completed
 1: -- run_test.py: return code 1
 1: -- run_test.py: verify result file '/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu/test_results/my_pkg/ros2_services_test-test.xunit.xml'
 1/1 Test #1: ros2_services_test-test ..........***Failed    0.30 sec
 -- run_test.py: invoking following command in '/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu':
  - /usr/bin/python3 -m launch_testing.launch_test /tmp/binarydeb/ros-galactic-my-pkg-0.0.7/test/ros2_services_test.launch.py --junit-xml=/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu/test_results/my_pkg/ros2_services_test-test.xunit.xml --package-name=my_pkg
 [INFO] [launch]: All log files can be found below /home/buildfarm/.ros/log/2022-09-14-09-30-04-374031-agent2-389
 [INFO] [launch]: Default logging verbosity is set to INFO
 ERROR:asyncio:Task exception was never retrieved
 future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py:226> exception=PackageNotFoundError("package 'my_pkg' not found, searching: ['/opt/ros/galactic']")>
 Traceback (most recent call last):
   File "/opt/ros/galactic/lib/python3.8/site-packages/ament_index_python/packages.py", line 50, in get_package_prefix
     content, package_prefix = get_resource('packages', package_name)
   File "/opt/ros/galactic/lib/python3.8/site-packages/ament_index_python/resources.py", line 48, in get_resource
     raise LookupError(
 LookupError: Could not find the resource 'my_pkg' of type 'packages'
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
     await self.__process_event(next_event)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
     visit_all_entities_and_collect_futures(entity, self.__context))
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
     futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
     futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
     futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
   [Previous line repeated 1 more time]
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
     sub_entities = entity.visit(context)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/action.py", line 108, in visit
     return self.execute(context)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch_ros/actions/node.py", line 484, in execute
     ret = super().execute(context)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/actions/execute_process.py", line 837, in execute
     self.__expand_substitutions(context)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/actions/execute_process.py", line 681, in __expand_substitutions
     cmd = [perform_substitutions(context, x) for x in self.__cmd]
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/actions/execute_process.py", line 681, in <listcomp>
     cmd = [perform_substitutions(context, x) for x in self.__cmd]
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in perform_substitutions
     return ''.join([context.perform_substitution(sub) for sub in subs])
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in <listcomp>
     return ''.join([context.perform_substitution(sub) for sub in subs])
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_context.py", line 197, in perform_substitution
     return substitution.perform(self)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch_ros/substitutions/executable_in_package.py", line 76, in perform
     package_prefix = super().perform(context)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch_ros/substitutions/find_package.py", line 79, in perform
     result = self.find(package)
   File "/opt/ros/galactic/lib/python3.8/site-packages/launch_ros/substitutions/find_package.py", line 96, in find
     return get_package_prefix(package_name)
   File "/opt/ros/galactic/lib/python3.8/site-packages/ament_index_python/packages.py", line 52, in get_package_prefix
     raise PackageNotFoundError(
 ament_index_python.packages.PackageNotFoundError: "package 'my_pkg' not found, searching: ['/opt/ros/galactic']"
 Processes under test stopped before tests completed
 -- run_test.py: return code 1
 -- run_test.py: verify result file '/tmp/binarydeb/ros-galactic-my-pkg-0.0.7/.obj-x86_64-linux-gnu/test_results/my_pkg/ros2_services_test-test.xunit.xml'
 
 
 0% tests passed, 1 tests failed out of 1
 
 Total Test time (real) =   0.30 sec
 
 The following tests FAILED:
 Errors while running CTest
 	  1 - ros2_services_test-test (Failed)
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

No branches or pull requests

1 participant