[cgma-dev] r1830 - cgm/trunk/test

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Tue May 20 10:23:47 CDT 2008


Author: kraftche
Date: 2008-05-20 10:23:47 -0500 (Tue, 20 May 2008)
New Revision: 1830

Modified:
   cgm/trunk/test/makept.cpp
   cgm/trunk/test/modify.cpp
Log:
Fix bugs in previous commit:

o Wrong arg type passed to printf-like function on error causes memory
  corruption.

o Reading all input files from the $srcdir causes one test in 'modify'
  to fail because it is trying to read back in a file that it wrote.



Modified: cgm/trunk/test/makept.cpp
===================================================================
--- cgm/trunk/test/makept.cpp	2008-05-20 15:21:11 UTC (rev 1829)
+++ cgm/trunk/test/makept.cpp	2008-05-20 15:23:47 UTC (rev 1830)
@@ -98,7 +98,7 @@
     filename += argv[i];
     status = gti->import_solid_model(filename.c_str(), "OCC");
     if (status != CUBIT_SUCCESS) {
-      PRINT_ERROR("Problems reading geometry file %s.\n", filename);
+      PRINT_ERROR("Problems reading geometry file %s.\n", filename.c_str());
     }
   }
   PRINT_SEPARATOR;

Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp	2008-05-20 15:21:11 UTC (rev 1829)
+++ cgm/trunk/test/modify.cpp	2008-05-20 15:23:47 UTC (rev 1830)
@@ -46,7 +46,7 @@
 #define SRCPATH STRINGIFY(SRCDIR) "/"
 
 // forward declare some functions used and defined later
-CubitStatus read_geometry(int, char **);
+CubitStatus read_geometry(int, char **, bool local = false);
 CubitStatus make_Point();
 // macro for printing a separator line
 #define PRINT_SEPARATOR   PRINT_INFO("=======================================\n");
@@ -91,7 +91,7 @@
 /// 
 /// Arguments: file name(s) of geometry files in which to look
 ///
-CubitStatus read_geometry(int num_files, char **argv) 
+CubitStatus read_geometry(int num_files, char **argv, bool local) 
 {
   CubitStatus status = CUBIT_SUCCESS;
   GeometryQueryTool *gti = GeometryQueryTool::instance();
@@ -101,11 +101,12 @@
   PRINT_SEPARATOR;
 
   for (i = 0; i < num_files; i++) {
-    std::string filename( SRCPATH );
+    std::string filename( local ? "./" : SRCPATH );
     filename += argv[i];
     status = gti->import_solid_model(filename.c_str(), "OCC");
     if (status != CUBIT_SUCCESS) {
-      PRINT_ERROR("Problems reading geometry file %s.\n", filename);
+      PRINT_ERROR("Problems reading geometry file %s.\n", filename.c_str());
+      abort();
     }
   }
   PRINT_SEPARATOR;
@@ -194,8 +195,8 @@
     }
 
   // Read in the geometry from files specified on the command line
-  char *argv = "./stitch.occ";
-  CubitStatus status = read_geometry(1, &argv);
+  char *argv = "stitch.occ";
+  CubitStatus status = read_geometry(1, &argv, true);
   if (status == CUBIT_FAILURE) exit(1);
 
   bodies.clean_out();




More information about the cgma-dev mailing list