CTests: Initial work to cover Cycles nodes with OpenGL tests
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 10 Feb 2017 13:52:54 +0000 (14:52 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 10 Feb 2017 13:52:54 +0000 (14:52 +0100)
Works similar to regular Cycles tests, just does OpenGL render to
get output image.

Seems to work fine with the only funny effect: Blender window will
pop up for each of the tests. This is current limitation of our
OpenGL context. Might be changed in the future.

CMakeLists.txt
tests/python/CMakeLists.txt
tests/python/cycles_render_tests.py

index 092de982b9d7ab19d9cd5ca948f663b2dab5096c..1cc3e02e03a1d6a6770378bbf5aadd1f141b5bfd 100644 (file)
@@ -445,6 +445,7 @@ option(WITH_BOOST                                   "Enable features depending on boost" ON)
 
 # Unit testsing
 option(WITH_GTESTS "Enable GTest unit testing" OFF)
+option(WITH_OPENGL_TESTS "Enable OpenGL related unit testing (Experimental)" OFF)
 
 
 # Documentation
index 3040e400cee9cfd888168f821bd0a8a2fb3d2895..935a2a807fe2554b6d9beb823c8ad416f4dc8046 100644 (file)
@@ -418,6 +418,9 @@ if(WITH_CYCLES)
                                )
                        endif()
                endmacro()
+               if(WITH_OPENGL_TESTS)
+                       add_cycles_render_test(opengl)
+               endif()
                add_cycles_render_test(reports)
                add_cycles_render_test(render)
                add_cycles_render_test(shader)
index 64a71da301ae064002db6ca2c25e94027cf221b7..a030cc5e0de0e9db68be785cebc4d312c6ee95ec 100755 (executable)
@@ -47,20 +47,41 @@ def printMessage(type, status, message):
 
 
 def render_file(filepath):
-    command = (
-        BLENDER,
-        "--background",
-        "-noaudio",
-        "--factory-startup",
-        "--enable-autoexec",
-        filepath,
-        "-E", "CYCLES",
-        # Run with OSL enabled
-        # "--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True",
-        "-o", TEMP_FILE_MASK,
-        "-F", "PNG",
-        "-f", "1",
+    dirname = os.path.dirname(filepath)
+    basedir = os.path.dirname(dirname)
+    subject = os.path.basename(dirname)
+    if subject == 'opengl':
+        command = (
+            BLENDER,
+            "--window-geometry", "0", "0", "1", "1",
+            "-noaudio",
+            "--factory-startup",
+            "--enable-autoexec",
+            filepath,
+            "-E", "CYCLES",
+            # Run with OSL enabled
+            # "--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True",
+            "-o", TEMP_FILE_MASK,
+            "-F", "PNG",
+            '--python', os.path.join(basedir,
+                                     "util",
+                                     "render_opengl.py")
         )
+    else:
+        command = (
+            BLENDER,
+            "--background",
+            "-noaudio",
+            "--factory-startup",
+            "--enable-autoexec",
+            filepath,
+            "-E", "CYCLES",
+            # Run with OSL enabled
+            # "--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True",
+            "-o", TEMP_FILE_MASK,
+            "-F", "PNG",
+            "-f", "1",
+            )
     try:
         output = subprocess.check_output(command)
         if VERBOSE: