testing: Fix brittle behavior of tests that need to cmake - #5359
Conversation
Some tests (like cmake-consumer, but also the newly added imagebufalgo-opencv and openexr-partialtile) build their own executable, and so have their own CMakeLists.txt that needs to find_package(OpenImageIO). This only works in our CI because it sets OpenImageIO_ROOT (and, as it turns out, locally for me it works because I habitually have that set as well). But it can fail for users who don't have OpenImageIO_ROOT set to the place where the build being tested has installed itself. Fix it by setting this environment variable for all tests. This makes it work if the person running the tests has failed to set the variable, and it also ensure that things will work right if it IS set, but to the wrong place (like a different install than the build we're trying to test). Also make failed tests echo build.txt to the main log, if it exists, so that these in-test build failures can be more easily discerned from viewing the main CI log. Fixes 5358 Signed-off-by: Larry Gritz <lg@larrygritz.com>
|
@darix would love for you to test this and give an approval if it works for you |
|
does not work. would it work with that layout? that buildroot directory is passed in via DESTDIR |
|
I'm not sure why the layout would matter. In the patch, it just sets OpenImageIO_ROOT to Though it does depend on having the "install" target build BEFORE running all the tests. They layout of our "build" directory (pre-install) is not quite the same as a full install. |
|
yeah but it isnt installed to |
|
I don't understand. Isn't the way it gets installed to invoke with something like and then that same CMAKE_INSTALL_PREFIX definition provides both the install destination, and via this patch, also the path that OpenImageIO_ROOT will be set to when running the test? |
Some tests (like cmake-consumer, but also the newly added imagebufalgo-opencv and openexr-partialtile) build their own executable, and so have their own CMakeLists.txt that needs to find_package(OpenImageIO).
This only works in our CI because it sets OpenImageIO_ROOT (and, as it turns out, locally for me it works because I habitually have that set as well). But it can fail for users who don't have OpenImageIO_ROOT set to the place where the build being tested has installed itself.
Fix it by setting this environment variable for all tests. This makes it work if the person running the tests has failed to set the variable, and it also ensure that things will work right if it IS set, but to the wrong place (like a different install than the build we're trying to test).
Also make failed tests echo build.txt to the main log, if it exists, so that these in-test build failures can be more easily discerned from viewing the main CI log.
Fixes #5358