CMakeLists.txt 24 KB

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