Tests: only run OpenGL draw tests on lib/tests/opengl, support symlinks.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 20 Feb 2019 15:03:13 +0000 (16:03 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 20 Feb 2019 16:13:33 +0000 (17:13 +0100)
To keep running these tests relatively fast and practical to run often,
running it on all .blend files is a bit much. So now we only run it on
files from this directory.

Additionally this adds supports for following symlinks, so that you can
easily symlinks to other directories if you want to tests extra files
which may have linked libraries.

tests/python/CMakeLists.txt

index 46e9172..23d3282 100644 (file)
@@ -572,17 +572,19 @@ endif()
 
 if(WITH_OPENGL_DRAW_TESTS)
        if(OPENIMAGEIO_IDIFF AND EXISTS "${TEST_SRC_DIR}/opengl")
-               # Use all test folders
-               file(GLOB children RELATIVE ${TEST_SRC_DIR} ${TEST_SRC_DIR}/*)
+               # Use all subdirectories of opengl folder.
+               file(GLOB children RELATIVE ${TEST_SRC_DIR}/opengl ${TEST_SRC_DIR}/opengl/*)
                foreach(child ${children})
-                       if(IS_DIRECTORY ${TEST_SRC_DIR}/${child})
-                               file(GLOB_RECURSE blends "${TEST_SRC_DIR}/${child}/*.blend")
+                       # Resolve symlinks, useful to test production files with linked libraries.
+                       get_filename_component(child_path ${TEST_SRC_DIR}/opengl/${child} REALPATH)
+                       if(IS_DIRECTORY ${child_path})
+                               file(GLOB_RECURSE blends "${child_path}/*.blend")
                                if(blends)
                                        add_python_test(
                                                opengl_draw_${child}_test
                                                ${CMAKE_CURRENT_LIST_DIR}/opengl_draw_tests.py
                                                -blender "$<TARGET_FILE:blender>"
-                                               -testdir "${TEST_SRC_DIR}/${child}"
+                                               -testdir "${child_path}"
                                                -idiff "${OPENIMAGEIO_IDIFF}"
                                                -outdir "${TEST_OUT_DIR}/opengl_draw"
                                        )