Browse Source

Tests: move remaining gtests into their own module folders

And make them part of the blender_test runner. The one exception is blenlib
performance tests, which we don't want to run by default. They remain in their
own executable.

Differential Revision: https://developer.blender.org/D8498
master
Brecht Van Lommel 1 year ago
parent
commit
53d203dea8
  1. 4
      intern/CMakeLists.txt
  2. 46
      intern/ffmpeg/CMakeLists.txt
  3. 8
      intern/ffmpeg/tests/ffmpeg_codecs.cc
  4. 16
      intern/guardedalloc/CMakeLists.txt
  5. 0
      intern/guardedalloc/tests/guardedalloc_alignment_test.cc
  6. 0
      intern/guardedalloc/tests/guardedalloc_overflow_test.cc
  7. 34
      source/blender/blenlib/CMakeLists.txt
  8. 0
      source/blender/blenlib/tests/BLI_array_store_test.cc
  9. 0
      source/blender/blenlib/tests/BLI_array_utils_test.cc
  10. 8
      source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
  11. 0
      source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc
  12. 0
      source/blender/blenlib/tests/BLI_ghash_test.cc
  13. 0
      source/blender/blenlib/tests/BLI_hash_mm2a_test.cc
  14. 0
      source/blender/blenlib/tests/BLI_heap_simple_test.cc
  15. 0
      source/blender/blenlib/tests/BLI_heap_test.cc
  16. 2
      source/blender/blenlib/tests/BLI_kdopbvh_test.cc
  17. 0
      source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc
  18. 0
      source/blender/blenlib/tests/BLI_listbase_test.cc
  19. 0
      source/blender/blenlib/tests/BLI_math_base_test.cc
  20. 0
      source/blender/blenlib/tests/BLI_math_bits_test.cc
  21. 0
      source/blender/blenlib/tests/BLI_math_color_test.cc
  22. 2
      source/blender/blenlib/tests/BLI_math_geom_test.cc
  23. 0
      source/blender/blenlib/tests/BLI_math_matrix_test.cc
  24. 0
      source/blender/blenlib/tests/BLI_math_vector_test.cc
  25. 0
      source/blender/blenlib/tests/BLI_memiter_test.cc
  26. 47
      source/blender/blenlib/tests/BLI_path_util_test.cc
  27. 2
      source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
  28. 0
      source/blender/blenlib/tests/BLI_ressource_strings.h
  29. 0
      source/blender/blenlib/tests/BLI_session_uuid_test.cc
  30. 0
      source/blender/blenlib/tests/BLI_stack_test.cc
  31. 19
      source/blender/blenlib/tests/BLI_string_test.cc
  32. 19
      source/blender/blenlib/tests/BLI_string_utf8_test.cc
  33. 0
      source/blender/blenlib/tests/BLI_task_graph_test.cc
  34. 0
      source/blender/blenlib/tests/BLI_task_test.cc
  35. 54
      source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
  36. 0
      source/blender/blenlib/tests/performance/BLI_task_performance_test.cc
  37. 10
      source/blender/blenlib/tests/performance/CMakeLists.txt
  38. 14
      source/blender/blenloader/CMakeLists.txt
  39. 0
      source/blender/blenloader/tests/blendfile_load_test.cc
  40. 0
      source/blender/blenloader/tests/blendfile_loading_base_test.cc
  41. 0
      source/blender/blenloader/tests/blendfile_loading_base_test.h
  42. 13
      source/blender/bmesh/CMakeLists.txt
  43. 0
      source/blender/bmesh/tests/bmesh_core_test.cc
  44. 14
      source/blender/io/alembic/CMakeLists.txt
  45. 0
      source/blender/io/alembic/tests/abc_export_test.cc
  46. 0
      source/blender/io/alembic/tests/abc_matrix_test.cc
  47. 5
      source/blender/io/common/CMakeLists.txt
  48. 3
      source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
  49. 14
      tests/gtests/CMakeLists.txt
  50. 63
      tests/gtests/alembic/CMakeLists.txt
  51. 72
      tests/gtests/blenlib/CMakeLists.txt
  52. 27
      tests/gtests/blenlib/stubs/bf_intern_eigen_stubs.h
  53. 92
      tests/gtests/blenloader/CMakeLists.txt
  54. 49
      tests/gtests/bmesh/CMakeLists.txt

