Adjusting test unstable testing cases in Debug mode for current state of OCCT
[occt.git] / tests / perf / bop / boxholes
CommitLineData
465d1a2c 1puts "========"
2puts "CR24264"
3puts "========"
4puts ""
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
429a6c4d 13if { [regexp {Debug mode} [dversion]] } {
14 cpulimit 2000
15 set max_time 1500
16} else {
17 cpulimit 500
18 set max_time 250
19}
20
465d1a2c 21# box plate to cut the holes from
22box 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
27set N 40
28set holes {}
29for {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
37eval compound $holes drill
38
39set mem1 [meminfo h]
40
41dchrono cpu reset
42dchrono cpu start
43
44bcut r b drill
45
46dchrono cpu stop
47puts [dchrono cpu show]
48set q2 [dchrono cpu show]
49
50set mem2 [meminfo h]
51
52set mem1 [expr ${mem1}/(1024 * 1024)]
53set mem2 [expr ${mem2}/(1024 * 1024)]
54set mem_delta 70
55puts "mem1=${mem1}"
56puts "mem2=${mem2}"
57puts "mem_delta=${mem_delta}"
58
59if { [expr ${mem2} - ${mem1}] > ${mem_delta}} {
60 puts "Faulty : there is memory leak"
61}
62
63regexp {CPU user time: ([-0-9.+eE]+) seconds} ${q2} full z
465d1a2c 64if { ${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
70vinit
71vdisplay r
72vfit