[Bf-blender-cvs] [04ea79dc0bc] newboolean: Turn off debug file writing in boolean etc unit tests.

Howard Trickey noreply at git.blender.org
Fri Jul 24 22:21:44 CEST 2020


Commit: 04ea79dc0bc7c4301e698c2939bd0582f536a080
Author: Howard Trickey
Date:   Fri Jul 24 16:20:33 2020 -0400
Branches: newboolean
https://developer.blender.org/rB04ea79dc0bc7c4301e698c2939bd0582f536a080

Turn off debug file writing in boolean etc unit tests.

Also, for Windows, do something other than /tmp when file writing
is turned on. This file writing is only intended for debugging.

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

M	source/blender/blenlib/intern/delaunay_2d.cc
M	source/blender/blenlib/intern/mesh_intersect.cc
M	tests/gtests/blenlib/BLI_boolean_test.cc
M	tests/gtests/blenlib/BLI_delaunay_2d_test.cc
M	tests/gtests/blenlib/BLI_mesh_intersect_test.cc

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

diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc
index acc77061a3a..bc33004a8a8 100644
--- a/source/blender/blenlib/intern/delaunay_2d.cc
+++ b/source/blender/blenlib/intern/delaunay_2d.cc
@@ -383,7 +383,15 @@ template<typename T> std::ostream &operator<<(std::ostream &os, const CDT_state<
 template<typename T> void cdt_draw(const std::string &label, const CDTArrangement<T> &cdt)
 {
   static bool append = false; /* Will be set to true after first call. */
-  constexpr const char *drawfile = "/tmp/debug_draw.html";
+
+/* Would like to use BKE_tempdir_base() here, but that brings in dependence on kernel library.
+ * This is just for developer debugging anyway, and should never be called in production Blender.
+ */
+#  if WIN32
+  const char *drawfile = "./debug_draw.html";
+#  else
+  const char *drawfile = "/tmp/debug_draw.html";
+#  endif
   constexpr int max_draw_width = 1800;
   constexpr int max_draw_height = 1600;
   constexpr double margin_expand = 0.05;
diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc
index 9b4fa6e9ebc..48ccb20a2eb 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -2614,7 +2614,14 @@ static std::ostream &operator<<(std::ostream &os, const ITT_value &itt)
 /* Writing the obj_mesh has the side effect of populating verts. */
 void write_obj_mesh(Mesh &m, const std::string &objname)
 {
-  constexpr const char *objdir = "/tmp/";
+  /* Would like to use BKE_tempdir_base() here, but that brings in dependence on kernel library.
+   * This is just for developer debugging anyway, and should never be called in production Blender.
+   */
+#if WIN_32
+  const char *objdir = BLI_getenv("HOME");
+#else
+  const char *objdir = "/tmp/";
+#endif
   if (m.face_size() == 0) {
     return;
   }
diff --git a/tests/gtests/blenlib/BLI_boolean_test.cc b/tests/gtests/blenlib/BLI_boolean_test.cc
index 7985d0a2f6d..6945d34288c 100644
--- a/tests/gtests/blenlib/BLI_boolean_test.cc
+++ b/tests/gtests/blenlib/BLI_boolean_test.cc
@@ -17,7 +17,7 @@
 
 namespace blender::meshintersect {
 
-constexpr bool DO_OBJ = true;
+constexpr bool DO_OBJ = false;
 
 /* Build and hold a Mesh from a string spec. Also hold and own resources used by Mesh. */
 class MeshBuilder {
diff --git a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
index cc5f570c3eb..d1476cedd2f 100644
--- a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
+++ b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
@@ -252,7 +252,7 @@ template<typename T> std::ostream &operator<<(std::ostream &os, const CDT_result
   return os;
 }
 
-static bool draw_append = false; /* Willbe set to true after first call. */
+static bool draw_append = false; /* Will be set to true after first call. */
 
 template<typename T>
 void graph_draw(const std::string &label,
@@ -260,7 +260,14 @@ void graph_draw(const std::string &label,
                 const Array<std::pair<int, int>> &edges,
                 const Array<Vector<int>> &faces)
 {
+  /* Would like to use BKE_tempdir_base() here, but that brings in dependence on kernel library.
+   * This is just for developer debugging anyway, and should never be called in production Blender.
+   */
+#if WIN32
+  constexpr const char *drawfile = "./cdt_test_draw.html";
+#else
   constexpr const char *drawfile = "/tmp/cdt_test_draw.html";
+#endif
   constexpr int max_draw_width = 1400;
   constexpr int max_draw_height = 1000;
   constexpr int thin_line = 1;
@@ -358,7 +365,7 @@ void graph_draw(const std::string &label,
 }
 
 /* Should tests draw their output to an html file? */
-constexpr bool DO_DRAW = true;
+constexpr bool DO_DRAW = false;
 
 template<typename T> void expect_coord_near(const vec2<T> &testco, const vec2<T> &refco);
 
diff --git a/tests/gtests/blenlib/BLI_mesh_intersect_test.cc b/tests/gtests/blenlib/BLI_mesh_intersect_test.cc
index 0a0d42e174c..205b4e71708 100644
--- a/tests/gtests/blenlib/BLI_mesh_intersect_test.cc
+++ b/tests/gtests/blenlib/BLI_mesh_intersect_test.cc
@@ -19,7 +19,7 @@
 
 namespace blender::meshintersect {
 
-constexpr bool DO_OBJ = true;
+constexpr bool DO_OBJ = false;
 
 /* Build and hold a Mesh from a string spec. Also hold and own resources used by Mesh. */
 class MeshBuilder {
@@ -808,7 +808,7 @@ static void spheresphere_test(int nrings, double y_offset, bool use_self)
   std::cout << "Create time: " << time_create - time_start << "\n";
   std::cout << "Intersect time: " << time_intersect - time_create << "\n";
   std::cout << "Total time: " << time_intersect - time_start << "\n";
-  write_obj_mesh(out, "spheresphere");
+  // write_obj_mesh(out, "spheresphere");
 }
 
 TEST(mesh_intersect_perf, SphereSphere)



More information about the Bf-blender-cvs mailing list