Skip to content

Commit ffc5b90

Browse files
authored
testing: env variable OSL_TESTSUITE_THRESH_SCALE scales test thresholds (#1934)
For any individual test running, the OSL_TESTSUITE_THRESH_SCALE environment variable, if set, will scale the image comparison thresholds used to decide if a test passes. Furthermore, a special OSL_TESTSUITE_OPTIX_THRESH_SCALE environment variable, if set, will cause *all* OptiX related tests to be set up with scaled thresholds. Signed-off-by: Larry Gritz <[email protected]>
1 parent ddb959e commit ffc5b90

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/cmake/testing.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ macro (add_one_testsuite testname testsrcdir)
9090
# Make sure libnvrtc-builtins.so is reachable
9191
set_property (TEST ${testname} APPEND PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${CUDA_TOOLKIT_ROOT_DIR}/lib64:$ENV{LD_LIBRARY_PATH})
9292
endif()
93+
if (DEFINED ENV{OSL_TESTSUITE_OPTIX_THRESH_SCALE})
94+
set_property (TEST ${testname} APPEND PROPERTY ENVIRONMENT OSL_TESTSUITE_THRESH_SCALE=$ENV{OSL_TESTSUITE_OPTIX_THRESH_SCALE})
95+
endif ()
9396
endif ()
9497
if (${testname} MATCHES "-reg")
9598
# These are batched shading regression tests. Some are quite

testsuite/runtest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,16 @@ def runtest (command, outputs, failureok=0, failthresh=0, failpercent=0, regress
406406
hardfail *= 2.0
407407
failpercent *= 2.0
408408

409+
# Allow an environment variable to scale the testsuite image comparison
410+
# thresholds:
411+
if 'OSL_TESTSUITE_THRESH_SCALE' in os.environ :
412+
thresh_scale = float(os.getenv('OSL_TESTSUITE_THRESH_SCALE', '1.0'))
413+
failthresh *= thresh_scale
414+
hardfail *= thresh_scale
415+
failpercent *= thresh_scale
416+
failrelative *= thresh_scale
417+
allowfailures = int(allowfailures * thresh_scale)
418+
409419
# Force out.txt to be in the outputs
410420
##if "out.txt" not in outputs :
411421
## outputs.append ("out.txt")

0 commit comments

Comments
 (0)