[Bf-blender-cvs] [53d203dea82] master: Tests: move remaining gtests into their own module folders

Brecht Van Lommel noreply at git.blender.org
Mon Aug 10 18:14:35 CEST 2020


Commit: 53d203dea8230da4e80f3cc61468a4e24ff6759c
Author: Brecht Van Lommel
Date:   Fri Aug 7 16:43:42 2020 +0200
Branches: master
https://developer.blender.org/rB53d203dea8230da4e80f3cc61468a4e24ff6759c

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

===================================================================

M	intern/CMakeLists.txt
R059	tests/gtests/ffmpeg/CMakeLists.txt	intern/ffmpeg/CMakeLists.txt
R096	tests/gtests/ffmpeg/ffmpeg_codecs.cc	intern/ffmpeg/tests/ffmpeg_codecs.cc
M	intern/guardedalloc/CMakeLists.txt
R100	tests/gtests/guardedalloc/guardedalloc_alignment_test.cc	intern/guardedalloc/tests/guardedalloc_alignment_test.cc
R100	tests/gtests/guardedalloc/guardedalloc_overflow_test.cc	intern/guardedalloc/tests/guardedalloc_overflow_test.cc
M	source/blender/blenlib/CMakeLists.txt
R100	tests/gtests/blenlib/BLI_array_store_test.cc	source/blender/blenlib/tests/BLI_array_store_test.cc
R100	tests/gtests/blenlib/BLI_array_utils_test.cc	source/blender/blenlib/tests/BLI_array_utils_test.cc
R099	tests/gtests/blenlib/BLI_delaunay_2d_test.cc	source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
R100	tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc	source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc
R100	tests/gtests/blenlib/BLI_ghash_test.cc	source/blender/blenlib/tests/BLI_ghash_test.cc
R100	tests/gtests/blenlib/BLI_hash_mm2a_test.cc	source/blender/blenlib/tests/BLI_hash_mm2a_test.cc
R100	tests/gtests/blenlib/BLI_heap_simple_test.cc	source/blender/blenlib/tests/BLI_heap_simple_test.cc
R100	tests/gtests/blenlib/BLI_heap_test.cc	source/blender/blenlib/tests/BLI_heap_test.cc
R098	tests/gtests/blenlib/BLI_kdopbvh_test.cc	source/blender/blenlib/tests/BLI_kdopbvh_test.cc
R100	tests/gtests/blenlib/BLI_linklist_lockfree_test.cc	source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc
R100	tests/gtests/blenlib/BLI_listbase_test.cc	source/blender/blenlib/tests/BLI_listbase_test.cc
R100	tests/gtests/blenlib/BLI_math_base_test.cc	source/blender/blenlib/tests/BLI_math_base_test.cc
R100	tests/gtests/blenlib/BLI_math_bits_test.cc	source/blender/blenlib/tests/BLI_math_bits_test.cc
R100	tests/gtests/blenlib/BLI_math_color_test.cc	source/blender/blenlib/tests/BLI_math_color_test.cc
R092	tests/gtests/blenlib/BLI_math_geom_test.cc	source/blender/blenlib/tests/BLI_math_geom_test.cc
R100	tests/gtests/blenlib/BLI_math_matrix_test.cc	source/blender/blenlib/tests/BLI_math_matrix_test.cc
R100	tests/gtests/blenlib/BLI_math_vector_test.cc	source/blender/blenlib/tests/BLI_math_vector_test.cc
R100	tests/gtests/blenlib/BLI_memiter_test.cc	source/blender/blenlib/tests/BLI_memiter_test.cc
R094	tests/gtests/blenlib/BLI_path_util_test.cc	source/blender/blenlib/tests/BLI_path_util_test.cc
R099	tests/gtests/blenlib/BLI_polyfill_2d_test.cc	source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
R100	tests/gtests/blenlib/BLI_ressource_strings.h	source/blender/blenlib/tests/BLI_ressource_strings.h
R100	tests/gtests/blenlib/BLI_session_uuid_test.cc	source/blender/blenlib/tests/BLI_session_uuid_test.cc
R100	tests/gtests/blenlib/BLI_stack_test.cc	source/blender/blenlib/tests/BLI_stack_test.cc
R098	tests/gtests/blenlib/BLI_string_test.cc	source/blender/blenlib/tests/BLI_string_test.cc
R098	tests/gtests/blenlib/BLI_string_utf8_test.cc	source/blender/blenlib/tests/BLI_string_utf8_test.cc
R100	tests/gtests/blenlib/BLI_task_graph_test.cc	source/blender/blenlib/tests/BLI_task_graph_test.cc
R100	tests/gtests/blenlib/BLI_task_test.cc	source/blender/blenlib/tests/BLI_task_test.cc
R092	tests/gtests/blenlib/BLI_ghash_performance_test.cc	source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
R100	tests/gtests/blenlib/BLI_task_performance_test.cc	source/blender/blenlib/tests/performance/BLI_task_performance_test.cc
R085	tests/gtests/guardedalloc/CMakeLists.txt	source/blender/blenlib/tests/performance/CMakeLists.txt
M	source/blender/blenloader/CMakeLists.txt
R100	tests/gtests/blenloader/blendfile_load_test.cc	source/blender/blenloader/tests/blendfile_load_test.cc
R100	tests/gtests/blenloader/blendfile_loading_base_test.cc	source/blender/blenloader/tests/blendfile_loading_base_test.cc
R100	tests/gtests/blenloader/blendfile_loading_base_test.h	source/blender/blenloader/tests/blendfile_loading_base_test.h
M	source/blender/bmesh/CMakeLists.txt
R100	tests/gtests/bmesh/bmesh_core_test.cc	source/blender/bmesh/tests/bmesh_core_test.cc
M	source/blender/io/alembic/CMakeLists.txt
R100	tests/gtests/alembic/abc_export_test.cc	source/blender/io/alembic/tests/abc_export_test.cc
R100	tests/gtests/alembic/abc_matrix_test.cc	source/blender/io/alembic/tests/abc_matrix_test.cc
M	source/blender/io/common/CMakeLists.txt
M	source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
M	tests/gtests/CMakeLists.txt
D	tests/gtests/alembic/CMakeLists.txt
D	tests/gtests/blenlib/CMakeLists.txt
D	tests/gtests/blenlib/stubs/bf_intern_eigen_stubs.h
D	tests/gtests/blenloader/CMakeLists.txt
D	tests/gtests/bmesh/CMakeLists.txt

