From 29616ca8ff58941b076e989ce5a3a543029e6b61 Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Sun, 6 Jul 2025 22:44:42 +0100 Subject: [PATCH] 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. --- tests/de/begin | 9 ++++-- tests/de/iges_1/G8 | 15 +++++----- tests/de/iges_1/J9 | 15 +++++----- tests/de/step_1/E1 | 17 +++++------ tests/de/step_1/E2 | 17 +++++------ tests/de/step_1/G9 | 15 +++++----- tests/de/step_2/B3 | 15 +++++----- tests/de/step_2/Q5 | 16 +++++------ tests/de/step_2/Q6 | 16 +++++------ tests/de/step_3/B9 | 15 +++++----- tests/de/step_3/C8 | 16 +++++------ tests/de/step_3/E4 | 15 +++++----- tests/perf/heal/bug24596_1 | 25 ---------------- tests/perf/heal/bug24596_2 | 25 ---------------- tests/perf/modalg/bug32539_2 | 55 ------------------------------------ tests/v3d/bugs/bug26139 | 11 -------- 16 files changed, 97 insertions(+), 200 deletions(-) delete mode 100644 tests/perf/heal/bug24596_1 delete mode 100644 tests/perf/heal/bug24596_2 delete mode 100644 tests/perf/modalg/bug32539_2 delete mode 100644 tests/v3d/bugs/bug26139 diff --git a/tests/de/begin b/tests/de/begin index efe02a2bfb..5918872812 100644 --- a/tests/de/begin +++ b/tests/de/begin @@ -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 { diff --git a/tests/de/iges_1/G8 b/tests/de/iges_1/G8 index f2b249db24..d40129325b 100644 --- a/tests/de/iges_1/G8 +++ b/tests/de/iges_1/G8 @@ -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}\"" + } } diff --git a/tests/de/iges_1/J9 b/tests/de/iges_1/J9 index 64b4f46cba..bbc1dd5bb5 100644 --- a/tests/de/iges_1/J9 +++ b/tests/de/iges_1/J9 @@ -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}\"" + } } diff --git a/tests/de/step_1/E1 b/tests/de/step_1/E1 index b903a708cd..e71a1271c0 100644 --- a/tests/de/step_1/E1 +++ b/tests/de/step_1/E1 @@ -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}\"" -} \ No newline at end of file + # 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}\"" + } +} diff --git a/tests/de/step_1/E2 b/tests/de/step_1/E2 index 141debb92f..caf438d642 100644 --- a/tests/de/step_1/E2 +++ b/tests/de/step_1/E2 @@ -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}\"" -} \ No newline at end of file + # 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}\"" + } +} diff --git a/tests/de/step_1/G9 b/tests/de/step_1/G9 index 712a3e5982..2267aade0c 100644 --- a/tests/de/step_1/G9 +++ b/tests/de/step_1/G9 @@ -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}\"" + } } diff --git a/tests/de/step_2/B3 b/tests/de/step_2/B3 index e08538bf00..f22e8c2b64 100644 --- a/tests/de/step_2/B3 +++ b/tests/de/step_2/B3 @@ -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}\"" + } } diff --git a/tests/de/step_2/Q5 b/tests/de/step_2/Q5 index 035864159a..370b99dd30 100644 --- a/tests/de/step_2/Q5 +++ b/tests/de/step_2/Q5 @@ -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}\"" + } } - diff --git a/tests/de/step_2/Q6 b/tests/de/step_2/Q6 index 1df2560691..ed02f6b937 100644 --- a/tests/de/step_2/Q6 +++ b/tests/de/step_2/Q6 @@ -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}\"" + } } - diff --git a/tests/de/step_3/B9 b/tests/de/step_3/B9 index 2e78a1347f..5f92ae7817 100644 --- a/tests/de/step_3/B9 +++ b/tests/de/step_3/B9 @@ -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}\"" + } } diff --git a/tests/de/step_3/C8 b/tests/de/step_3/C8 index 4f47b33248..8563581b72 100644 --- a/tests/de/step_3/C8 +++ b/tests/de/step_3/C8 @@ -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}\"" + } } - diff --git a/tests/de/step_3/E4 b/tests/de/step_3/E4 index cc5b077c81..8c109da144 100644 --- a/tests/de/step_3/E4 +++ b/tests/de/step_3/E4 @@ -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}\"" + } } diff --git a/tests/perf/heal/bug24596_1 b/tests/perf/heal/bug24596_1 deleted file mode 100644 index bd6b7ccc8b..0000000000 --- a/tests/perf/heal/bug24596_1 +++ /dev/null @@ -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 \ No newline at end of file diff --git a/tests/perf/heal/bug24596_2 b/tests/perf/heal/bug24596_2 deleted file mode 100644 index d925891073..0000000000 --- a/tests/perf/heal/bug24596_2 +++ /dev/null @@ -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 \ No newline at end of file diff --git a/tests/perf/modalg/bug32539_2 b/tests/perf/modalg/bug32539_2 deleted file mode 100644 index 5d7bbc27e1..0000000000 --- a/tests/perf/modalg/bug32539_2 +++ /dev/null @@ -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" -} diff --git a/tests/v3d/bugs/bug26139 b/tests/v3d/bugs/bug26139 deleted file mode 100644 index b970cb2224..0000000000 --- a/tests/v3d/bugs/bug26139 +++ /dev/null @@ -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 -- 2.39.5