From 2dba2b3d71d9781bce452c78a4f2c686169418b4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 6 Feb 2016 21:19:47 +0500 Subject: Fix gtests on Windows/MSVC There were some missing stubs and some tests were specifically written for Linux. Also, apparently MSVC has a limit of 64K for the insource strings.. --- tests/gtests/blenlib/BLI_ghash_performance_test.cc | 3 ++- tests/gtests/blenlib/BLI_path_util_test.cc | 11 +++++++++++ tests/gtests/blenlib/BLI_ressource_strings.h | 5 ++++- tests/gtests/blenlib/CMakeLists.txt | 6 +++++- tests/gtests/guardedalloc/CMakeLists.txt | 1 + tests/gtests/guardedalloc/guardedalloc_alignment_test.cc | 4 ++++ 6 files changed, 27 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/gtests/blenlib/BLI_ghash_performance_test.cc b/tests/gtests/blenlib/BLI_ghash_performance_test.cc index fcee72466b7..972d1f6909c 100644 --- a/tests/gtests/blenlib/BLI_ghash_performance_test.cc +++ b/tests/gtests/blenlib/BLI_ghash_performance_test.cc @@ -339,7 +339,8 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nb { printf("\n========== STARTING %s ==========\n", id); - unsigned int (*data)[4] = (unsigned int (*)[4])MEM_mallocN(sizeof(*data) * (size_t)nbr, __func__); + void *data_v = MEM_mallocN(sizeof(unsigned int (*)[4]) * (size_t)nbr, __func__); + unsigned int (*data)[4] = (unsigned int (*)[4])data_v; unsigned int (*dt)[4]; unsigned int i, j; diff --git a/tests/gtests/blenlib/BLI_path_util_test.cc b/tests/gtests/blenlib/BLI_path_util_test.cc index c4ef7c2c970..c80987c3586 100644 --- a/tests/gtests/blenlib/BLI_path_util_test.cc +++ b/tests/gtests/blenlib/BLI_path_util_test.cc @@ -6,6 +6,11 @@ extern "C" { #include "BLI_fileops.h" #include "BLI_path_util.h" #include "../../../source/blender/imbuf/IMB_imbuf.h" + +#ifdef _WIN32 +# include "../../../source/blender/blenkernel/BKE_global.h" +#endif + } /* -------------------------------------------------------------------- */ @@ -13,6 +18,10 @@ extern "C" { 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__ @@ -47,6 +56,7 @@ char *zLhm65070058860608_br_find_exe(const char *default_exe) /* tests */ /* BLI_cleanup_path */ +#ifndef _WIN32 TEST(path_util, PathUtilClean) { /* "/./" -> "/" */ @@ -101,6 +111,7 @@ TEST(path_util, PathUtilClean) EXPECT_STREQ("/a/b/", path); } } +#endif /* BLI_path_frame */ TEST(path_util, PathUtilFrame) diff --git a/tests/gtests/blenlib/BLI_ressource_strings.h b/tests/gtests/blenlib/BLI_ressource_strings.h index d7002d748c9..819cf893575 100644 --- a/tests/gtests/blenlib/BLI_ressource_strings.h +++ b/tests/gtests/blenlib/BLI_ressource_strings.h @@ -579,6 +579,7 @@ const char words10k[] = "arcu. Integer ut tellus ac sapien maximus tincidunt sed vitae risus. Nulla viverra, nibh eget eleifend aliquam, quam " "quam tempor massa, eu semper ipsum lacus in turpis. Nulla sed purus enim. Nullam sed fermentum ipsum. Sed dui nisi, " "elementum a auctor at, ultrices et nibh. Phasellus aliquam nulla ut lacinia accumsan. Phasellus sed arcu ligula. " +#ifndef _MSC_VER "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam fermentum magna vitae dui sagittis tempor. Vivamus " "eu ligula blandit, imperdiet arcu at, rutrum sem. Aliquam erat volutpat. Quisque luctus enim quis volutpat lobortis. " "Vestibulum eget sodales libero. Aenean at condimentum est. Proin eget massa vel nulla efficitur tempor eget at enim. " @@ -597,6 +598,8 @@ const char words10k[] = "sit amet porta risus hendrerit non. Aenean id sem nisi. Nullam non nisl vestibulum, pellentesque nisl et, imperdiet " "ligula. Sed laoreet fringilla felis. Proin ac dolor viverra tellus mollis aliquet eget et neque. Suspendisse mattis " "nulla vitae nulla sagittis blandit. Sed at tortor rutrum, ornare magna nec, pellentesque nisi. Etiam non aliquet " -"tellus. Aliquam at ex suscipit, posuere sem sit amet, tincidunt."; +"tellus. Aliquam at ex suscipit, posuere sem sit amet, tincidunt." +#endif +; #endif /* __BLENDER_TESTING_BLI_RESSOURCE_STRING_H__ */ diff --git a/tests/gtests/blenlib/CMakeLists.txt b/tests/gtests/blenlib/CMakeLists.txt index 8f350f0b1a5..5e6bddcdeab 100644 --- a/tests/gtests/blenlib/CMakeLists.txt +++ b/tests/gtests/blenlib/CMakeLists.txt @@ -41,7 +41,11 @@ BLENDER_TEST(BLI_math_color "bf_blenlib") BLENDER_TEST(BLI_math_geom "bf_blenlib;bf_intern_eigen") BLENDER_TEST(BLI_math_base "bf_blenlib") BLENDER_TEST(BLI_string "bf_blenlib") -BLENDER_TEST(BLI_path_util "bf_blenlib;extern_wcwidth;${ZLIB_LIBRARIES}") +if(WIN32) + BLENDER_TEST(BLI_path_util "bf_blenlib;bf_intern_utfconv;extern_wcwidth;${ZLIB_LIBRARIES}") +else() + BLENDER_TEST(BLI_path_util "bf_blenlib;extern_wcwidth;${ZLIB_LIBRARIES}") +endif() BLENDER_TEST(BLI_polyfill2d "bf_blenlib;bf_intern_eigen") BLENDER_TEST(BLI_listbase "bf_blenlib") BLENDER_TEST(BLI_hash_mm2a "bf_blenlib") diff --git a/tests/gtests/guardedalloc/CMakeLists.txt b/tests/gtests/guardedalloc/CMakeLists.txt index 394bc0b6700..f4fb4f882ec 100644 --- a/tests/gtests/guardedalloc/CMakeLists.txt +++ b/tests/gtests/guardedalloc/CMakeLists.txt @@ -25,6 +25,7 @@ set(INC . .. ../../../intern/guardedalloc + ../../../source/blender/blenlib ) include_directories(${INC}) diff --git a/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc b/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc index 489cd6178cf..345c3824b63 100644 --- a/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc +++ b/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc @@ -2,6 +2,10 @@ #include "testing/testing.h" +extern "C" { +#include "BLI_utildefines.h" +} + #include "MEM_guardedalloc.h" #define CHECK_ALIGNMENT(ptr, align) EXPECT_EQ(0, (size_t)ptr % align) -- cgit v1.2.3