Node Unit test: can't launch them on crosscompiled build

asked 2019-01-25 06:23:49 -0500

jotator gravatar image

updated 2019-01-28 09:28:00 -0500

I am trying to prepare some UTs for a package I have, which contains an executable that relies on messages defined on other packages I created. The build is meant for an ARM target, so a custom toolchain file is fed to catkin_make.

The node compiles and works nicely, but now I am trying to add tests with gtest and the first attempt (empty test) throwns an error claiming that it can't find gtest in the first place:

/usr/src/gtest/src/ fatal error: gtest/gtest.h: No such file or directory
compilation terminated.
gtest/CMakeFiles/gtest.dir/build.make:62: recipe for target 'gtest/CMakeFiles/gtest.dir/src/' failed
make[3]: *** [gtest/CMakeFiles/gtest.dir/src/] Error 1
CMakeFiles/Makefile2:246: recipe for target 'gtest/CMakeFiles/gtest.dir/all' failed
make[2]: *** [gtest/CMakeFiles/gtest.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
Scanning dependencies of target roscpp_generate_messages_cpp
[  1%] Built target roscpp_generate_messages_cpp
CMakeFiles/Makefile2:106: recipe for target 'CMakeFiles/run_tests.dir/rule' failed
make[1]: *** [CMakeFiles/run_tests.dir/rule] Error 2
Makefile:186: recipe for target 'run_tests' failed
make: *** [run_tests] Error 2
Invoking "make run_tests -j2 -l2" failed
edit retag flag offensive close merge delete


Can you please update your question with a copy and paste of the error?

jayess gravatar image jayess  ( 2019-01-25 07:30:29 -0500 )edit

Completely remade the question after realizing I was attempting a native build for an executable target that depends on crosscompiled binaries

jotator gravatar image jotator  ( 2019-01-28 09:29:12 -0500 )edit

The value of unit tests is reduced somewhat if your building and testing them in a different environment. Are you trying to build the release nodes for the ARM target and the UT nodes for the native target?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-01-28 10:30:35 -0500 )edit

@PeteBlackerThe3rd I am building the release node for ARM. How is the value reduced if no platform-dependent aspects are involved?

jotator gravatar image jotator  ( 2019-01-28 10:37:00 -0500 )edit

That's the caveat.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-01-28 11:37:58 -0500 )edit

Ok, I just realized I am trying to compile against ARM shared libraries I previously compiled. While I fix that, I take it that if I want to produce the gtest executable I'll have to do a native build, right?

jotator gravatar image jotator  ( 2019-01-29 11:52:51 -0500 )edit

Yes if you're running on the host then yes. Although if you have network access to an ARM machine you could potentially script the tests to run on that target. This could be a real pain to setup but would be the ideal solution, since you would be 'testing as you work'

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-01-29 12:06:50 -0500 )edit

I have to upload all to a Jenkins machine that runs them natively, so perhaps it would be best if I do it that way. Once I have it running, I will post an answer with how I did it. Thanks!

jotator gravatar image jotator  ( 2019-01-30 08:44:46 -0500 )edit