Ament Build -test failed

Hello,

I am migrating to my new workstation. I ran previously r2b3. This is the first time i was installing ardent apalone.

While i was running src/ament/ament_tools/scripts/ament.py test --skip-build --skip-install I got this at the end for output.

I have built the workspace before this and also ran src/ament/ament_tools/scripts/ament.py test earlier to this which ended with ros1_bridge failure. Is this error specific to RMW implementation. It certainly looks for the metaconfig.xml files. I haven’t encountered this in r2b2 and r2b3. Kindly guide.

Label Time Summary:
copyright     =   0.31 sec (1 test)
cppcheck      =   0.30 sec (1 test)
cpplint       =   0.66 sec (1 test)
flake8        =   0.43 sec (1 test)
lint_cmake    =   0.23 sec (1 test)
linter        =   2.63 sec (7 tests)
pep257        =   0.28 sec (1 test)
pytest        =   0.66 sec (2 tests)
uncrustify    =   0.40 sec (1 test)

Total Test time (real) =   3.29 sec

The following tests FAILED:
	  8 - test_dynamic_bridge__rmw_fastrtps_cpp (Failed)
	  9 - test_dynamic_bridge__rmw_opensplice_cpp (Failed)
Errors while running CTest
Makefile:71: recipe for target 'test' failed
make: *** [test] Error 8

<== Command '. /home/rosi/ros2_ws/build/ros1_bridge/cmake__test.sh && /usr/bin/make test 'ARGS=-V -D ExperimentalTest --no-compress-output'' failed in '/home/rosi/ros2_ws/build/ros1_bridge' with exit code '2'
'test_pkg' for package '/home/rosi/ros2_ws/src/ros2/ros1_bridge' failed: <== Command '. /home/rosi/ros2_ws/build/ros1_bridge/cmake__test.sh && /usr/bin/make test 'ARGS=-V -D ExperimentalTest --no-compress-output'' failed in '/home/rosi/ros2_ws/build/ros1_bridge' with exit code '2'
<== Command '. /home/rosi/ros2_ws/build/ros1_bridge/cmake__test.sh && /usr/bin/make test 'ARGS=-V -D ExperimentalTest --no-compress-output'' failed in '/home/rosi/ros2_ws/build/ros1_bridge' with exit code '2'

