Node Unit test: can't launch them on crosscompiled build
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/gtest-all.cc:39:25: 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/gtest-all.cc.o' failed
make[3]: *** [gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] 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
Can you please update your question with a copy and paste of the error?
Completely remade the question after realizing I was attempting a native build for an executable target that depends on crosscompiled binaries
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 I am building the release node for ARM. How is the value reduced if no platform-dependent aspects are involved?
That's the caveat.
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?
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'
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!