Cleanup: use prefix for tests
[blender.git] / tests / python / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # Contributor(s): Jacques Beaurain.
18 #
19 # ***** END GPL LICENSE BLOCK *****
20
21 # --env-system-scripts allows to run without the install target.
22
23 # Use '--write-blend=/tmp/test.blend' to view output
24
25 # Some tests are interesting but take too long to run
26 # and don't give deterministic results
27 set(USE_EXPERIMENTAL_TESTS FALSE)
28
29 set(TEST_SRC_DIR ${CMAKE_SOURCE_DIR}/../lib/tests)
30 set(TEST_OUT_DIR ${CMAKE_BINARY_DIR}/tests)
31
32 # ugh, any better way to do this on testing only?
33 execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_OUT_DIR})
34
35 #~      if(NOT IS_DIRECTORY ${TEST_SRC_DIR})
36 #~              message(FATAL_ERROR "CMake test directory not found!")
37 #~      endif()
38
39 # all calls to blender use this
40 if(APPLE)
41         if(${CMAKE_GENERATOR} MATCHES "Xcode")
42                 set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup)
43         else()
44                 set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts)
45         endif()
46 else()
47         set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts)
48 endif()
49
50 # for testing with valgrind prefix: valgrind --track-origins=yes --error-limit=no
51 # set(TEST_BLENDER_EXE_BARE ${TEST_BLENDER_EXE})
52 # set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} ${TEST_BLENDER_EXE_PARAMS} )
53
54
55 # ------------------------------------------------------------------------------
56 # GENERAL PYTHON CORRECTNESS TESTS
57 add_test(
58         NAME script_load_keymap
59         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
60         --python ${CMAKE_CURRENT_LIST_DIR}/bl_keymap_completeness.py
61 )
62
63 add_test(
64         NAME script_load_addons
65         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
66         --python ${CMAKE_CURRENT_LIST_DIR}/bl_load_addons.py
67 )
68
69 add_test(
70         NAME script_load_modules
71         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
72         --python ${CMAKE_CURRENT_LIST_DIR}/bl_load_py_modules.py
73 )
74
75 # test running operators doesn't segfault under various conditions
76 if(USE_EXPERIMENTAL_TESTS)
77         add_test(
78                 NAME script_run_operators
79                 COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
80                 --python ${CMAKE_CURRENT_LIST_DIR}/bl_run_operators.py
81         )
82 endif()
83
84 # ------------------------------------------------------------------------------
85 # PY API TESTS
86 add_test(
87         NAME script_pyapi_bpy_path
88         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
89         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_bpy_path.py
90 )
91
92 add_test(
93         NAME script_pyapi_bpy_utils_units
94         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
95         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_bpy_utils_units.py
96 )
97
98 add_test(
99         NAME script_pyapi_mathutils
100         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
101         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_mathutils.py
102 )
103
104 add_test(
105         NAME script_pyapi_idprop
106         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
107         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_idprop.py
108 )
109
110 add_test(
111         NAME script_pyapi_idprop_datablock
112         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
113         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_idprop_datablock.py
114 )
115
116 # ------------------------------------------------------------------------------
117 # MODELING TESTS
118 add_test(
119         NAME bmesh_bevel
120         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
121         ${TEST_SRC_DIR}/modeling/bevel_regression.blend
122         --python-text run_tests
123 )
124
125 add_test(
126         NAME bmesh_boolean
127         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
128         ${TEST_SRC_DIR}/modeling/bool_regression.blend
129         --python-text run_tests
130 )
131
132 add_test(
133         NAME bmesh_split_faces
134         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
135         ${TEST_SRC_DIR}/modeling/split_faces_test.blend
136         --python-text run_tests
137 )
138
139 # ------------------------------------------------------------------------------
140 # MODIFIERS TESTS
141 add_test(
142         NAME object_modifier_array
143         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
144         ${TEST_SRC_DIR}/modifier_stack/array_test.blend
145         --python-text run_tests
146 )
147
148 # ------------------------------------------------------------------------------
149 # IO TESTS
150
151 # OBJ Import tests
152 # disabled until updated & working
153 if(FALSE)
154 add_test(
155         NAME import_obj_cube
156         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
157         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
158         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/cube.obj'\)
159         --md5=39cce4bacac2d1b18fc470380279bc15 --md5_method=SCENE
160         --write-blend=${TEST_OUT_DIR}/import_obj_cube.blend
161 )
162
163 add_test(
164         NAME import_obj_nurbs_cyclic
165         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
166         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
167         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/nurbs_cyclic.obj'\)
168         --md5=ad3c307e5883224a0492378cd32691ab --md5_method=SCENE
169         --write-blend=${TEST_OUT_DIR}/import_obj_nurbs_cyclic.blend
170 )
171
172 add_test(
173         NAME import_obj_makehuman
174         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
175         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
176         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/makehuman.obj'\)
177         --md5=c9f78b185e58358daa4ecaecfa75464e --md5_method=SCENE
178         --write-blend=${TEST_OUT_DIR}/import_obj_makehuman.blend
179 )
180 endif()
181
182 # OBJ Export tests
183 add_test(
184         NAME export_obj_cube
185         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
186         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
187         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
188         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_cube.obj',use_selection=False\)
189         --md5_source=${TEST_OUT_DIR}/export_obj_cube.obj
190         --md5_source=${TEST_OUT_DIR}/export_obj_cube.mtl
191         --md5=e80660437ad9bfe082849641c361a233 --md5_method=FILE
192 )
193
194 add_test(
195         NAME export_obj_nurbs
196         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
197         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
198         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
199         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_nurbs.obj',use_selection=False,use_nurbs=True\)
200         --md5_source=${TEST_OUT_DIR}/export_obj_nurbs.obj
201         --md5_source=${TEST_OUT_DIR}/export_obj_nurbs.mtl
202         --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE
203 )
204
205 # disabled until updated & working
206 if(FALSE)
207 add_test(
208         NAME export_obj_all_objects
209         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
210         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
211         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
212         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_all_objects.obj',use_selection=False,use_nurbs=True\)
213         --md5_source=${TEST_OUT_DIR}/export_obj_all_objects.obj
214         --md5_source=${TEST_OUT_DIR}/export_obj_all_objects.mtl
215         --md5=04b3ed97cede07a19548fc518ce9f8ca --md5_method=FILE
216 )
217 endif()
218
219
220
221 # PLY Import tests
222 add_test(
223         NAME import_ply_cube
224         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
225         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
226         --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/cube_ascii.ply'\)
227         --md5=527134343c27fc0ea73115b85fbfd3ac --md5_method=SCENE
228         --write-blend=${TEST_OUT_DIR}/import_ply_cube.blend
229 )
230
231 add_test(
232         NAME import_ply_bunny
233         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
234         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
235         --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/bunny2.ply'\)
236         --md5=6ea5b8533400a17accf928b8fd024eaa --md5_method=SCENE
237         --write-blend=${TEST_OUT_DIR}/import_ply_bunny.blend
238 )
239
240 add_test(
241         NAME import_ply_small_holes
242         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
243         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
244         --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/many_small_holes.ply'\)
245         --md5=c3093e26ecae5b6d59fbbcf2a0d0b39f --md5_method=SCENE
246         --write-blend=${TEST_OUT_DIR}/import_ply_small_holes.blend
247 )
248
249 # PLY Export
250 # disabled until updated & working
251 if(FALSE)
252 add_test(
253         NAME export_ply_cube_all_data
254         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
255         ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend
256         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
257         --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_cube_all_data.ply'\)
258         --md5_source=${TEST_OUT_DIR}/export_ply_cube_all_data.ply
259         --md5=6adc3748ceae8298496f99d0e7e76c15 --md5_method=FILE
260 )
261
262 add_test(
263         NAME export_ply_suzanne_all_data
264         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
265         ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend
266         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
267         --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_suzanne_all_data.ply'\)
268         --md5_source=${TEST_OUT_DIR}/export_ply_suzanne_all_data.ply
269         --md5=68ba23f02efd6511bfd093f45f703221 --md5_method=FILE
270 )
271 endif()
272
273 add_test(
274         NAME export_ply_vertices # lame, add a better one
275         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
276         ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend
277         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
278         --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_vertices.ply'\)
279         --md5_source=${TEST_OUT_DIR}/export_ply_vertices.ply
280         --md5=37faba0aa2014451b27f951afa92f870 --md5_method=FILE
281 )
282
283
284 # STL Import tests
285 # disabled until updated & working
286 if(FALSE)
287 add_test(
288         NAME import_stl_cube
289         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
290         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
291         --run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/cube.stl'\)
292         --md5=8ceb5bb7e1cb5f4342fa1669988c66b4 --md5_method=SCENE
293         --write-blend=${TEST_OUT_DIR}/import_stl_cube.blend
294 )
295
296 add_test(
297         NAME import_stl_conrod
298         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
299         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
300         --run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/conrod.stl'\)
301         --md5=690a4b8eb9002dcd8631c5a575ea7348 --md5_method=SCENE
302         --write-blend=${TEST_OUT_DIR}/import_stl_conrod.blend
303 )
304
305 add_test(
306         NAME import_stl_knot_max_simplified
307         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
308         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
309         --run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/knot_max_simplified.stl'\)
310         --md5=baf82803f45a84ec4ddbad9cef57dd3e --md5_method=SCENE
311         --write-blend=${TEST_OUT_DIR}/import_stl_knot_max_simplified.blend
312 )
313 endif()
314
315 # STL Export
316 # disabled until updated & working
317 if(FALSE)
318 add_test(
319         NAME export_stl_cube_all_data
320         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
321         ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend
322         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
323         --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_cube_all_data.stl'\)
324         --md5_source=${TEST_OUT_DIR}/export_stl_cube_all_data.stl
325         --md5=64cb97c0cabb015e1c3f76369835075a --md5_method=FILE
326 )
327
328 add_test(
329         NAME export_stl_suzanne_all_data
330         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
331         ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend
332         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
333         --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_suzanne_all_data.stl'\)
334         --md5_source=${TEST_OUT_DIR}/export_stl_suzanne_all_data.stl
335         --md5=e9b23c97c139ad64961c635105bb9192 --md5_method=FILE
336 )
337
338 add_test(
339         NAME export_stl_vertices # lame, add a better one
340         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
341         ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend
342         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
343         --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_vertices.stl'\)
344         --md5_source=${TEST_OUT_DIR}/export_stl_vertices.stl
345         --md5=3fd3c877e573beeebc782532cc005820 --md5_method=FILE
346 )
347 endif()
348
349
350 # X3D Import
351 # disabled until updated & working
352 if(FALSE)
353 add_test(
354         NAME import_x3d_cube
355         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
356         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
357         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/color_cube.x3d'\)
358         --md5=3fae9be004199c145941cd3f9f80ad7b --md5_method=SCENE
359         --write-blend=${TEST_OUT_DIR}/import_x3d_cube.blend
360 )
361
362 add_test(
363         NAME import_x3d_teapot
364         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
365         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
366         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/teapot.x3d'\)
367         --md5=8ee196c71947dce4199d55698501691e --md5_method=SCENE
368         --write-blend=${TEST_OUT_DIR}/import_x3d_teapot.blend
369 )
370
371 add_test(
372         NAME import_x3d_suzanne_material
373         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
374         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
375         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/suzanne_material.x3d'\)
376         --md5=3edea1353257d8b5a5f071942f417be6 --md5_method=SCENE
377         --write-blend=${TEST_OUT_DIR}/import_x3d_suzanne_material.blend
378 )
379
380 # X3D Export
381 add_test(
382         NAME export_x3d_cube
383         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
384         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
385         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
386         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_cube.x3d',use_selection=False\)
387         --md5_source=${TEST_OUT_DIR}/export_x3d_cube.x3d
388         --md5=05312d278fe41da33560fdfb9bdb268f --md5_method=FILE
389 )
390
391 add_test(
392         NAME export_x3d_nurbs
393         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
394         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
395         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
396         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_nurbs.x3d',use_selection=False\)
397         --md5_source=${TEST_OUT_DIR}/export_x3d_nurbs.x3d
398         --md5=4286d4a2aa507ef78b22ddcbdcc88481 --md5_method=FILE
399 )
400
401 add_test(
402         NAME export_x3d_all_objects
403         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
404         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
405         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
406         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_all_objects.x3d',use_selection=False\)
407         --md5_source=${TEST_OUT_DIR}/export_x3d_all_objects.x3d
408         --md5=f5f9fa4c5619a0eeab66685aafd2f7f0 --md5_method=FILE
409 )
410 endif()
411
412
413
414 # 3DS Import
415 # disabled until updated & working
416 if(FALSE)
417 add_test(
418         NAME import_3ds_cube
419         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
420         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
421         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/cube.3ds'\)
422         --md5=cb5a45c35a343c3f5beca2a918472951 --md5_method=SCENE
423         --write-blend=${TEST_OUT_DIR}/import_3ds_cube.blend
424 )
425
426 add_test(
427         NAME import_3ds_hierarchy_lara
428         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
429         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
430         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_lara.3ds'\)
431         --md5=766c873d9fdb5f190e43796cfbae63b6 --md5_method=SCENE
432         --write-blend=${TEST_OUT_DIR}/import_3ds_hierarchy_lara.blend
433 )
434
435 add_test(
436         NAME import_3ds_hierarchy_greek_trireme
437         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
438         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
439         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_greek_trireme.3ds'\)
440         --md5=b62ee30101e8999cb91ef4f8a8760056 --md5_method=SCENE
441         --write-blend=${TEST_OUT_DIR}/import_3ds_hierarchy_greek_trireme.blend
442 )
443 endif()
444
445 # 3DS Export
446 # disabled until updated & working
447 if(FALSE)
448 add_test(
449         NAME export_3ds_cube
450         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
451         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
452         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
453         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_cube.3ds',use_selection=False\)
454         --md5_source=${TEST_OUT_DIR}/export_3ds_cube.3ds
455         --md5=a31f5071b6c6dc7445b9099cdc7f63b3 --md5_method=FILE
456 )
457
458 add_test(
459         NAME export_3ds_nurbs
460         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
461         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
462         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
463         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_nurbs.3ds',use_selection=False\)
464         --md5_source=${TEST_OUT_DIR}/export_3ds_nurbs.3ds
465         --md5=5bdd21be3c80d814fbc83cb25edb08c2 --md5_method=FILE
466 )
467
468 add_test(
469         NAME export_3ds_all_objects
470         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
471         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
472         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
473         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_all_objects.3ds',use_selection=False\)
474         --md5_source=${TEST_OUT_DIR}/export_3ds_all_objects.3ds
475         --md5=68447761ab0ca38e1e22e7c177ed48a8 --md5_method=FILE
476 )
477 endif()
478
479
480
481 # FBX Export
482 # 'use_metadata=False' for reliable md5's
483 # disabled until updated & working
484 if(FALSE)
485 add_test(
486         NAME export_fbx_cube
487         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
488         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
489         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
490         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_cube.fbx',use_selection=False,use_metadata=False\)
491         --md5_source=${TEST_OUT_DIR}/export_fbx_cube.fbx
492         --md5=59a35577462f95f9a0b4e6035226ce9b --md5_method=FILE
493 )
494
495 add_test(
496         NAME export_fbx_nurbs
497         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
498         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
499         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
500         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_nurbs.fbx',use_selection=False,use_metadata=False\)
501         --md5_source=${TEST_OUT_DIR}/export_fbx_nurbs.fbx
502         --md5=d31875f18f613fa0c3b16e978f87f6f8 --md5_method=FILE
503 )
504
505 add_test(
506         NAME export_fbx_all_objects
507         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
508         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
509         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
510         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_all_objects.fbx',use_selection=False,use_metadata=False\)
511         --md5_source=${TEST_OUT_DIR}/export_fbx_all_objects.fbx
512         --md5=b35eb2a9d0e73762ecae2278c25a38ac --md5_method=FILE
513 )
514 endif()
515
516 if(WITH_CYCLES)
517         if(OPENIMAGEIO_IDIFF AND EXISTS "${TEST_SRC_DIR}/cycles/ctests/shader")
518                 macro(add_cycles_render_test subject)
519                         if(MSVC)
520                                 add_test(
521                                         NAME cycles_${subject}_test
522                                         COMMAND
523                                                 "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>"
524                                                 ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py
525                                         -blender "$<TARGET_FILE:blender>"
526                                         -testdir "${TEST_SRC_DIR}/cycles/ctests/${subject}"
527                                         -idiff "${OPENIMAGEIO_IDIFF}"
528                                         -outdir "${TEST_OUT_DIR}/cycles"
529                                 )
530                         else()
531                                 add_test(
532                                         NAME cycles_${subject}_test
533                                         COMMAND ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py
534                                         -blender "$<TARGET_FILE:blender>"
535                                         -testdir "${TEST_SRC_DIR}/cycles/ctests/${subject}"
536                                         -idiff "${OPENIMAGEIO_IDIFF}"
537                                         -outdir "${TEST_OUT_DIR}/cycles"
538                                 )
539                         endif()
540                 endmacro()
541                 if(WITH_OPENGL_TESTS)
542                         add_cycles_render_test(opengl)
543                 endif()
544                 add_cycles_render_test(bake)
545                 add_cycles_render_test(denoise)
546                 add_cycles_render_test(displacement)
547                 add_cycles_render_test(image_data_types)
548                 add_cycles_render_test(image_mapping)
549                 add_cycles_render_test(image_texture_limit)
550                 add_cycles_render_test(light)
551                 add_cycles_render_test(mblur)
552                 add_cycles_render_test(reports)
553                 add_cycles_render_test(render)
554                 add_cycles_render_test(shader)
555                 add_cycles_render_test(shader_tangent)
556                 add_cycles_render_test(shadow_catcher)
557                 add_cycles_render_test(sss)
558                 add_cycles_render_test(texture_space)
559                 add_cycles_render_test(volume)
560         else()
561                 MESSAGE(STATUS "Disabling Cycles tests because tests folder does not exist")
562         endif()
563 endif()
564
565 if(WITH_ALEMBIC)
566         find_package_wrapper(Alembic)
567         if(NOT ALEMBIC_FOUND)
568                 message(FATAL_ERROR "Alembic is enabled but cannot be found")
569         endif()
570         get_filename_component(real_include_dir ${ALEMBIC_INCLUDE_DIR} REALPATH)
571         get_filename_component(ALEMBIC_ROOT_DIR ${real_include_dir} DIRECTORY)
572
573         if(MSVC)
574                 # FIXME, de-duplicate.
575                 add_test(
576                         NAME alembic_tests
577                         COMMAND
578                                 "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>"
579                                 ${CMAKE_CURRENT_LIST_DIR}/alembic_tests.py
580                         --blender "$<TARGET_FILE:blender>"
581                         --testdir "${TEST_SRC_DIR}/alembic"
582                         --alembic-root "${ALEMBIC_ROOT_DIR}"
583                 )
584         else()
585                 add_test(
586                         NAME alembic_tests
587                         COMMAND ${CMAKE_CURRENT_LIST_DIR}/alembic_tests.py
588                         --blender "$<TARGET_FILE:blender>"
589                         --testdir "${TEST_SRC_DIR}/alembic"
590                         --alembic-root "${ALEMBIC_ROOT_DIR}"
591                 )
592         endif()
593
594         add_test(
595                 NAME script_alembic_import
596                 COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
597                 --python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
598                 --
599                 --testdir "${TEST_SRC_DIR}/alembic"
600                 --with-legacy-depsgraph=${WITH_LEGACY_DEPSGRAPH}
601         )
602 endif()