]> OCCT Git - occt-copy.git/commitdiff
Corrections for tests after integration of 2012-12-07
authorabv <abv@opencascade.com>
Sun, 9 Dec 2012 15:03:08 +0000 (19:03 +0400)
committerabv <abv@opencascade.com>
Mon, 10 Dec 2012 12:32:18 +0000 (16:32 +0400)
1. Fixed tests bugs caf bug350 and bug352 failing in Debug mode due to errors in QA code (removing items from the map during iteration).
2. Debug output messages are ignored in parse.rules in heal and bugs group to avoid false failures in Debug mode after changes made for #23609 and last integration of new tests.
3. Test bugs moddata buc60654 removed as duplicate of bug143.
4. Test bugs moddata bug143 fixed to compare real values properly. New command checkreal added for comparing reals with tolerance.
6. Test bugs caf bug114 is fixed to avoid use of OS-specific commands (command meminfo is used instead). Command checktrend is used to check for possible memory leak.

src/QANewBRepNaming/QANewBRepNaming_ImportShape.cxx
src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx
tests/bugs/begin
tests/bugs/caf/bug114
tests/bugs/moddata/buc60654 [deleted file]
tests/bugs/moddata/bug143
tests/bugs/parse.rules
tests/heal/parse.rules

index 4be94694796638a12637a174509bbb7ad1af584a..9be4ee70efd106f58b1ed024eeb55ab38327fe60 100755 (executable)
@@ -245,6 +245,8 @@ void QANewBRepNaming_ImportShape::LoadC0Edges(const TopoDS_Shape& S,
     Standard_Boolean aC0 = Standard_False;
     TopoDS_Shape anEdge1 = anEx.Current();
     if (edgeNaborFaces.IsBound(anEdge1)) {
+      TopTools_ListOfShape aEdgesToRemove; // record items to be removed from the map (should be done after iteration)
+      aEdgesToRemove.Append (anEdge1);
       const TopTools_ListOfShape& aList1 = edgeNaborFaces.Find(anEdge1);
       TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itr(edgeNaborFaces);
       for (; itr.More(); itr.Next()) {
@@ -261,11 +263,13 @@ void QANewBRepNaming_ImportShape::LoadC0Edges(const TopoDS_Shape& S,
            aC0=Standard_True;
            TNaming_Builder bC0Edge(Tagger->NewChild());
            bC0Edge.Generated(anEdge2);
-           edgeNaborFaces.UnBind(anEdge2);
+            aEdgesToRemove.Append (anEdge2);
          }
        }
       }
-      edgeNaborFaces.UnBind(anEdge1);
+      // remove items from the data map
+      for(TopTools_ListIteratorOfListOfShape anIt(aEdgesToRemove); anIt.More(); anIt.Next())
+        edgeNaborFaces.UnBind(anIt.Value());
     }
     if (aC0) {
       TNaming_Builder bC0Edge(Tagger->NewChild());
index 9280bcafa44437f2cf98b5fba267d4dfb65cda4e..9c477416be56c42f4ce443d97ba791dc7e6473a6 100755 (executable)
@@ -532,7 +532,6 @@ QANewModTopOpe_Glue::PerformSDFaces()
       }
     }
 
-    anIter.Initialize(myMapModif);
     TopTools_MapOfShape aComVerMap;
     TopTools_MapOfShape aLocVerMap;
 
@@ -541,6 +540,8 @@ QANewModTopOpe_Glue::PerformSDFaces()
     anExp1.Init(myS2, TopAbs_VERTEX);
     for(; anExp1.More();  anExp1.Next()) aComVerMap.Add(anExp1.Current());
 
+    TopTools_ListOfShape aShapesToRemove; // record items to be removed from the map (should be done after iteration)
+    anIter.Initialize(myMapModif);
     for(; anIter.More(); anIter.Next()) {
       const TopoDS_Shape& aS = anIter.Key();
       if(aS.ShapeType() == TopAbs_EDGE) {
@@ -574,18 +575,19 @@ QANewModTopOpe_Glue::PerformSDFaces()
                myMapModif(aS).Remove(anI1);
              }
              else {
-               myMapModif.UnBind(aS);
+                aShapesToRemove.Append (aS);
              }
            }
          }
          if(!anI1.More()) break;
        }
       }
-      
-//      if(anIter.Value().Extent() == 0) myMapModif.UnBind(aS);
-
     }
 