===================================================================

diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 0758567bb78..c1792a312b2 100644
--- a/intern/CMakeLists.txt
+++ b/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()
diff --git a/tests/gtests/ffmpeg/CMakeLists.txt b/intern/ffmpeg/CMakeLists.txt
similarity index 59%
rename from tests/gtests/ffmpeg/CMakeLists.txt
rename to intern/ffmpeg/CMakeLists.txt
index dbd4f9f1fed..e141da9cbca 100644
--- a/tests/gtests/ffmpeg/CMakeLists.txt
+++ b/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}")
diff --git a/tests/gtests/ffmpeg/ffmpeg_codecs.cc b/intern/ffmpeg/tests/ffmpeg_codecs.cc
similarity index 96%
rename from tests/gtests/ffmpeg/ffmpeg_codecs.cc
rename to intern/ffmpeg/tests/ffmpeg_codecs.cc
index bbf2b3a4111..d3cba6d228a 100644
--- a/tests/gtests/ffmpeg/ffmpeg_codecs.cc
+++ b/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)); \
   }
diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt
index 1ab365a376a..ccc1500c014 100644
--- a/intern/guardedalloc/CMakeLists.txt
+++ b/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()
diff --git a/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc b/intern/guardedalloc/tests/guardedalloc_alignment_test.cc
similarity index 100%
rename from tests/gtests/guardedalloc/guardedalloc_alignment_test.cc
rename to intern/guardedalloc/tests/guardedalloc_alignment_test.cc
diff --git a/tests/gtests/guardedalloc/guardedalloc_overflow_test.cc b/intern/guardedalloc/tests/guardedalloc_overflow_test.cc
similarity index 100%
rename from tests/gtests/guardedalloc/guardedalloc_overflow_test.cc
rename to intern/guardedalloc/tests/guardedalloc_overflow_test.cc
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index a5af517ecca..819c74b6946 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/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()
diff --git a/tests/gtests/blenlib/BLI_array_store_test.cc b/source/blender/blenlib/tests/BLI_array_store_test.cc
similarity index 100%
rename from tests/gtests/blenlib/BLI_array_store_test.cc
rename to source/blender/blenlib/tests/BLI_array_store_test.cc
diff --git a/tests/gtests/blenlib/BLI_array_utils_test.cc b/source/blender/blenlib/tests/BLI_array_utils_test.cc
similarity index 100%
rename from tests/gtests/blenlib/BLI_array_utils_test.cc
rename to source/blender/blenlib/tests/BLI_array_utils_test.cc
diff --git a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
similarity index 99%
rename from tests/gtests/blenlib/BLI_delaunay_2d_test.cc
rename to source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
index 8d62b111e12..fd2de9864af 100644
--- a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
+++ b/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)
 {
diff --git a/tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc b/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc
similarity index 100%
rename from tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc
rename to source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc
diff --git a/tests/gtests/blenlib/BLI_ghash_test.cc b/source/blender/blenlib/tests/BLI_ghash_test.cc
similarity index 100%
rename from tests/gtests/blenlib/BLI_ghash_test.cc
rename to source/blender/blenlib/tests/BLI_ghash_test.cc
diff --git a/tests/gtests/blenlib/BLI_hash_mm2a_test.cc b/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc
similarity index 100%
rename from tests/gtests/blenlib/BLI_hash_mm2a_test.cc
rename to source/blender/blenlib/tests/BLI_hash_mm2a_test.cc
diff --git a/tests/gtests/blenlib/BLI_heap_simple_test.cc b/source/blender/blenlib/tests/BLI_heap_simple_test.cc
similarity index 100%
rename from tests/gtests/blenlib/BLI_heap_simple_test.cc
rename to source/blender/blenlib/tests/BLI_heap_simple_test.cc
diff --git a/tests/gtests/blenlib/BLI_heap_test.cc b/source/blender/blenlib/tests/BLI_heap_test.cc
similarity index 100%
rename from tests/gtests/blenlib/BLI_heap_test.cc
rename to source/blender/blenlib/tests/BLI_heap_test.cc
diff --git a/tests/gtests/blenlib/BLI_kdopbvh_test.cc b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc
similarity index 98%
rename from tests/gtests/blenlib/BLI_kdopbvh_test.cc
rename to source/blender/blenlib/tests/BLI_kdopbvh_test.cc
index f8a4fc1290a..2e8032400e3 100644
--- a/tests/gtests/blenlib/BL

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list