Restoring test cases removed by last commit.
authorabv <abv@opencascade.com>
Mon, 10 Dec 2012 15:53:29 +0000 (19:53 +0400)
committerabv <abv@opencascade.com>
Tue, 18 Dec 2012 09:24:12 +0000 (13:24 +0400)
Enabling command QAAIAGetColor2d on Windows in order to allow relevant tests to pass.

tests/bugs/caf/buc60921 [new file with mode: 0644]
tests/bugs/caf/bug114 [new file with mode: 0644]
tests/bugs/moddata/bug143
tests/bugs/moddata/bug503
tests/bugs/parse.rules

diff --git a/tests/bugs/caf/buc60921 b/tests/bugs/caf/buc60921
new file mode 100644 (file)
index 0000000..18579f5
--- /dev/null
@@ -0,0 +1,52 @@
+# This TCL script demonstrates memory leak in OCAF Undo/Redo
+#
+# The DRAW command TestOCAF (provided separately) just reads 
+# the specified brep file
+# and puts it into the document on a given label.
+# This operation is done and undone several times,
+# and the problem is that each time additional memory
+# (approximately equivalent to the size of shape)
+# is consumed.
+#
+# While obviously it should not be so: even if Undo keeps the 
+# shape in memory as delta on Redo, this delta should be cleared 
+# by the next operation!
+#
+# The bug persists with any setting of variables MMGT_OPT and MMGT_MMAP
+# (while with different initial size and step) and 
+#
+# It seems that either delta is not completely freed, or some
+# other data structures keep the shape memory
+
+puts "==========="
+puts "BUC60921"
+puts "BUC60954"
+puts "==========="
+
+pload QAcommands
+
+# see end of script!
+set BREP [locate_data_file BUC60921.brep]
+#set BREP [locate_data_file Bottom.brep]
+
+NewDocument D MDTV-Standard
+UndoLimit D 100
+
+set i_max 10
+set listmem {}
+for {set i 1} {$i <= ${i_max}} {incr i} {
+    CommitCommand D
+    OpenCommand D
+    BUC60921 D 0:1:1 $BREP
+
+    CommitCommand D
+    OpenCommand D
+    Undo D
+
+    # check memory usage (with tolerance equal to half page size)
+    lappend listmem [expr [meminfo w] / 1024]
+    if { [checktrend $listmem 0 512 "Memory leak detected"] } {
+        puts "No memory leak, $i iterations"
+        break
+    }
+}
diff --git a/tests/bugs/caf/bug114 b/tests/bugs/caf/bug114
new file mode 100644 (file)
index 0000000..c82cef8
--- /dev/null
@@ -0,0 +1,27 @@
+puts "==========="
+puts "OCC114"
+puts "==========="
+
+# Max number of iterations for computing memory leackage
+set i_max 20
+puts "Amount of iterations is $i_max"
+
+NewDocument D MDTV-Standard
+UndoLimit D 10
+
+restore [locate_data_file OCC114.brep] s
+
+set listmem {}
+for {set i 1} {${i} <= ${i_max}} {incr i} {
+
+    OpenCommand D
+    SetShape D 0:1 s 
+    AbortCommand D
+
+    # 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
+    }
+}
index 717c6f0..a76fd4a 100755 (executable)
@@ -7,15 +7,7 @@ puts ""
 ## Raises exception "Standard_NotImplemented3" in GCPnts_AbscissaPoint on a Geom2d_OffsetCurve 
 ######################################################################
 
 ## Raises exception "Standard_NotImplemented3" in GCPnts_AbscissaPoint on a Geom2d_OffsetCurve 
 ######################################################################
 
-if { [array get env os_type] != "" } {
-    set os $env(os_type)
-}
-if { [string compare $os "windows"] == 0 } {
-   set len_ch 3.9999999999999993e+100
-} else {
-  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
 line line_2d 0 0 1 1
 
 offset result line_2d 10 1 0
@@ -23,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
 
 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 c6e95d3..5195d81 100755 (executable)
@@ -9,7 +9,8 @@ puts ""
 #cpulimit 9000
 
 restore [locate_data_file OCC503.brep] result
 #cpulimit 9000
 
 restore [locate_data_file OCC503.brep] result
-if [catch {sprops result} catch_result] {
+
+if [catch {sprops result 0.001 } catch_result] {
     set mistake 1
 } else {
     set mistake 0
     set mistake 1
 } else {
     set mistake 0
index 6f6569c..e00d711 100755 (executable)
@@ -1,5 +1,3 @@
 FAILED /\bFaulty\b/ bad shape
 IGNORE /^Error [23]d = [\d.-]+/ debug output of blend command
 FAILED /\bFaulty\b/ bad shape
 IGNORE /^Error [23]d = [\d.-]+/ debug output of blend command
-
-
-
+OK /Relative error of mass computation/ message from vprops