The failure of the test with rmw_opensplice_cpp is something we are also having on our CI system (see http://ci.ros2.org/view/packaging/job/packaging_linux/902/). While the bridge itself work with OpenSplice the test is currently not working correctly. We haven’t had a chance to look at the test failure - it might be related to the warnings printed by Opensplice related to the metaconfig file as you mentioned.

The test with FastRTPS is expected to pass though. At least it does so on our CI as well as on the developer machines when we tested the recent release. Maybe you can post more information why the test failed in your case.

Hi @dirk-thomas,

I am doing a clean install in my new workstation. So I cannot really figure out any extra information. Just followed the wiki for insalling the AA release.

Using Ubuntu 16.04, I have Kinetic running from ROS1.
Do I need to install FastRTPS separately to have the test passed?

If you follow the from-source instructions your workspace will contains the FastRTPS repository and if that passed to build it also found all dependencies. There is nothing else you need to make the tests pass.

Yes I have done accordingly. In r2b3 I did not encounter this issue with FastRTPS. Dont know why is it happening now. @dirk-thomas

@arunava_nag Do you have every test with fastrtps failing or only the bridge?
Do the simple demos work with fastrtps ? e.g.:
ros2 run demo_nodes_cpp talker

Tip: if you want to see the summary of all the tests you ran you can call
ament test_results <path to your build folder>

@marguedas

Hi I did run : ros2 run demo_nodes_cpp_native talker which i believe is using fastrtps and the output is as below:

[INFO] [talker_native]: eprosima::fastrtps::Participant * 33898080
[INFO] [talker_native]: eprosima::fastrtps::Publisher * 42375136
[INFO] [talker_native]: Publishing: 'Hello World: 1'
[INFO] [talker_native]: Publishing: 'Hello World: 2'
[INFO] [talker_native]: Publishing: 'Hello World: 3'
[INFO] [talker_native]: Publishing: 'Hello World: 4'
[INFO] [talker_native]: Publishing: 'Hello World: 5'
[INFO] [talker_native]: Publishing: 'Hello World: 6'

I am attaching the log for the test_results ( sorry had to make it a .pdf to support the website format: test_results.pdf (37.7 KB)

I see it failing for the fastrtps examples too on running ament build test_results <path_to_my_build_folder>

According to the test results pretty much every pub / sub is failing for you for both rmw impl. That is certainly not supposed to happen and something severe seems to be wrong on your system.

Can you please try to run the tests for a single package (e.g. demo_nodes_cpp) and check the output for why those fail. I expect a generic error in the invocation of the tests since the talker seems to work just fine for you.

Hi @dirk-thomas here is the output for demo_nodes_cpp:

$ament test_results ~/ros2_ws/build/demo_nodes_cpp

test_results/demo_nodes_cpp/test_tutorial_add_two_ints_server_add_two_ints_client__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_add_two_ints_server_add_two_ints_client__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_add_two_ints_server_add_two_ints_client_async__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_add_two_ints_server_add_two_ints_client_async__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_list_parameters__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_list_parameters__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_list_parameters_async__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_list_parameters_async__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_parameter_events__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_parameter_events__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_parameter_events_async__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_parameter_events_async__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_set_and_get_parameters__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_set_and_get_parameters__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_set_and_get_parameters_async__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_set_and_get_parameters_async__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_talker_listener__rmw_fastrtps_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
test_results/demo_nodes_cpp/test_tutorial_talker_listener__rmw_opensplice_cpp.xunit.xml: 1 tests, 0 skipped, 0 errors, 1 failures
Summary: 91 tests, 0 errors, 18 failures, 0 skipped

The test result summary only tells us that the test failed (which we knew from the previous output). In order to provide more information please look at the actual test output when running the test.

Hi. I am having the same issue. The output when I run src/ament/ament_tools/scripts/ament.py test is

Start 8: test_dynamic_bridge__rmw_fastrtps_cpp

8: Test command: /usr/bin/python3 “-u” “/home/paul/ros2_ws/install/share/ament_cmake_test/cmake/run_test.py” “/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_fastrtps_cpp.xunit.xml” “–package-name” “ros1_bridge” “–output-file” “/home/paul/ros2_ws/build/ros1_bridge/ament_cmake_pytest/test_dynamic_bridge__rmw_fastrtps_cpp.txt” “–env” “RMW_IMPLEMENTAION=” “–command” “/usr/bin/python3” “-u” “-m” “pytest” “/home/paul/ros2_ws/build/ros1_bridge/test_dynamic_bridge__rmw_fastrtps_cpp_.py” “-o” “cache_dir=/home/paul/ros2_ws/build/ros1_bridge/ament_cmake_pytest/test_dynamic_bridge__rmw_fastrtps_cpp/.cache” “–junit-xml=/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_fastrtps_cpp.xunit.xml” "–junit-prefix=ros1_bridge"
8: Test timeout computed to be: 60
8: – run_test.py: extra environment variables:
8: - RMW_IMPLEMENTAION=
8: – run_test.py: invoking following command in ‘/home/paul/ros2_ws/src/ros2/ros1_bridge’:
8: - /usr/bin/python3 -u -m pytest /home/paul/ros2_ws/build/ros1_bridge/test_dynamic_bridge__rmw_fastrtps_cpp_.py -o cache_dir=/home/paul/ros2_ws/build/ros1_bridge/ament_cmake_pytest/test_dynamic_bridge__rmw_fastrtps_cpp/.cache --junit-xml=/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_fastrtps_cpp.xunit.xml --junit-prefix=ros1_bridge
8: usage: pytest.py [options] [file_or_dir] [file_or_dir] […]
8: pytest.py: error: unrecognized arguments: -o cache_dir=/home/paul/ros2_ws/build/ros1_bridge/ament_cmake_pytest/test_dynamic_bridge__rmw_fastrtps_cpp/.cache
8: inifile: None
8: rootdir: /home/paul/ros2_ws
8: – run_test.py: return code 2
8: – run_test.py: generate result file ‘/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_fastrtps_cpp.xunit.xml’ with failed test
8: – run_test.py: verify result file '/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_fastrtps_cpp.xunit.xml’
8/9 Test #8: test_dynamic_bridge__rmw_fastrtps_cpp …***Failed 0.65 sec
test 9
Start 9: test_dynamic_bridge__rmw_opensplice_cpp

9: Test command: /usr/bin/python3 “-u” “/home/paul/ros2_ws/install/share/ament_cmake_test/cmake/run_test.py” “/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_opensplice_cpp.xunit.xml” “–package-name” “ros1_bridge” “–output-file” “/home/paul/ros2_ws/build/ros1_bridge/ament_cmake_pytest/test_dynamic_bridge__rmw_opensplice_cpp.txt” “–env” “RMW_IMPLEMENTAION=” “–command” “/usr/bin/python3” “-u” “-m” “pytest” “/home/paul/ros2_ws/build/ros1_bridge/test_dynamic_bridge__rmw_opensplice_cpp_.py” “-o” “cache_dir=/home/paul/ros2_ws/build/ros1_bridge/ament_cmake_pytest/test_dynamic_bridge__rmw_opensplice_cpp/.cache” “–junit-xml=/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_opensplice_cpp.xunit.xml” "–junit-prefix=ros1_bridge"
9: Test timeout computed to be: 60
9: – run_test.py: extra environment variables:
9: - RMW_IMPLEMENTAION=
9: – run_test.py: invoking following command in ‘/home/paul/ros2_ws/src/ros2/ros1_bridge’:
9: - /usr/bin/python3 -u -m pytest /home/paul/ros2_ws/build/ros1_bridge/test_dynamic_bridge__rmw_opensplice_cpp_.py -o cache_dir=/home/paul/ros2_ws/build/ros1_bridge/ament_cmake_pytest/test_dynamic_bridge__rmw_opensplice_cpp/.cache --junit-xml=/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_opensplice_cpp.xunit.xml --junit-prefix=ros1_bridge
9: usage: pytest.py [options] [file_or_dir] [file_or_dir] […]
9: pytest.py: error: unrecognized arguments: -o cache_dir=/home/paul/ros2_ws/build/ros1_bridge/ament_cmake_pytest/test_dynamic_bridge__rmw_opensplice_cpp/.cache
9: inifile: None
9: rootdir: /home/paul/ros2_ws
9: – run_test.py: return code 2
9: – run_test.py: generate result file ‘/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_opensplice_cpp.xunit.xml’ with failed test
9: – run_test.py: verify result file '/home/paul/ros2_ws/build/ros1_bridge/test_results/ros1_bridge/test_dynamic_bridge__rmw_opensplice_cpp.xunit.xml’
9/9 Test #9: test_dynamic_bridge__rmw_opensplice_cpp …***Failed 0.66 sec

78% tests passed, 2 tests failed out of 9

Label Time Summary:
copyright = 0.66 sec (1 test)
cppcheck = 0.62 sec (1 test)
cpplint = 1.26 sec (1 test)
flake8 = 0.92 sec (1 test)
lint_cmake = 0.48 sec (1 test)
linter = 5.26 sec (7 tests)
pep257 = 0.61 sec (1 test)
pytest = 1.31 sec (2 tests)
uncrustify = 0.71 sec (1 test)

Total Test time (real) = 6.58 sec

The following tests FAILED:
8 - test_dynamic_bridge__rmw_fastrtps_cpp (Failed)
9 - test_dynamic_bridge__rmw_opensplice_cpp (Failed)
Errors while running CTest
Makefile:71: recipe for target ‘test’ failed
make: *** [test] Error 8

<== Command ‘. /home/paul/ros2_ws/build/ros1_bridge/cmake__test.sh && /usr/bin/make test ‘ARGS=-V -D ExperimentalTest --no-compress-output’’ failed in ‘/home/paul/ros2_ws/build/ros1_bridge’ with exit code ‘2’
‘test_pkg’ for package ‘/home/paul/ros2_ws/src/ros2/ros1_bridge’ failed: <== Command ‘. /home/paul/ros2_ws/build/ros1_bridge/cmake__test.sh && /usr/bin/make test ‘ARGS=-V -D ExperimentalTest --no-compress-output’’ failed in ‘/home/paul/ros2_ws/build/ros1_bridge’ with exit code ‘2’
<== Command ‘. /home/paul/ros2_ws/build/ros1_bridge/cmake__test.sh && /usr/bin/make test ‘ARGS=-V -D ExperimentalTest --no-compress-output’’ failed in ‘/home/paul/ros2_ws/build/ros1_bridge’ with exit code ‘2’

@dirk-thomas: Does this help you to understand the nature of the problem?

The error message says:

pytest.py: unrecognized arguments: -o cache_dir=…

I assume you are using an older version of pytest since this command line argument was only added in version 3.2.0.

Please check that you have followed the instructions which mention to install the latest version via pip.

Sorry, I used the binaries from

GitHub - ros2/ros2: The Robot Operating System, is a meta operating system for robots.

to get ROS 2. But even if I run the commands from the Building from Source page, the failures still occur. Even worse, when I run pytest on /ros2_ws I get a ton load of errors. All the while, the other tutorials are all working until now. Does the error come from the binary installation?

The binary instructions are only sufficient to install the Debian packages and “use” what is coming with it.

If you want to build and test your own packages you need to follow the Linux-Development-Setup.

You likely already had pytest installed from a Debian package but unfortunately the latest Debian package version is still not new enough.

You are not supposed to run pytest on the workspace /ros2_ws. You should use ament test for this instead. The build tool makes sure to invoke the test on each package separately with various command line options as well as an environment which includes all dependencies of a specific package.

Has any one come across this during building the src. It seems all the logging is throwing some error. Kindly advise.

src/ament/ament_tools/scripts/ament.py build --build-tests --symlink-install

error thrown:

/home/rosi/ros2_ws/src/ros2/rmw_fastrtps/rmw_fastrtps_cpp/src/rmw_logging.cpp:27:22: error: ‘rmw_log_severity_t’ was not declared in this scope
 rmw_set_log_severity(rmw_log_severity_t severity)
                      ^
/home/rosi/ros2_ws/src/ros2/rmw_fastrtps/rmw_fastrtps_cpp/src/rmw_logging.cpp:28:1: error: expected ‘,’ or ‘;’ before ‘{’ token
 {
 ^
[ 58%] Building CXX object CMakeFiles/rmw_fastrtps_cpp.dir/src/rmw_publish.cpp.o
/home/rosi/ros2_ws/src/ros2/rmw_fastrtps/rmw_fastrtps_cpp/src/rmw_logging.cpp:54:1: error: expected ‘}’ at end of input
 }  // extern "C"
 ^
[ 61%] Building CXX object CMakeFiles/rmw_fastrtps_cpp.dir/src/rmw_publisher.cpp.o
CMakeFiles/rmw_fastrtps_cpp.dir/build.make:302: recipe for target 'CMakeFiles/rmw_fastrtps_cpp.dir/src/rmw_logging.cpp.o' failed
make[2]: *** [CMakeFiles/rmw_fastrtps_cpp.dir/src/rmw_logging.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/rmw_fastrtps_cpp.dir/all' failed
make[1]: *** [CMakeFiles/rmw_fastrtps_cpp.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

<== Command '. /home/rosi/ros2_ws/build/rmw_fastrtps_cpp/cmake__build.sh && /usr/bin/make -j8 -l8' failed in '/home/rosi/ros2_ws/build/rmw_fastrtps_cpp' with exit code '2'
<== Command '. /home/rosi/ros2_ws/build/rmw_fastrtps_cpp/cmake__build.sh && /usr/bin/make -j8 -l8' failed in '/home/rosi/ros2_ws/build/rmw_fastrtps_cpp' with exit code '2'

Your error is different than what is discussed in this thread. Therefore I suggest in the future create a new thread or a question on answers.ros.org.

Regarding the error message: it looks like you are mixing a newer version of rmw_fastrtps_cpp with an older version of rmw. This is not supported. Either stick two both packages from e.g. the latest release or use both packages from the current default branch.

i thought we are posting ros2 issues in ros discourse. And also, as this topic is related to ament build tests which i created earlier so I linked this issue to this thread.

I did sudo apt-get remove ros-ardent-* and also removed my workspace and then downloaded and reinstalled everything back. How do I solve this again? I think old versions Screenshot from 2018-02-02 11-22-19have stayed in. Please help, it has stopped all my development in ros2 now.

I have these installed :

Additionally, I get this which i never got before when I source install/setup.bash:

Warning: OSPL_URI was already set to [[file:///home/rosi/ros2_ws/install/share/opensplice_cmake_module/config/ros_ospl.xml]]. This will not override it to the default [[file:///opt/ros/ardent/share/opensplice_cmake_module/config/ros_ospl.xml]]. Please make sure this is the config that you want.

I tried this : https://github.com/ros2/rmw_opensplice/pull/219

doesn’t help though I still get the error message from opensplice.sh and other rmw implementation.

Ok I believe I have figured it out. Since been using the beta version and now moved to the ardent debian version.

After installation, when I moved to the ament tutorial:

wget https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
vcs import ~/ros2_ws/src < ros2.repos

I ran those again. That is why it was creating duplicate probably. Just realised it is clearly mentioned there:

To start off we need to setup an underlay without any of ROS2 installed.

My apologies @dirk-thomas and that is great that I don’t need to go through the 2 hours of build and test time to set up my ros2.