gz-math
gz-math copied to clipboard
EXAMPLES_*_TEST require a system installation of gz-math code to work
While testing https://github.com/gazebo-release/gz-math7-release/pull/19 I found that gz-math7 nightlies are probably broken after https://github.com/gazebosim/gz-math/pull/482. The CI is installing the files into the system before running the test suite (something probably that we should change) so the error has skipped from our CI mechanisms.
Environment
- OS Version: jammy
- Source or binary build: source build, gz-math7 branch
Description
- Expected behavior: testing examples should ideally not require to install the library into the system.
- Actual behavior: compile the code in the user system and running the test suite makes the EXAMPLES_ test to fail.
Steps to reproduce
- checkout current gz-math7 branch
- cmake + make
- ARGS="-VV -R EXAMPLES*" make test
Output
ign-math/build on gz-math7 via △ v3.22.1 ❯ ARGS="-VV -R EXAMPLES*" make test
Running tests...
UpdateCTestConfiguration from :/home/jrivero/code/ignition/ign-math/build/DartConfiguration.tcl
Parse Config file:/home/jrivero/code/ignition/ign-math/build/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/jrivero/code/ignition/ign-math/build/DartConfiguration.tcl
Parse Config file:/home/jrivero/code/ignition/ign-math/build/DartConfiguration.tcl
Test project /home/jrivero/code/ignition/ign-math/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: EXAMPLES_Configure_TEST
1: Test command: /usr/bin/cmake "-GUnix Makefiles" "--no-warn-unused-cli" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_C_FLAGS=" "-DCMAKE_CXX_FLAGS=" "-DCMAKE_PREFIX_PATH=/usr/local" "-S" "/home/jrivero/code/ignition/ign-math/examples" "-B" "/home/jrivero/code/ignition/ign-math/build/examples"
1: Test timeout computed to be: 1500
1: CMake Error at CMakeLists.txt:6 (find_package):
1: By not providing "Findgz-math7.cmake" in CMAKE_MODULE_PATH this project has
1: asked CMake to find a package configuration file provided by "gz-math7",
1: but CMake did not find one.
1:
1: Could not find a package configuration file provided by "gz-math7" with any
1: of the following names:
1:
1: gz-math7Config.cmake
1: gz-math7-config.cmake
1:
1: Add the installation prefix of "gz-math7" to CMAKE_PREFIX_PATH or set
1: "gz-math7_DIR" to a directory containing one of the above files. If
1: "gz-math7" provides a separate development package or SDK, be sure it has
1: been installed.
1:
1: Not searching for unused variables given on the command line.
1:
1: -- Configuring incomplete, errors occurred!
1: See also "/home/jrivero/code/ignition/ign-math/build/examples/CMakeFiles/CMakeOutput.log".
1/2 Test #1: EXAMPLES_Configure_TEST ..........***Failed 0.01 sec
test 2
Start 2: EXAMPLES_Build_TEST
2: Test command: /usr/bin/cmake "--build" "/home/jrivero/code/ignition/ign-math/build/examples" "--config" "RelWithDebInfo"
2: Test timeout computed to be: 1500
2: gmake[1]: Entering directory '/home/jrivero/code/ignition/ign-math/build/examples'
2: gmake[1]: Makefile: No such file or directory
2: gmake[1]: *** No rule to make target 'Makefile'. Stop.
2: gmake[1]: Leaving directory '/home/jrivero/code/ignition/ign-math/build/examples'
2/2 Test #2: EXAMPLES_Build_TEST ..............***Failed 0.00 sec
0% tests passed, 2 tests failed out of 2
Total Test time (real) = 0.02 sec
The following tests FAILED:
1 - EXAMPLES_Configure_TEST (Failed)
2 - EXAMPLES_Build_TEST (Failed)
Errors while running CTest
Output from these tests are in: /home/jrivero/code/ignition/ign-math/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
make: *** [Makefile:91: test] Error 8
Expected behavior: testing examples should ideally not require to install the library into the system.
The way that this was implemented was to not require installation, but instead use the libraries out of the build folder. I will take a look and see what is happening here.
Okay, after taking a look, it's somewhat related to this conversation: https://github.com/gazebosim/gz-cmake/pull/301#discussion_r1163354177
The issue is that we can't really have a self-contained examples/CMakeLists.txt file without a full installation somewhere. Note that the installation doesn't have to be a system installation, but generally assumes that colcon was the way that the package was built (there was cmake && make && make install before make test). This probably also explains why we didn't catch it in any of our CI before the deb packaging job.
In the past, we had worked around this by making a FAKE_INSTALL target, but this didn't work on Windows for one reason or another.
There may be another work around here, but the crux of the issue is that our gz_find_package logic doesn't work until the package is installed and we require our examples to make use of that flow.
CC: @azeey
Not sure if this is ready to be closed yet.
Ah, sorry, github linked issues.