Adjusting test unstable testing cases in Debug mode for current state of OCCT
[occt.git] / tests / perf / bop / boxholes
1 puts "========"
2 puts "CR24264"
3 puts "========"
4 puts ""
5 #######################################################################
6 # OCCT 6.6.0: cutting 1600 cylinders from a box leads to out-of-memory on 32-bit system
7 #######################################################################
8
9 # test cutting box by many holes, inspired by
10 # http://www.opencascade.org/org/forum/thread_12369/?forum=3
11 # in OCCT 6.6.0 32-bit mode on Windows this fails with N >= 40 (out of memory)
12
13 if { [regexp {Debug mode} [dversion]] } {
14    cpulimit 2000
15    set max_time 1500
16 } else {
17    cpulimit 500
18    set max_time 250
19 }
20
21 # box plate to cut the holes from
22 box b 100 100 1
23
24 # N defines number of holes along each of X and Y, thus total N^2 holes
25 # will be drilled; note that the algorithm iself is likely to be quadratic
26 # for number of shapes, i.e. CPU ~ N^4 
27 set N 40
28 set holes {}
29 for {set i 1} {$i < $N} {incr i} {
30     for {set j 1} {$j < $N} {incr j} {
31        pcylinder p_${i}_$j 0.5 1
32        ttranslate p_${i}_$j [expr $i * 100. / $N]  [expr $j * 100. / $N]  0.
33        lappend holes p_${i}_$j
34     }
35 }
36
37 eval compound $holes drill
38
39 set mem1 [meminfo h]
40
41 dchrono cpu reset
42 dchrono cpu start
43
44 bcut r b drill
45
46 dchrono cpu stop
47 puts [dchrono cpu show]
48 set q2 [dchrono cpu show]
49
50 set mem2 [meminfo h]
51
52 set mem1 [expr ${mem1}/(1024 * 1024)]
53 set mem2 [expr ${mem2}/(1024 * 1024)]
54 set mem_delta 70
55 puts "mem1=${mem1}"
56 puts "mem2=${mem2}"
57 puts "mem_delta=${mem_delta}"
58
59 if { [expr ${mem2} - ${mem1}] > ${mem_delta}} {
60     puts "Faulty : there is memory leak"
61 }
62
63 regexp {CPU user time: ([-0-9.+eE]+) seconds} ${q2} full z
64 if { ${z} > ${max_time} } {                                         
65     puts "Elapsed time is more than ${max_time} seconds - Faulty"
66 } else {
67     puts "Elapsed time is less than ${max_time} seconds - OK"
68 }
69
70 vinit
71 vdisplay r
72 vfit