4
intern/CMakeLists.txt

@ -77,6 +77,10 @@ if(WITH_QUADRIFLOW)
add_subdirectory(quadriflow)
endif()
if(WITH_CODEC_FFMPEG)
add_subdirectory(ffmpeg)
endif()
if(UNIX AND NOT APPLE)
add_subdirectory(libc_compat)
endif()

46
tests/gtests/ffmpeg/CMakeLists.txt → intern/ffmpeg/CMakeLists.txt

@ -14,31 +14,29 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2014, Blender Foundation
# The Original Code is Copyright (C) 2020, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
..
${FFMPEG_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
set(LIB
${PNG_LIBRARIES}
${FFMPEG_LIBRARIES}
${ZLIB_LIBRARIES}
)
if(WITH_IMAGE_OPENJPEG)
set(LIB ${LIB} ${OPENJPEG_LIBRARIES})
if(WITH_GTESTS)
set(TEST_SRC
tests/ffmpeg_codecs.cc
)
set(TEST_INC
)
set(TEST_INC_SYS
${FFMPEG_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
set(TEST_LIB
${PNG_LIBRARIES}
${FFMPEG_LIBRARIES}
${ZLIB_LIBRARIES}
)
if(WITH_IMAGE_OPENJPEG)
set(TEST_LIB ${TEST_LIB} ${OPENJPEG_LIBRARIES})
endif()
include(GTestTesting)
blender_add_test_lib(bf_intern_ffmpeg_tests "${TEST_SRC}" "${TEST_INC}" "${TEST_INC_SYS}" "${TEST_LIB}")
endif()
setup_platform_linker_flags()
link_directories(${FFMPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH})
include_directories(${INC})
BLENDER_SRC_GTEST(ffmpeg "ffmpeg_codecs.cc" "${LIB}")

8
tests/gtests/ffmpeg/ffmpeg_codecs.cc → intern/ffmpeg/tests/ffmpeg_codecs.cc

@ -85,25 +85,25 @@ bool test_codec_audio_by_name(const char *codecname, AVSampleFormat fmt)
#define str(s) #s
#define FFMPEG_TEST_VCODEC_ID(codec, fmt) \
TEST(CheckCodec, codec##_##fmt) \
TEST(ffmpeg, codec##_##fmt) \
{ \
EXPECT_TRUE(test_codec_video_by_codecid(codec, fmt)); \
}
#define FFMPEG_TEST_VCODEC_NAME(codec, fmt) \
TEST(CheckCodec, codec##_##fmt) \
TEST(ffmpeg, codec##_##fmt) \
{ \
EXPECT_TRUE(test_codec_video_by_name(str(codec), fmt)); \
}
#define FFMPEG_TEST_ACODEC_ID(codec, fmt) \
TEST(CheckCodec, codec##_##fmt) \
TEST(ffmpeg, codec##_##fmt) \
{ \
EXPECT_TRUE(test_codec_audio_by_codecid(codec, fmt)); \
}
#define FFMPEG_TEST_ACODEC_NAME(codec, fmt) \
TEST(CheckCodec, codec) \
TEST(ffmpeg, codec) \
{ \
EXPECT_TRUE(test_codec_audio_by_name(str(codec), fmt)); \
}

16
intern/guardedalloc/CMakeLists.txt

@ -78,3 +78,19 @@ if(WITH_CXX_GUARDEDALLOC)
)
blender_add_lib(bf_intern_guardedalloc_cpp "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
endif()
if(WITH_GTESTS)
set(TEST_SRC
tests/guardedalloc_alignment_test.cc
tests/guardedalloc_overflow_test.cc
)
set(TEST_INC
../../source/blender/blenlib
)
set(TEST_LIB
bf_intern_guardedalloc
bf_blenlib
)
include(GTestTesting)
blender_add_test_lib(bf_intern_guardedalloc_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
endif()

0
tests/gtests/guardedalloc/guardedalloc_alignment_test.cc → intern/guardedalloc/tests/guardedalloc_alignment_test.cc

0
tests/gtests/guardedalloc/guardedalloc_overflow_test.cc → intern/guardedalloc/tests/guardedalloc_overflow_test.cc

34
source/blender/blenlib/CMakeLists.txt

@ -347,26 +347,58 @@ blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_GTESTS)
set(TEST_SRC
tests/BLI_array_store_test.cc
tests/BLI_array_test.cc
tests/BLI_array_utils_test.cc
tests/BLI_delaunay_2d_test.cc
tests/BLI_disjoint_set_test.cc
tests/BLI_edgehash_test.cc
tests/BLI_expr_pylike_eval_test.cc
tests/BLI_ghash_test.cc
tests/BLI_hash_mm2a_test.cc
tests/BLI_heap_simple_test.cc
tests/BLI_heap_test.cc
tests/BLI_index_mask_test.cc
tests/BLI_index_range_test.cc
tests/BLI_kdopbvh_test.cc
tests/BLI_linear_allocator_test.cc
tests/BLI_linklist_lockfree_test.cc
tests/BLI_listbase_test.cc
tests/BLI_map_test.cc
tests/BLI_math_base_safe_test.cc
tests/BLI_math_base_test.cc
tests/BLI_math_bits_test.cc
tests/BLI_math_color_test.cc
tests/BLI_math_geom_test.cc
tests/BLI_math_matrix_test.cc
tests/BLI_math_vector_test.cc
tests/BLI_memiter_test.cc
tests/BLI_memory_utils_test.cc
tests/BLI_multi_value_map_test.cc
tests/BLI_path_util_test.cc
tests/BLI_polyfill_2d_test.cc
tests/BLI_ressource_strings.h
tests/BLI_session_uuid_test.cc
tests/BLI_set_test.cc
tests/BLI_span_test.cc
tests/BLI_stack_cxx_test.cc
tests/BLI_stack_test.cc
tests/BLI_string_ref_test.cc
tests/BLI_string_test.cc
tests/BLI_string_utf8_test.cc
tests/BLI_task_graph_test.cc
tests/BLI_task_test.cc
tests/BLI_vector_set_test.cc
tests/BLI_vector_test.cc
)
set(TEST_INC
../imbuf
)
set(TEST_LIB
bf_blenlib
)
include(GTestTesting)
blender_add_test_lib(bf_bli_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
blender_add_test_lib(bf_blenlib_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
add_subdirectory(tests/performance)
endif()

0
tests/gtests/blenlib/BLI_array_store_test.cc → source/blender/blenlib/tests/BLI_array_store_test.cc

0
tests/gtests/blenlib/BLI_array_utils_test.cc → source/blender/blenlib/tests/BLI_array_utils_test.cc

8
tests/gtests/blenlib/BLI_delaunay_2d_test.cc → source/blender/blenlib/tests/BLI_delaunay_2d_test.cc

@ -126,6 +126,7 @@ static void fill_input_from_string(CDT_input *r_input, const char *spec)
}
}
#if DO_FILE_TESTS
static void fill_input_from_file(CDT_input *in, const char *filename)
{
std::FILE *fp = std::fopen(filename, "rb");
@ -142,6 +143,7 @@ static void fill_input_from_file(CDT_input *in, const char *filename)
printf("couldn't open file %s\n", filename);
}
}
#endif
static void free_spec_arrays(CDT_input *in)
{
@ -251,6 +253,7 @@ static bool out_face_has_input_id(const CDT_result *r, int out_face_index, int i
return false;
}
#if DO_FILE_TESTS
/* for debugging */
static void dump_result(CDT_result *r)
{
@ -301,6 +304,7 @@ static void dump_result(CDT_result *r)
}
}
}
#endif
#if DO_REGULAR_TESTS
TEST(delaunay, Empty)
@ -1708,8 +1712,8 @@ TEST(delaunay, random_tris_circle_b)
#endif
#if DO_FILE_TESTS
/* For timing large examples of points only.
* See fill_input_from_file for file format.
/* For manually testing performance by timing a large number of points from a
* file. See fill_input_from_file for file format.
*/
static void points_from_file_test(const char *filename)
{

0
tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc → source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc

0
tests/gtests/blenlib/BLI_ghash_test.cc → source/blender/blenlib/tests/BLI_ghash_test.cc

0
tests/gtests/blenlib/BLI_hash_mm2a_test.cc → source/blender/blenlib/tests/BLI_hash_mm2a_test.cc

0
tests/gtests/blenlib/BLI_heap_simple_test.cc → source/blender/blenlib/tests/BLI_heap_simple_test.cc

0
tests/gtests/blenlib/BLI_heap_test.cc → source/blender/blenlib/tests/BLI_heap_test.cc

2
tests/gtests/blenlib/BLI_kdopbvh_test.cc → source/blender/blenlib/tests/BLI_kdopbvh_test.cc

@ -11,8 +11,6 @@
#include "BLI_math_vector.h"
#include "BLI_rand.h"
#include "stubs/bf_intern_eigen_stubs.h"
/* -------------------------------------------------------------------- */
/* Helper Functions */

0
tests/gtests/blenlib/BLI_linklist_lockfree_test.cc → source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc

0
tests/gtests/blenlib/BLI_listbase_test.cc → source/blender/blenlib/tests/BLI_listbase_test.cc

0
tests/gtests/blenlib/BLI_math_base_test.cc → source/blender/blenlib/tests/BLI_math_base_test.cc

0
tests/gtests/blenlib/BLI_math_bits_test.cc → source/blender/blenlib/tests/BLI_math_bits_test.cc

0
tests/gtests/blenlib/BLI_math_color_test.cc → source/blender/blenlib/tests/BLI_math_color_test.cc

2
tests/gtests/blenlib/BLI_math_geom_test.cc → source/blender/blenlib/tests/BLI_math_geom_test.cc

@ -4,8 +4,6 @@
#include "BLI_math.h"
#include "stubs/bf_intern_eigen_stubs.h"
TEST(math_geom, DistToLine2DSimple)
{
float p[2] = {5.0f, 1.0f}, a[2] = {0.0f, 0.0f}, b[2] = {2.0f, 0.0f};

0
tests/gtests/blenlib/BLI_math_matrix_test.cc → source/blender/blenlib/tests/BLI_math_matrix_test.cc

0
tests/gtests/blenlib/BLI_math_vector_test.cc → source/blender/blenlib/tests/BLI_math_vector_test.cc

0
tests/gtests/blenlib/BLI_memiter_test.cc → source/blender/blenlib/tests/BLI_memiter_test.cc

47
tests/gtests/blenlib/BLI_path_util_test.cc → source/blender/blenlib/tests/BLI_path_util_test.cc

@ -2,56 +2,15 @@
#include "testing/testing.h"
#include "../../../source/blender/imbuf/IMB_imbuf.h"
#include "IMB_imbuf.h"
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#ifdef _WIN32
# include "../../../source/blender/blenkernel/BKE_global.h"
#endif
/* -------------------------------------------------------------------- */
/* stubs */
extern "C" {
#if _WIN32
Global G = {0};
#endif
const char *GHOST_getUserDir(int version, const char *versionstr);
const char *GHOST_getSystemDir(int version, const char *versionstr);
#ifdef __linux__
char *zLhm65070058860608_br_find_exe(const char *default_exe);
#endif
const char *GHOST_getUserDir(int version, const char *versionstr)
{
return "/home/user";
}
const char *GHOST_getSystemDir(int version, const char *versionstr)
{
return "/system/path";
}
struct ImBuf;
void IMB_freeImBuf(struct ImBuf *ibuf)
{
}
struct ImBuf *IMB_dupImBuf(const ImBuf *ibuf)
{
return NULL;
}
#ifdef __linux__
char *zLhm65070058860608_br_find_exe(const char *default_exe)
{
return NULL;
}
# include "BKE_global.h"
#endif
}
/* -------------------------------------------------------------------- */
/* tests */

2
tests/gtests/blenlib/BLI_polyfill_2d_test.cc → source/blender/blenlib/tests/BLI_polyfill_2d_test.cc

@ -27,8 +27,6 @@
# include "BLI_polyfill_2d_beautify.h"
#endif
#include "stubs/bf_intern_eigen_stubs.h"
static void polyfill_to_obj(const char *id,
const float poly[][2],
const unsigned int poly_tot,

0
tests/gtests/blenlib/BLI_ressource_strings.h → source/blender/blenlib/tests/BLI_ressource_strings.h

0
tests/gtests/blenlib/BLI_session_uuid_test.cc → source/blender/blenlib/tests/BLI_session_uuid_test.cc

0
tests/gtests/blenlib/BLI_stack_test.cc → source/blender/blenlib/tests/BLI_stack_test.cc

19
tests/gtests/blenlib/BLI_string_test.cc → source/blender/blenlib/tests/BLI_string_test.cc

@ -19,25 +19,6 @@ using std::pair;
using std::string;
using std::vector;
/* -------------------------------------------------------------------- */
/* stubs */
extern "C" {
int mk_wcwidth(wchar_t ucs);
int mk_wcswidth(const wchar_t *pwcs, size_t n);
int mk_wcwidth(wchar_t ucs)
{
return 0;
}
int mk_wcswidth(const wchar_t *pwcs, size_t n)
{
return 0;
}
}
/* -------------------------------------------------------------------- */
/* tests */

19
tests/gtests/blenlib/BLI_string_utf8_test.cc → source/blender/blenlib/tests/BLI_string_utf8_test.cc

@ -10,25 +10,6 @@
* BLI_string_test.cc However, tests below are specific utf-8 conformance ones, and since they eat
* quite their share of lines, they deserved their own file. */
/* -------------------------------------------------------------------- */
/* stubs */
extern "C" {
int mk_wcwidth(wchar_t ucs);
int mk_wcswidth(const wchar_t *pwcs, size_t n);
int mk_wcwidth(wchar_t ucs)
{
return 0;
}
int mk_wcswidth(const wchar_t *pwcs, size_t n)
{
return 0;
}
}
/* -------------------------------------------------------------------- */
/* tests */

0
tests/gtests/blenlib/BLI_task_graph_test.cc → source/blender/blenlib/tests/BLI_task_graph_test.cc

0
tests/gtests/blenlib/BLI_task_test.cc → source/blender/blenlib/tests/BLI_task_test.cc

54
tests/gtests/blenlib/BLI_ghash_performance_test.cc → source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc

@ -479,60 +479,6 @@ TEST(ghash, Int2NoHash50000000)
}
#endif
/* Int_v2: 20M of randomly-generated integer vectors. */
static void int2_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr)
{
printf("\n========== STARTING %s ==========\n", id);
void *data_v = MEM_mallocN(sizeof(unsigned int[2]) * (size_t)nbr, __func__);
unsigned int(*data)[2] = (unsigned int(*)[2])data_v;
unsigned int(*dt)[2];
unsigned int i, j;
{
RNG *rng = BLI_rng_new(1);
for (i = nbr, dt = data; i--; dt++) {
for (j = 2; j--;) {
(*dt)[j] = BLI_rng_get_uint(rng);
}
}
BLI_rng_free(rng);
}
{
TIMEIT_START(int_v2_insert);
#ifdef GHASH_RESERVE
BLI_ghash_reserve(ghash, nbr);
#endif
for (i = nbr, dt = data; i--; dt++) {
BLI_ghash_insert(ghash, *dt, POINTER_FROM_UINT(i));
}
TIMEIT_END(int_v2_insert);
}
PRINTF_GHASH_STATS(ghash);
{
TIMEIT_START(int_v2_lookup);
for (i = nbr, dt = data; i--; dt++) {
void *v = BLI_ghash_lookup(ghash, (void *)(*dt));
EXPECT_EQ(POINTER_AS_UINT(v), i);
}
TIMEIT_END(int_v2_lookup);
}
BLI_ghash_free(ghash, NULL, NULL);
MEM_freeN(data);
printf("========== ENDED %s ==========\n\n", id);
}
/* MultiSmall: create and manipulate a lot of very small ghashes
* (90% < 10 items, 9% < 100 items, 1% < 1000 items). */

0
tests/gtests/blenlib/BLI_task_performance_test.cc → source/blender/blenlib/tests/performance/BLI_task_performance_test.cc

10
tests/gtests/guardedalloc/CMakeLists.txt → source/blender/blenlib/tests/performance/CMakeLists.txt

@ -21,15 +21,17 @@
set(INC
.
..
../../../intern/guardedalloc
../../../source/blender/blenlib
../../../source/blender/makesdna
../../../intern/guardedalloc
../../../intern/atomic
)
setup_libdirs()
include_directories(${INC})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
BLENDER_TEST(guardedalloc_alignment "")
BLENDER_TEST(guardedalloc_overflow "")
BLENDER_TEST_PERFORMANCE(BLI_ghash_performance "bf_blenlib")
BLENDER_TEST_PERFORMANCE(BLI_task_performance "bf_blenlib")

14
source/blender/blenloader/CMakeLists.txt

@ -98,3 +98,17 @@ blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# needed so writefile.c can use dna_type_offsets.h
add_dependencies(bf_blenloader bf_dna)
if(WITH_GTESTS)
set(TEST_SRC
tests/blendfile_loading_base_test.cc
tests/blendfile_load_test.cc
)
set(TEST_INC
)
set(TEST_LIB
bf_blenloader
)
include(GTestTesting)
blender_add_test_lib(bf_blenloader_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
endif()

0
tests/gtests/blenloader/blendfile_load_test.cc → source/blender/blenloader/tests/blendfile_load_test.cc

0
tests/gtests/blenloader/blendfile_loading_base_test.cc → source/blender/blenloader/tests/blendfile_loading_base_test.cc

0
tests/gtests/blenloader/blendfile_loading_base_test.h → source/blender/blenloader/tests/blendfile_loading_base_test.h

13
source/blender/bmesh/CMakeLists.txt

@ -204,3 +204,16 @@ if(WITH_FREESTYLE)
endif()
blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_GTESTS)
set(TEST_SRC
tests/bmesh_core_test.cc
)
set(TEST_INC
)
set(TEST_LIB
bf_bmesh
)
include(GTestTesting)
blender_add_test_lib(bf_bmesh_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
endif()

0
tests/gtests/bmesh/bmesh_core_test.cc → source/blender/bmesh/tests/bmesh_core_test.cc

14
source/blender/io/alembic/CMakeLists.txt

@ -110,3 +110,17 @@ list(APPEND LIB
)
blender_add_lib(bf_alembic "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_GTESTS)
set(TEST_SRC
tests/abc_export_test.cc
tests/abc_matrix_test.cc
)
set(TEST_INC
)
set(TEST_LIB
bf_alembic
)
include(GTestTesting)
blender_add_test_lib(bf_io_alembic_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
endif()

0
tests/gtests/alembic/abc_export_test.cc → source/blender/io/alembic/tests/abc_export_test.cc

0
tests/gtests/alembic/abc_matrix_test.cc → source/blender/io/alembic/tests/abc_matrix_test.cc

5
source/blender/io/common/CMakeLists.txt

@ -55,8 +55,11 @@ if(WITH_GTESTS)
intern/hierarchy_context_order_test.cc
intern/object_identifier_test.cc
)
set(TEST_INC
../../blenloader
)
set(TEST_LIB
bf_blenloader_test
bf_blenloader_tests
bf_io_common
)
include(GTestTesting)

3
source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc

@ -17,7 +17,8 @@
* All rights reserved.
*/
#include "IO_abstract_hierarchy_iterator.h"
#include "blenloader/blendfile_loading_base_test.h"
#include "tests/blendfile_loading_base_test.h"
#include "BLI_math.h"
#include "DEG_depsgraph.h"

14
tests/gtests/CMakeLists.txt

@ -3,19 +3,9 @@ if(WITH_GTESTS)
# Otherwise we get warnings here that we cant fix in external projects
remove_strict_flags()
# Build common test runner
# Build common test executable used by most tests
add_subdirectory(runner)
# Build tests not yet ported to the common runner
# Build utility library used by test executables
add_subdirectory(testing)
add_subdirectory(blenlib)
add_subdirectory(blenloader)
add_subdirectory(guardedalloc)
add_subdirectory(bmesh)
if(WITH_CODEC_FFMPEG)
add_subdirectory(ffmpeg)
endif()
if(WITH_ALEMBIC)
add_subdirectory(alembic)
endif()
endif()

63
tests/gtests/alembic/CMakeLists.txt

@ -1,63 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2014, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
..
../../../source/blender/blenlib
../../../source/blender/blenkernel
../../../source/blender/io/alembic
../../../source/blender/io/common
../../../source/blender/io/usd/intern
../../../source/blender/makesdna
../../../source/blender/depsgraph
${ALEMBIC_INCLUDE_DIRS}
${BOOST_INCLUDE_DIR}
${HDF5_INCLUDE_DIRS}
${OPENEXR_INCLUDE_DIRS}
)
set(LIB
bf_blenloader # Should not be needed but gives linking error without it.
bf_intern_opencolorio # Should not be needed but gives windows linker errors if the ocio libs are linked before this
bf_gpu # Should not be needed but gives windows linker errors if the ocio libs are linked before this
bf_alembic
${OPENEXR_LIBRARIES}
${BOOST_LIBRARIES}
)
include_directories(${INC})
setup_libdirs()
get_property(BLENDER_SORTED_LIBS GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP)
if(WITH_BUILDINFO)
set(_buildinfo_src "$<TARGET_OBJECTS:buildinfoobj>")
else()
set(_buildinfo_src "")
endif()
# For motivation on doubling BLENDER_SORTED_LIBS, see ../bmesh/CMakeLists.txt
BLENDER_SRC_GTEST(alembic "abc_matrix_test.cc;abc_export_test.cc;${_buildinfo_src}" "${LIB}")
unset(_buildinfo_src)
setup_liblinks(alembic_test)

72
tests/gtests/blenlib/CMakeLists.txt

@ -1,72 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2014, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
..
../../../source/blender/blenlib
../../../source/blender/makesdna
../../../intern/guardedalloc
../../../intern/atomic
)
setup_libdirs()
include_directories(${INC})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
if(WIN32)
set(BLI_path_util_extra_libs "bf_blenlib;bf_intern_utfconv;extern_wcwidth;${ZLIB_LIBRARIES}")
else()
set(BLI_path_util_extra_libs "bf_blenlib;extern_wcwidth;${ZLIB_LIBRARIES}")
endif()
BLENDER_TEST(BLI_array_store "bf_blenlib")
BLENDER_TEST(BLI_array_utils "bf_blenlib")
BLENDER_TEST(BLI_delaunay_2d "bf_blenlib")
BLENDER_TEST(BLI_expr_pylike_eval "bf_blenlib")
BLENDER_TEST(BLI_ghash "bf_blenlib")
BLENDER_TEST(BLI_hash_mm2a "bf_blenlib")
BLENDER_TEST(BLI_heap "bf_blenlib")
BLENDER_TEST(BLI_heap_simple "bf_blenlib")
BLENDER_TEST(BLI_kdopbvh "bf_blenlib;bf_intern_numaapi")
BLENDER_TEST(BLI_linklist_lockfree "bf_blenlib;bf_intern_numaapi")
BLENDER_TEST(BLI_listbase "bf_blenlib")
BLENDER_TEST(BLI_math_base "bf_blenlib")
BLENDER_TEST(BLI_math_bits "bf_blenlib")
BLENDER_TEST(BLI_math_color "bf_blenlib")
BLENDER_TEST(BLI_math_geom "bf_blenlib")
BLENDER_TEST(BLI_math_matrix "bf_blenlib")
BLENDER_TEST(BLI_math_vector "bf_blenlib")
BLENDER_TEST(BLI_memiter "bf_blenlib")
BLENDER_TEST(BLI_path_util "${BLI_path_util_extra_libs}")
BLENDER_TEST(BLI_polyfill_2d "bf_blenlib")
BLENDER_TEST(BLI_session_uuid "bf_blenlib")
BLENDER_TEST(BLI_stack "bf_blenlib")
BLENDER_TEST(BLI_string "bf_blenlib")
BLENDER_TEST(BLI_string_utf8 "bf_blenlib")
BLENDER_TEST(BLI_task "bf_blenlib;bf_intern_numaapi")
BLENDER_TEST(BLI_task_graph "bf_blenlib;bf_intern_numaapi")
BLENDER_TEST_PERFORMANCE(BLI_ghash_performance "bf_blenlib")
BLENDER_TEST_PERFORMANCE(BLI_task_performance "bf_blenlib")
unset(BLI_path_util_extra_libs)

27
tests/gtests/blenlib/stubs/bf_intern_eigen_stubs.h

@ -1,27 +0,0 @@
/* Apache License, Version 2.0 */
extern "C" {
void EIG_svd_square_matrix(
const int size, const float *matrix, float *r_U, float *r_S, float *r_V);
bool EIG_self_adjoint_eigen_solve(const int size,
const float *matrix,
float *r_eigen_values,
float *r_eigen_vectors);
bool EIG_self_adjoint_eigen_solve(const int size,
const float *matrix,
float *r_eigen_values,
float *r_eigen_vectors)
{
BLI_assert(0);
UNUSED_VARS(size, matrix, r_eigen_values, r_eigen_vectors);
return false;
}
void EIG_svd_square_matrix(const int size, const float *matrix, float *r_U, float *r_S, float *r_V)
{
BLI_assert(0);
UNUSED_VARS(size, matrix, r_U, r_S, r_V);
}
}

92
tests/gtests/blenloader/CMakeLists.txt

@ -1,92 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2019 by Blender Foundation.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
..
../../../source/blender/blenkernel
../../../source/blender/blenlib
../../../source/blender/blenloader
../../../source/blender/depsgraph
../../../source/blender/imbuf
../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/blender/windowmanager
../../../intern/guardedalloc
${GLOG_INCLUDE_DIRS}
${GFLAGS_INCLUDE_DIRS}
../../../extern/gtest/include
)
set(SRC
blendfile_loading_base_test.cc
blendfile_loading_base_test.h
)
set(LIB
)
blender_add_lib(bf_blenloader_test "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
set(INC
.
..
../../../source/blender/blenlib
../../../source/blender/blenloader
../../../source/blender/blenkernel
../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/blender/depsgraph
../../../intern/guardedalloc
)
set(LIB
bf_blenloader_test
bf_blenloader
# Should not be needed but gives windows linker errors if the ocio libs are linked before this:
bf_intern_opencolorio
bf_gpu
)
include_directories(${INC})
setup_libdirs()
get_property(BLENDER_SORTED_LIBS GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP)
set(SRC
blendfile_load_test.cc
)
if(WITH_BUILDINFO)
list(APPEND SRC
"$<TARGET_OBJECTS:buildinfoobj>"
)
endif()
BLENDER_SRC_GTEST_EX(
NAME blenloader
SRC "${SRC}"
EXTRA_LIBS "${LIB}"
COMMAND_ARGS --test-assets-dir "${CMAKE_SOURCE_DIR}/../lib/tests")
unset(_buildinfo_src)
setup_liblinks(blenloader_test)

49
tests/gtests/bmesh/CMakeLists.txt

@ -1,49 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2014, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
..
../../../source/blender/blenlib
../../../source/blender/makesdna
../../../source/blender/bmesh
../../../intern/guardedalloc
)
set(LIB
bf_blenloader # Should not be needed but gives linking error without it.
bf_intern_opencolorio # Should not be needed but gives windows linker errors if the ocio libs are linked before this
bf_gpu # Should not be needed but gives windows linker errors if the ocio libs are linked before this
bf_bmesh
)
include_directories(${INC})
setup_libdirs()
if(WITH_BUILDINFO)
set(_buildinfo_src "$<TARGET_OBJECTS:buildinfoobj>")
else()
set(_buildinfo_src "")
endif()
BLENDER_SRC_GTEST(bmesh_core "bmesh_core_test.cc;${_buildinfo_src}" "${LIB}")
unset(_buildinfo_src)
setup_liblinks(bmesh_core_test)
Loading…
Cancel
Save