Skip to content

testing: Fix brittle behavior of tests that need to cmake - #5359

Open
lgritz wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-root
Open

testing: Fix brittle behavior of tests that need to cmake#5359
lgritz wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-root

Conversation

@lgritz

@lgritz lgritz commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

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

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>
@lgritz

lgritz commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

@darix would love for you to test this and give an approval if it works for you

@darix

darix commented Aug 1, 2026

Copy link
Copy Markdown

does not work.

abuild@openSUSETumbleweed-x8664:~/rpmbuild/BUILD/OpenImageIO-3.1.16.0-build> find BUILDROOT/ -not -type d -ls | grep -vE '(src/debug|\.h$)'
   106785   2360 -rw-r--r--   1 abuild   abuild    2414063 Aug  1 23:07 BUILDROOT/usr/lib/debug/.dwz/OpenImageIO-3.1.16.0-0.x86_64
   106796  51596 -rwxr-xr-x   1 abuild   abuild   52832120 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/lib64/libOpenImageIO.so.3.1.16.debug
   106792   7308 -rwxr-xr-x   1 abuild   abuild    7480928 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/lib64/libOpenImageIO_Util.so.3.1.16.debug
   106795  35120 -rwxr-xr-x   1 abuild   abuild   35962856 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/lib64/python3.13/site-packages/OpenImageIO/OpenImageIO.cpython-313-x86_64-linux-gnu.so.debug
   106794   5532 -rwxr-xr-x   1 abuild   abuild    5662632 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/bin/iv.debug
   106793  10424 -rwxr-xr-x   1 abuild   abuild   10670672 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/bin/oiiotool.debug
   106791   2008 -rwxr-xr-x   1 abuild   abuild    2054560 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/bin/testtex.debug
   106790   2256 -rwxr-xr-x   1 abuild   abuild    2307864 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/bin/iinfo.debug
   106789   1520 -rwxr-xr-x   1 abuild   abuild    1554312 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/bin/igrep.debug
   106788   1056 -rwxr-xr-x   1 abuild   abuild    1079184 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/bin/maketx.debug
   106787   1132 -rwxr-xr-x   1 abuild   abuild    1155584 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/bin/iconvert.debug
   106786   1036 -rwxr-xr-x   1 abuild   abuild    1057312 Aug  1 23:07 BUILDROOT/usr/lib/debug/usr/bin/idiff.debug
   107127      4 -rw-r--r--   1 abuild   abuild        270 Aug  1 23:07 BUILDROOT/usr/share/man/man1/oiiotool.1.gz
   107126      4 -rw-r--r--   1 abuild   abuild        494 Aug  1 23:07 BUILDROOT/usr/share/man/man1/iinfo.1.gz
   107125      4 -rw-r--r--   1 abuild   abuild       2767 Aug  1 23:07 BUILDROOT/usr/share/man/man1/maketx.1.gz
   107124      4 -rw-r--r--   1 abuild   abuild        777 Aug  1 23:07 BUILDROOT/usr/share/man/man1/idiff.1.gz
   107123      4 -rw-r--r--   1 abuild   abuild        544 Aug  1 23:07 BUILDROOT/usr/share/man/man1/igrep.1.gz
   107122      4 -rw-r--r--   1 abuild   abuild        970 Aug  1 23:07 BUILDROOT/usr/share/man/man1/iconvert.1.gz
   107121      4 -rw-r--r--   1 abuild   abuild        506 Aug  1 23:07 BUILDROOT/usr/share/man/man1/iv.1.gz
   106695    316 -rw-r--r--   1 abuild   abuild     322415 Jul 31 07:45 BUILDROOT/usr/share/doc/packages/OpenImageIO/CHANGES-2.x.md
   106693    220 -rw-r--r--   1 abuild   abuild     224060 Jul 31 07:45 BUILDROOT/usr/share/doc/packages/OpenImageIO/CHANGES-1.x.md
   106691     36 -rw-r--r--   1 abuild   abuild      33806 Jul 31 07:45 BUILDROOT/usr/share/doc/packages/OpenImageIO/CHANGES-0.x.md
   106689    196 -rw-r--r--   1 abuild   abuild     198912 Jul 31 07:45 BUILDROOT/usr/share/doc/packages/OpenImageIO/CHANGES.md
   106687     16 -rw-r--r--   1 abuild   abuild      13418 Jul 31 07:45 BUILDROOT/usr/share/doc/packages/OpenImageIO/THIRD-PARTY.md
   106536    460 -rwxr-xr-x   1 abuild   abuild     469968 Aug  1 23:07 BUILDROOT/usr/bin/iv
   106534    268 -rwxr-xr-x   1 abuild   abuild     272856 Aug  1 23:07 BUILDROOT/usr/bin/testtex
   106532   1160 -rwxr-xr-x   1 abuild   abuild    1186520 Aug  1 23:07 BUILDROOT/usr/bin/oiiotool
   106530    168 -rwxr-xr-x   1 abuild   abuild     170344 Aug  1 23:07 BUILDROOT/usr/bin/maketx
   106528    276 -rwxr-xr-x   1 abuild   abuild     280936 Aug  1 23:07 BUILDROOT/usr/bin/iinfo
   106526    156 -rwxr-xr-x   1 abuild   abuild     158064 Aug  1 23:07 BUILDROOT/usr/bin/igrep
   106524    164 -rwxr-xr-x   1 abuild   abuild     166240 Aug  1 23:07 BUILDROOT/usr/bin/idiff
   106522    164 -rwxr-xr-x   1 abuild   abuild     166272 Aug  1 23:07 BUILDROOT/usr/bin/iconvert
   106724      8 -rw-r--r--   1 abuild   abuild       5463 Aug  1 23:06 BUILDROOT/usr/lib64/cmake/OpenImageIO/OpenImageIOTargets-relwithdebinfo.cmake
   106722      8 -rw-r--r--   1 abuild   abuild       5904 Aug  1 23:06 BUILDROOT/usr/lib64/cmake/OpenImageIO/OpenImageIOTargets.cmake
   106720      4 -rw-r--r--   1 abuild   abuild       2771 Aug  1 23:06 BUILDROOT/usr/lib64/cmake/OpenImageIO/OpenImageIOConfigVersion.cmake
   106718      4 -rw-r--r--   1 abuild   abuild       3891 Aug  1 23:06 BUILDROOT/usr/lib64/cmake/OpenImageIO/OpenImageIOConfig.cmake
   106714      4 -rw-r--r--   1 abuild   abuild        273 Aug  1 23:06 BUILDROOT/usr/lib64/pkgconfig/OpenImageIO.pc
   106547      0 -rw-r--r--   1 abuild   abuild          0 Jul 31 07:45 BUILDROOT/usr/lib64/python3.13/site-packages/OpenImageIO/py.typed
   106545     88 -rw-r--r--   1 abuild   abuild      86448 Jul 31 07:45 BUILDROOT/usr/lib64/python3.13/site-packages/OpenImageIO/__init__.pyi
   106543      4 -rw-r--r--   1 abuild   abuild       2135 Aug  1 23:06 BUILDROOT/usr/lib64/python3.13/site-packages/OpenImageIO/__init__.py
   106541   2064 -rwxr-xr-x   1 abuild   abuild    2112408 Aug  1 23:07 BUILDROOT/usr/lib64/python3.13/site-packages/OpenImageIO/OpenImageIO.cpython-313-x86_64-linux-gnu.so
   106519      0 lrwxrwxrwx   1 abuild   abuild         21 Aug  1 23:07 BUILDROOT/usr/lib64/libOpenImageIO.so -> libOpenImageIO.so.3.1
   106518      0 lrwxrwxrwx   1 abuild   abuild         24 Aug  1 23:07 BUILDROOT/usr/lib64/libOpenImageIO.so.3.1 -> libOpenImageIO.so.3.1.16
   106517   7224 -rwxr-xr-x   1 abuild   abuild    7393672 Aug  1 23:07 BUILDROOT/usr/lib64/libOpenImageIO.so.3.1.16
   106515      0 lrwxrwxrwx   1 abuild   abuild         26 Aug  1 23:07 BUILDROOT/usr/lib64/libOpenImageIO_Util.so -> libOpenImageIO_Util.so.3.1
   106514      0 lrwxrwxrwx   1 abuild   abuild         29 Aug  1 23:07 BUILDROOT/usr/lib64/libOpenImageIO_Util.so.3.1 -> libOpenImageIO_Util.so.3.1.16
   106513    792 -rwxr-xr-x   1 abuild   abuild     810504 Aug  1 23:07 BUILDROOT/usr/lib64/libOpenImageIO_Util.so.3.1.16

would it work with that layout? that buildroot directory is passed in via DESTDIR

@lgritz

lgritz commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

I'm not sure why the layout would matter. In the patch, it just sets OpenImageIO_ROOT to ${CMAKE_INSTALL_PREFIX}" (within our testing.cmake), so I'm not sure why it wouldn't work no matter what you used for CMAKE_INSTALL_PREFIX.

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.

@darix

darix commented Aug 1, 2026

Copy link
Copy Markdown

yeah but it isnt installed to ${CMAKE_INSTALL_PREFIX} but to ${DESTDIR}${CMAKE_INSTALL_PREFIX}. All our builds are running as non root so they can not install to CMAKE_INSTALL_PREFIX.

@lgritz

lgritz commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

I don't understand. Isn't the way it gets installed to invoke with something like

cmake -B build -S . -DCMAKE_INSTALL_PREFIX=...path...
cmake --build build --target install

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?

@lgritz lgritz added the build / testing / port / CI Affecting the build system, tests, platform support, porting, or continuous integration. label Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build / testing / port / CI Affecting the build system, tests, platform support, porting, or continuous integration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: New testsuite failures with 3.1.16.0

2 participants