Skip to content

Commit 150b9a7

Browse files
committed
testing: address review feedback on OpenEXR lj2k/zstd compression tests
Raise the local build OpenEXR default to 3.5.0 in build_OpenEXR.cmake, matching the version already bumped in the build shell script. Rename the OIIO_OPENEXR_NEW_COMPRESSION environment variable to OIIO_OPENEXR_LJ2K_ZSTD_SUPPORT, old env variable would have read oddly once something else lands in a future OpenEXR release. The lj2k/zstd env var is now added via set_property(TEST ... APPEND PROPERTY ENVIRONMENT ...) once OpenEXR_VERSION >= 3.5.0, after both the base and .core test variants already exist, rather than being threaded through ENVIRONMENT arguments on a separate set of oiio_add_tests() calls. Add testsuite/openexr-compression/ref/out-legacy.txt so the test still passes on OpenEXR < 3.5.0, where lj2k/zstd aren't compiled in. Signed-off-by: Abhirup Bhattacharyya <abhirup27022001@outlook.com>
1 parent 78f21a6 commit 150b9a7

4 files changed

Lines changed: 41 additions & 34 deletions

File tree

‎src/cmake/build_OpenEXR.cmake‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://github.com/AcademySoftwareFoundation/OpenImageIO
44

55

6-
set_cache (OpenEXR_BUILD_VERSION 3.4.15 "OpenEXR version for local builds")
6+
set_cache (OpenEXR_BUILD_VERSION 3.5.0 "OpenEXR version for local builds")
77
set (OpenEXR_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenEXR")
88
set (OpenEXR_GIT_TAG "v${OpenEXR_BUILD_VERSION}")
99
set (OpenEXR_GIT_COMMIT "e71cdd5d30a146dcb56c5e4c576d9e9d3c45f4fb")

‎src/cmake/testing.cmake‎

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44

55
include (CTest)
66

7-
# New compression tests of zstd and lj2k require OpenEXR main branch, or latest release or at least V3.5.0
8-
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.5)
9-
set (_openexr_new_compression "1")
10-
else ()
11-
set (_openexr_new_compression "0")
12-
endif ()
13-
147
# Make a build/platform/testsuite directory, and copy the master runtest.py
158
# there. The rest is up to the tests themselves.
169
file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testsuite")
@@ -449,10 +442,7 @@ macro (oiio_add_all_tests)
449442
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.1.10)
450443
# OpenEXR 3.1.10 is the first release where the exr core library
451444
# properly supported all compression types (DWA in particular).
452-
453-
# openexr-compression is added separately below so that its
454-
# OpenEXR-3.5-specific cases can be selected conditionally.
455-
445+
list (APPEND all_openexr_tests openexr-compression)
456446
# openexr-scanlines reads a DWA-compressed file, so it needs the same
457447
# minimum as openexr-compression for the core-library test variant.
458448
if (USE_PYTHON AND NOT SANITIZE)
@@ -471,35 +461,22 @@ macro (oiio_add_all_tests)
471461
ENVIRONMENT OPENIMAGEIO_OPTIONS=openexr:core=0 "${_pybind_tests_pythonpath}"
472462
IMAGEDIR openexr-images
473463
URL http://github.com/AcademySoftwareFoundation/openexr-images)
474-
475-
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.1.10)
476-
# For OpenEXR >= 3.5 we need to add the new compression tests
477-
oiio_add_tests (openexr-compression
478-
ENVIRONMENT OPENIMAGEIO_OPTIONS=openexr:core=0
479-
"OIIO_OPENEXR_NEW_COMPRESSION=${_openexr_new_compression}"
480-
"${_pybind_tests_pythonpath}"
481-
IMAGEDIR openexr-images
482-
URL http://github.com/AcademySoftwareFoundation/openexr-images)
483-
endif ()
484-
464+
# For OpenEXR >= 3.1, be sure to test with the core option on
485465
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.1)
486-
# For OpenEXR >= 3.5 we need to add the new compression tests, with the core library
487466
oiio_add_tests (${all_openexr_tests}
488467
SUFFIX ".core"
489468
ENVIRONMENT OPENIMAGEIO_OPTIONS=openexr:core=1 "${_pybind_tests_pythonpath}"
490469
IMAGEDIR openexr-images
491470
URL http://github.com/AcademySoftwareFoundation/openexr-images)
492471
endif ()
493472

494-
# For OpenEXR >= 3.5
495-
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.1.10)
496-
oiio_add_tests (openexr-compression
497-
SUFFIX ".core"
498-
ENVIRONMENT OPENIMAGEIO_OPTIONS=openexr:core=1
499-
"OIIO_OPENEXR_NEW_COMPRESSION=${_openexr_new_compression}"
500-
"${_pybind_tests_pythonpath}"
501-
IMAGEDIR openexr-images
502-
URL http://github.com/AcademySoftwareFoundation/openexr-images)
473+
# New compression tests of zstd and lj2k require OpenEXR main branch,
474+
# or latest release or at least V3.5.0
475+
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.5.0)
476+
set_property (TEST openexr-compression APPEND PROPERTY ENVIRONMENT
477+
"OIIO_OPENEXR_LJ2K_ZSTD_SUPPORT=1")
478+
set_property (TEST openexr-compression.core APPEND PROPERTY ENVIRONMENT
479+
"OIIO_OPENEXR_LJ2K_ZSTD_SUPPORT=1")
503480
endif ()
504481

505482
# Regression test (compiles its own helper and generates its own image)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
out-none.exr compression none
2+
out-rle.exr compression rle
3+
out-zips.exr compression zips
4+
out-zip.exr compression zip
5+
out-piz.exr compression piz
6+
out-pxr24.exr compression pxr24
7+
out-b44.exr compression b44
8+
out-b44a.exr compression b44a
9+
out-dwaa.exr compression dwaa
10+
out-dwab.exr compression dwab
11+
Comparing "out-none.exr" and "ref/out-zip.exr"
12+
PASS
13+
Comparing "out-rle.exr" and "ref/out-zip.exr"
14+
PASS
15+
Comparing "out-zips.exr" and "ref/out-zip.exr"
16+
PASS
17+
Comparing "out-zip.exr" and "ref/out-zip.exr"
18+
PASS
19+
Comparing "out-piz.exr" and "ref/out-zip.exr"
20+
PASS
21+
Comparing "out-pxr24.exr" and "ref/out-zip.exr"
22+
PASS
23+
Comparing "out-b44.exr" and "ref/out-b44.exr"
24+
PASS
25+
Comparing "out-b44a.exr" and "ref/out-b44.exr"
26+
PASS
27+
Comparing "out-dwaa.exr" and "ref/out-dwaa.exr"
28+
PASS
29+
Comparing "out-dwab.exr" and "ref/out-dwaa.exr"
30+
PASS

‎testsuite/openexr-compression/run.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"dwab",
2222
]
2323

24-
if os.getenv("OIIO_OPENEXR_NEW_COMPRESSION") == "1":
24+
if os.getenv("OIIO_OPENEXR_LJ2K_ZSTD_SUPPORT") == "1":
2525
compressions += ["lj2k", "zstd"]
2626

2727
anymatch = True

0 commit comments

Comments
 (0)