Skip to content

Commit a0db580

Browse files
authored
build: fully disable tests when their required dependencies are missing (AcademySoftwareFoundation#5005)
We previously merely *marked* tests as "broken" in this case, and depended on ctest being launched with `-E broken` to ensure those were skipped. Not everybody did. Let's just truly skip them. Fixes AcademySoftwareFoundation#4979 Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 96a875c commit a0db580

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ test: build
293293
@ ${CMAKE} -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests ${TEST_FLAGS}..."
294294
@ ( cd ${build_dir} ; \
295295
PYTHONPATH=${PWD}/${build_dir}/lib/python/site-packages \
296-
ctest -E broken ${TEST_FLAGS} \
296+
ctest ${TEST_FLAGS} \
297297
)
298298
@ ( if [[ "${CODECOV}" == "1" ]] ; then \
299299
cd ${build_dir} ; \

src/cmake/testing.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ set(OIIO_TESTSUITE_IMAGEDIR "${PROJECT_BINARY_DIR}/testsuite" CACHE PATH
4747
#
4848
# The optional SUFFIX is appended to the test name.
4949
#
50-
# The optinonal ENVIRONMENT is a list of environment variables to set for the
50+
# The optional ENVIRONMENT is a list of environment variables to set for the
5151
# test.
5252
#
5353
macro (oiio_add_tests)
@@ -56,24 +56,29 @@ macro (oiio_add_tests)
5656
set (_ats_testdir "${OIIO_TESTSUITE_IMAGEDIR}/${_ats_IMAGEDIR}")
5757
# If there was a FOUNDVAR param specified and that variable name is
5858
# not defined, mark the test as broken.
59+
set (_test_disabled FALSE)
60+
set (_test_notfound FALSE)
5961
foreach (_var ${_ats_FOUNDVAR})
6062
if (NOT ${_var})
6163
set (_ats_LABEL "broken")
64+
set (_test_notfound TRUE)
6265
endif ()
6366
endforeach ()
6467
set (_test_disabled 0)
6568
foreach (_var ${_ats_ENABLEVAR})
6669
if ((NOT "${${_var}}" STREQUAL "" AND NOT "${${_var}}") OR
6770
(NOT "$ENV{${_var}}" STREQUAL "" AND NOT "$ENV{${_var}}"))
6871
set (_ats_LABEL "broken")
69-
set (_test_disabled 1)
72+
set (_test_disabled TRUE)
7073
endif ()
7174
endforeach ()
7275
# For OCIO 2.2+, have the testsuite use the default built-in config
7376
list (APPEND _ats_ENVIRONMENT "OCIO=ocio://default"
7477
"OIIO_TESTSUITE_OCIOCONFIG=ocio://default")
7578
if (_test_disabled)
7679
message (STATUS "Skipping test(s) ${_ats_UNPARSED_ARGUMENTS} because of disabled ${_ats_ENABLEVAR}")
80+
elseif (_test_notfound)
81+
message (STATUS "Skipping test(s) ${_ats_UNPARSED_ARGUMENTS} because of missing dependency from ${_ats_FOUNDVAR}")
7782
elseif (_ats_IMAGEDIR AND NOT EXISTS ${_ats_testdir})
7883
# If the directory containing reference data (images) for the test
7984
# isn't found, point the user at the URL.

0 commit comments

Comments
 (0)