+    // remove items from the data map
+    for(TopTools_ListIteratorOfListOfShape anIt(aShapesToRemove); anIt.More(); anIt.Next())
+      myMapModif.UnBind(anIt.Value());
+
     // Deleted vertices
     anExp1.Init(myShape, TopAbs_VERTEX);
     for(; anExp1.More();  anExp1.Next()) {
index 7285857398a35110f666004bfa7d7163c7e3ed1b..aac6c0d3b46f3fb29808dfe4a76835a23fb686a3 100755 (executable)
@@ -25,6 +25,16 @@ if { [info exists test_image] == 0 } {
    set test_image photo
 }
 
+# Procedure to check equality of two reals with tolerance (relative and absolute)
+proc checkreal {name value expected tol_abs tol_rel} {
+    if { abs ($value - $expected) > $tol_abs + $tol_rel * abs ($expected) } {
+        puts "Error: $name = $value is not equal to expected $expected"
+    } else {
+        puts "Check of $name OK: value = $value, expected = $expected"
+    }
+    return
+}
+
 # Procedure to check if sequence of values in listval follows linear trend
 # adding the same delta on each step.
 #
index 23e7e155ed7149f53d6437debce9d3a6022faaee..c82cef86e33612dd0d060e8765977dd289c515ef 100755 (executable)
@@ -2,62 +2,26 @@ puts "==========="
 puts "OCC114"
 puts "==========="
 
-#--------------------------------------------------------------------
-####### Setting value of memory leakage in percents of memory allocated by shape
-set percent_max 10
-puts "Max memory leakage is $percent_max%"
-####### Setting amount of iterations for computing leackage
+# Max number of iterations for computing memory leackage
 set i_max 20
 puts "Amount of iterations is $i_max"
-#--------------------------------------------------------------------
-
-if ![string compare $tcl_platform(platform) "windows"] {
-    proc VMem { memory } {
-       upvar $memory mem
-       regsub "^.*PeakVirtualSize: *\(\[0-9\]*\) KB.*$" \
-           [exec tlist [pid]] "\\1" mem
-    }
-} else {
-    proc VMem { memory } {
-       upvar $memory mem
-       set mem [lindex [exec ps -o vsz -p [pid]] 1]
-    }
-}
 
 NewDocument D MDTV-Standard
 UndoLimit D 10
 
-VMem Mem0
 restore [locate_data_file OCC114.brep] s
-VMem Mem1
-#puts "...  The peak memory consumed: [expr $Mem1 - $Mem0] KB"
-
-set MemoryLeakage 0
 
+set listmem {}
 for {set i 1} {${i} <= ${i_max}} {incr i} {
 
-   OpenCommand D
-   SetShape D 0:1 s 
-   AbortCommand D
-
-   VMem Mem2
-   set Delta [expr $Mem2 - $Mem1]
-   set MemoryLeakage [expr $MemoryLeakage + $Delta]
-#   puts "       $i delta memory consumed: $Delta KB"
-}
+    OpenCommand D
+    SetShape D 0:1 s 
+    AbortCommand D
 
-
-if { $MemoryLeakage != 0 } then {
-  set percent [expr ${MemoryLeakage} / (double(${i_max}) * (${Mem1} - ${Mem0})) * 100.]
-} else {
-  set percent 0
-}
-puts "Current memory leakage in percents = ${percent}"
-
-if {${percent} > ${percent_max}} {
-   puts "OCC114: Error"
-} else {
-   puts "OCC114: OK"
+    # check memory usage (with tolerance equal to half page size)
+    lappend listmem [expr [meminfo w] / 1024]
+    if { [checktrend $listmem 0 1 "Memory leak detected"] } {
+        puts "No memory leak, $i iterations"
+        break
+    }
 }
-
-
diff --git a/tests/bugs/moddata/buc60654 b/tests/bugs/moddata/buc60654
deleted file mode 100755 (executable)
index 8e7008e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-puts "=================================="
-puts "BUC60654"
-puts "=================================="
-puts ""
-##########################################################
-## Raises exception in GCPnts_AbscissaPoint on a Geom2d_OffsetCurve 
-##########################################################
-
-set len_ch 4.0000000000000001e+100
-
-line line_2d 0 0 1 1
-
-offset result line_2d 10 1 0
-
-set info [length $result]
-regexp {The length result is +([-0-9.+eE]+)} $info full len
-
-if { ${len} != ${len_ch} } {
-    puts "Error : length is invalid"
-}
-
index ee27c8606026f6ea294ff6de319ece47566bb445..a76fd4a84ec33a7a491273148686ddf892561ea7 100755 (executable)
@@ -7,7 +7,7 @@ puts ""
 ## Raises exception "Standard_NotImplemented3" in GCPnts_AbscissaPoint on a Geom2d_OffsetCurve 
 ######################################################################
 
-set len_ch 4.0000000000000001e+100
+set len_expected 4.e100
 line line_2d 0 0 1 1
 
 offset result line_2d 10 1 0
@@ -15,6 +15,4 @@ offset result line_2d 10 1 0
 set info [length $result]
 regexp {The length result is +([-0-9.+eE]+)} $info full len
 
-if { ${len} != ${len_ch} } {
-    puts "Error : Length is invalid"
-}
+checkreal "Length" $len $len_expected 0. 1e-10
index 8f729a92917bff0ea95b0add938d967bebbfdaf7..6f6569ccd1a685c47c5d78d3601d73fc83614840 100755 (executable)
@@ -1,4 +1,5 @@
 FAILED /\bFaulty\b/ bad shape
+IGNORE /^Error [23]d = [\d.-]+/ debug output of blend command
 
 
 
index fdebf394105efc848446986c757c376c07d70ef9..ecb7c874b7563cdab4d31b0d9fc8e48d0c565c0a 100644 (file)
@@ -1,4 +1,6 @@
 FAILED /\bFaulty\b/ bad shape
 IGNORE /Error: Number of intervals are not equal for 2d 3d. Ignored./ Debug mode message from DT_ShapeDivide
 IGNORE /Warning: GeomConvert_ApproxSurface Exception: try to decrease continuity/ DEbug mode message from DT_ToBspl
-IGNORE /Error: ShapeFix_ComposeShell::MakeFacesOnPatch: can[']t dispatch wires/ Debug mode output
\ No newline at end of file
+IGNORE /Error: ShapeFix_ComposeShell::MakeFacesOnPatch: can[']t dispatch wires/ Debug mode output
+IGNORE /Warning: ShapeFix_WireSegment::DefineI[UV]M[ia][nx]: indexation error/ debug mode output on bad geometries
+IGNORE /error = [0-9eE.+-]+\s+spans = [0-9]+/ debug output of surface approximator
\ No newline at end of file