1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-07-20 12:45:50 +03:00

Testing - Draw testing clear up (#595)

- Deleted slow V3D and performance tests under `tests/v3d` and `tests/perf`.
- Updated `de_before_script` in DE/IGES tests to set `new_resource_path` to a subfolder per file.
- Added cleanup logic in `de_after_script` to delete the temporary resource directories.
This commit is contained in:
Pasukhin Dmitry 2025-07-06 22:44:42 +01:00 committed by GitHub
parent d9684743dc
commit 29616ca8ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 97 additions and 200 deletions

View File

@ -48,8 +48,13 @@ proc parse_resource_file {theFileName} {
# Creates new resource file with options as key-value dict
proc create_resource_file {theFileName theOptions} {
# Open a resource file
set aFD [open "${theFileName}" "wb"]
# Ensure the parent directory exists
set parentDir [file dirname $theFileName]
if { ![file exists $parentDir] } {
file mkdir $parentDir
}
# Open the file for writing
set aFD [open $theFileName "wb"]
set aLineNo 0
# Write line by line
dict for {aKey aValue} $theOptions {

View File

@ -24,12 +24,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_IGESDefaults)
# reading old resource file
@ -37,7 +31,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromIGES.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/IGES" $anOptions
# changing the path to the resource file
@ -51,4 +46,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_IGESDefaults) ${old_resource_path}
puts "Restore path to IGES resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -28,12 +28,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_IGESDefaults)
# reading old resource file
@ -41,7 +35,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromIGES.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/IGES" $anOptions
# changing the path to the resource file
@ -55,4 +50,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_IGESDefaults) ${old_resource_path}
puts "Restore path to IGES resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -28,12 +28,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -41,7 +35,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -55,4 +50,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
}
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -28,12 +28,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -41,7 +35,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -55,4 +50,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
}
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -30,12 +30,6 @@ LAYERS : Layers = ( 001 )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -43,7 +37,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -57,4 +52,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -28,12 +28,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -41,7 +35,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -55,4 +50,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -24,12 +24,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -37,7 +31,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -51,5 +46,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -24,12 +24,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -37,7 +31,8 @@ proc de_before_script {TheFileName} {
# turn off the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -51,5 +46,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -30,12 +30,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -43,7 +37,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -57,5 +52,11 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -28,12 +28,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -41,7 +35,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -55,5 +50,10 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -28,12 +28,6 @@ LAYERS : Layers = ( )
set de_use_custom_scripts 1
proc de_before_script {TheFileName} {
if { [info exists imagedir] == 0 } {
set imagedir ../[file rootname $TheFileName]
if {![file exists ${imagedir}]} {
file mkdir ${imagedir}
}
}
# remember the path to the old resource file
set old_resource_path $::env(CSF_STEPDefaults)
# reading old resource file
@ -41,7 +35,8 @@ proc de_before_script {TheFileName} {
# activation of ignoring the adding of natural bound
dict set anOptions "FromSTEP.FixShape.FixAddNaturalBoundMode" "0"
# path to new resource file
set new_resource_path ${imagedir}
global imagedir new_resource_path
set new_resource_path "${imagedir}[file rootname $TheFileName]"
# creating resource file
create_resource_file "${new_resource_path}/STEP" $anOptions
# changing the path to the resource file
@ -55,5 +50,11 @@ proc de_after_script {old_resource_path} {
# Restoring the path to the old resource file
set ::env(CSF_STEPDefaults) ${old_resource_path}
puts "Restore path to STEP resource file: \"${old_resource_path}\""
# Remove the newly created resource directory and its contents
global new_resource_path
if {[info exists new_resource_path] && [file exists ${new_resource_path}]} {
file delete -force ${new_resource_path}
puts "Deleted temporary directory: \"${new_resource_path}\""
}
}

View File

@ -1,25 +0,0 @@
puts "============"
puts "OCC24596"
puts "============"
puts ""
###############################
## Slow import of IGES data
###############################
pload QAcommands IGES
if { [regexp {Debug mode} [dversion]] } {
cpulimit 8500
} else {
cpulimit 2600
}
# 1 - igesread
dchrono h restart
igesread [locate_data_file 100B_Nosecone_with_Triangular_FSS.igs] a 43479
dchrono h stop counter igesread
# 2 - checkshape
dchrono h2 restart
checkshape a_1
dchrono h2 stop counter checkshape

View File

@ -1,25 +0,0 @@
puts "============"
puts "OCC24596"
puts "============"
puts ""
###############################
## Slow import of IGES data
###############################
pload QAcommands IGES
if { [regexp {Debug mode} [dversion]] } {
cpulimit 8500
} else {
cpulimit 2600
}
# 1 - igesread
dchrono h restart
igesread [locate_data_file 100B_Nosecone_with_Triangular_FSS.igs] b 86884
dchrono h stop counter igesread
# 2 - checkshape
dchrono h2 restart
checkshape b_1
dchrono h2 stop counter checkshape

View File

@ -1,55 +0,0 @@
puts "=========="
puts "0032539: Modeling Algorithms - Parallelize BRepExtrema_DistShapeShape algorithm"
puts "=========="
puts ""
# prepare
restore [locate_data_file 5000-12.brep] s1
restore [locate_data_file BPLSEITLI.brep] s2
# multi-thread
cpulimit 1000
dchrono p reset; dchrono p start;
set pres [distmini res s1 s2 -parallel]
dchrono p stop;
regexp {Elapsed time: +([-0-9.+eE]+) Hours +([-0-9.+eE]+) Minutes +([-0-9.+eE]+) Seconds} [dchrono p show] full p_Hours p_Minutes p_Seconds
set p_Time [expr ${p_Hours}*60.*60. + ${p_Minutes}*60. + ${p_Seconds} ]
puts "multithreaded time: $p_Time"
set pdist [dval res_val]
vclear
vclose ALL
vinit v1/v1
vdisplay -dispMode 1 s1 s2 res
vzoom 2
checkview -screenshot -3d -path ${imagedir}/${test_image}_multi.png
#single-thread
dchrono s reset; dchrono s start;
set cres [distmini res s1 s2]
dchrono s stop;
regexp {Elapsed time: +([-0-9.+eE]+) Hours +([-0-9.+eE]+) Minutes +([-0-9.+eE]+) Seconds} [dchrono s show] full s_Hours s_Minutes s_Seconds
set s_Time [expr ${s_Hours}*60.*60. + ${s_Minutes}*60. + ${s_Seconds} ]
puts "single-threaded time: $s_Time"
set sdist [dval res_val]
vclear
vclose ALL
vinit v2/v2
vdisplay -dispMode 1 s1 s2 res
vzoom 2
checkview -screenshot -3d -path ${imagedir}/${test_image}_single.png
# compare
set ratio [expr ${s_Time}/${p_Time} ]
puts "acceleration in multi-threaded work: $ratio"
if {[string compare $cres $pres] != 0} {
puts "Error: different result between single-thread and multi-thread mode"
}
if {[expr abs(${sdist} - ${pdist})] > 1E-13} {
puts "Error: different distance between single-thread and multi-thread mode"
}

View File

@ -1,11 +0,0 @@
puts "============"
puts "CR26139: AIS_InteractiveContext::Display performance regression"
puts "To measure performance downgrade, the time elapsed should be greater than on previous version"
puts "============"
puts ""
pload VISUALIZATION QAcommands
vinit View1
OCC26139
vdump $imagedir/${casename}.png