From 863f782a42c79ee52bc7b3ef0d13fc1d1dfaea37 Mon Sep 17 00:00:00 2001 From: ski Date: Tue, 9 Feb 2016 17:31:17 +0300 Subject: [PATCH] 0027146: Create command checkplatform Command checkplatform was created. All test cases were updated. Global variable os_type was eliminated. New option -osx (MacOS) for procedure checkplatform was added. --- dox/dev_guides/tests/tests.md | 6 +-- src/DrawResources/CheckCommands.tcl | 60 +++++++++++++++++++++++++++++ src/DrawResources/TestCommands.tcl | 19 +-------- tests/3rdparty/export/A1 | 7 ++-- tests/bugs/caf/bug23071 | 4 +- tests/bugs/fclasses/bug23852 | 9 +---- tests/bugs/fclasses/bug309 | 8 ++-- tests/bugs/modalg_2/bug426 | 3 +- tests/bugs/modalg_5/bug23906 | 2 +- tests/bugs/modalg_5/bug25019 | 4 +- tests/bugs/modalg_5/bug25413 | 6 +-- tests/bugs/modalg_6/bug26447 | 2 +- tests/bugs/moddata_1/bug15519 | 2 +- tests/bugs/moddata_1/bug21292 | 2 +- tests/bugs/moddata_2/bug567 | 2 +- tests/bugs/moddata_3/bug25487_1 | 10 +---- tests/bugs/moddata_3/bug25487_2 | 10 +---- tests/bugs/vis/bug21091_3 | 6 +-- tests/bugs/vis/bug21091_4 | 6 +-- tests/bugs/vis/bug21091_5 | 6 +-- tests/bugs/vis/bug21091_6 | 6 +-- tests/bugs/vis/bug21091_8 | 6 +-- tests/bugs/vis/bug21091_9 | 6 +-- tests/bugs/vis/bug22188 | 8 ++-- tests/bugs/vis/bug232 | 3 +- tests/bugs/vis/bug26424 | 11 ++---- tests/bugs/xde/bug22898 | 3 +- tests/chamfer/data/complex/B9 | 9 ++--- tests/demo/draw/getsource | 3 +- tests/mesh/data/standard/G1 | 3 +- tests/mesh/data/standard/U7 | 12 +++--- tests/perf/fclasses/bug24947 | 2 +- tests/perf/ncollection/A1 | 45 +++++++++++----------- tests/perf/ncollection/A2 | 14 +++---- tests/perf/ncollection/A3 | 14 +++---- tests/xml/begin | 7 ++-- 36 files changed, 171 insertions(+), 155 deletions(-) diff --git a/dox/dev_guides/tests/tests.md b/dox/dev_guides/tests/tests.md index f5bcc3de19..1228480c20 100644 --- a/dox/dev_guides/tests/tests.md +++ b/dox/dev_guides/tests/tests.md @@ -601,12 +601,12 @@ puts "TODO BugNumber ListOfPlatforms: RegularExpression" Here: * *BugNumber* is the bug ID in the tracker. For example: #12345. -* *ListOfPlatforms* is a list of platforms, at which the bug is reproduced (Linux, Windows, MacOS, or All). Note that the platform name is custom for the OCCT test system; it corresponds to the value of environment variable *os_type* defined in DRAW. +* *ListOfPlatforms* is a list of platforms, at which the bug is reproduced (Linux, Windows, MacOS, or All). Note that the platform name is custom for the OCCT test system; Use procedure *checkplatform* to get the platform name. Example: ~~~~~ -Draw[2]> puts $env(os_type) -windows +Draw[2]> checkplatform +Windows ~~~~~ * RegularExpression is a regular expression, which should be matched against the line indicating the problem in the script output. diff --git a/src/DrawResources/CheckCommands.tcl b/src/DrawResources/CheckCommands.tcl index a8c51e5d47..1caf323fc9 100644 --- a/src/DrawResources/CheckCommands.tcl +++ b/src/DrawResources/CheckCommands.tcl @@ -1022,3 +1022,63 @@ proc checktrinfo {shape args} { puts "Error: Maximal deflection is too big" } } + +help checkplatform { + Return name of current platform if no options are given. + + Use: checkplatform [options...] + Allowed options are: + -windows : return 1 if current platform is 'Windows', overwise return 0 + -linux : return 1 if current platform is 'Linux', overwise return 0 + -osx : return 1 if current platform is 'MacOS X', overwise return 0 + + Only one option can be used at once. + If no option is given, procedure will return the name of current platform. +} +proc checkplatform {args} { + set check_for_windows false + set check_for_linux false + set check_for_macosx false + + set options {{"-windows" check_for_windows 0} + {"-linux" check_for_linux 0} + {"-osx" check_for_macosx 0}} + + _check_args ${args} ${options} "checkplatform" + + if { [regexp "indows" $::tcl_platform(os)] } { + set current_platform Windows + } elseif { $::tcl_platform(os) == "Linux" } { + set current_platform Linux + } elseif { $::tcl_platform(os) == "Darwin" } { + set current_platform MacOS + } + + # no args are given + if { !${check_for_windows} && !${check_for_linux} && !${check_for_macosx}} { + return ${current_platform} + } + + # check usage of proc checkplatform + if { [expr [string is true ${check_for_windows}] + [string is true ${check_for_linux}] + [string is true ${check_for_macosx}] ] > 1} { + error "Error: wrong usage of command checkplatform, only single option can be used at once" + } + + # checking for Windows platform + if { ${check_for_windows} && ${current_platform} == "Windows" } { + return 1 + } + + # checking for Mac OS X platforms + if { ${check_for_linux} && ${current_platform} == "Linux" } { + return 1 + } + + # checking for Mac OS X platforms + if { ${check_for_macosx} && ${current_platform} == "MacOS" } { + return 1 + } + + # current platform is not equal to given as argument platform, return false + return 0 +} diff --git a/src/DrawResources/TestCommands.tcl b/src/DrawResources/TestCommands.tcl index 62707dae64..c9ca2055e1 100644 --- a/src/DrawResources/TestCommands.tcl +++ b/src/DrawResources/TestCommands.tcl @@ -1182,7 +1182,7 @@ proc _check_log {dir group gridname casename errors log {_summary {}} {_html_log # check if line defines specific treatment of some messages if [regexp -nocase {^[ \s]*TODO ([^:]*):(.*)$} $line res platforms pattern] { if { ! [regexp -nocase {\mAll\M} $platforms] && - ! [regexp -nocase "\\m$env(os_type)\\M" $platforms] } { + ! [regexp -nocase "\\m[checkplatform]\\M" $platforms] } { lappend html_log [_html_highlight IGNORE $line] continue ;# TODO statement is for another platform } @@ -1206,7 +1206,7 @@ proc _check_log {dir group gridname casename errors log {_summary {}} {_html_log } if [regexp -nocase {^[ \s]*REQUIRED ([^:]*):[ \s]*(.*)$} $line res platforms pattern] { if { ! [regexp -nocase {\mAll\M} $platforms] && - ! [regexp -nocase "\\m$env(os_type)\\M" $platforms] } { + ! [regexp -nocase "\\m[checkplatform]\\M" $platforms] } { lappend html_log [_html_highlight IGNORE $line] continue ;# REQUIRED statement is for another platform } @@ -1742,21 +1742,6 @@ proc _log_xml_summary {logdir filename log include_cout} { return } -# define custom platform name -proc _tests_platform_def {} { - global env tcl_platform - - if [info exists env(os_type)] { return } - set env(os_type) $tcl_platform(platform) - if { $tcl_platform(os) == "Linux" } { - set env(os_type) Linux - } - if { $tcl_platform(os) == "Darwin" } { - set env(os_type) MacOS - } -} -_tests_platform_def - # Auxiliary procedure to split path specification (usually defined by # environment variable) into list of directories or files proc _split_path {pathspec} { diff --git a/tests/3rdparty/export/A1 b/tests/3rdparty/export/A1 index a74e924225..ef9023e072 100755 --- a/tests/3rdparty/export/A1 +++ b/tests/3rdparty/export/A1 @@ -18,9 +18,8 @@ set aFile $imagedir/shape.pdf set format PDF - -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set size 144401 -} else { +if { [checkplatform -windows] } { set size 154489 +} else { + set size 144401 } diff --git a/tests/bugs/caf/bug23071 b/tests/bugs/caf/bug23071 index 92ee70358f..3d2bc9e679 100755 --- a/tests/bugs/caf/bug23071 +++ b/tests/bugs/caf/bug23071 @@ -49,7 +49,7 @@ if [catch {SaveAs D ${FileName} }] { puts "There is not ${FileName2} file" # - if { [string compare $tcl_platform(platform) "windows"] == 0 } { + if { [checkplatform -windows] } { puts "OS = Windows NT" set status 1 } @@ -61,7 +61,7 @@ if [catch {SaveAs D ${FileName} }] { } else { puts "There is not ${FileName3} file" # - if { [string compare $tcl_platform(platform) "windows"] == 0 } { + if { [checkplatform -windows] } { puts "OS = Windows NT" } else { puts "OS = Unix" diff --git a/tests/bugs/fclasses/bug23852 b/tests/bugs/fclasses/bug23852 index e01538dda6..075f8ca9eb 100755 --- a/tests/bugs/fclasses/bug23852 +++ b/tests/bugs/fclasses/bug23852 @@ -10,10 +10,7 @@ pload DCAF set BugNumber OCC23852 -set OS_platform $tcl_platform(platform) -puts "OS = ${OS_platform}" - -if { [string compare ${OS_platform} "windows"] == 0 } { +if { [checkplatform -windows] } { # Windows, #1 set OSD_Path "\\\\Server\\Shared\\Folder\\File.Extension" @@ -51,9 +48,7 @@ if { [string compare ${OS_platform} "windows"] == 0 } { puts "${BugNumber}, Extension, #2: Error" } -} - -if { [string compare ${OS_platform} "unix"] == 0 } { +} else { # Linux set OSD_Path "//Server/Shared/Folder/File.Extension" puts "OSD_Path = ${OSD_Path}" diff --git a/tests/bugs/fclasses/bug309 b/tests/bugs/fclasses/bug309 index ef76f4d259..201a2034f2 100644 --- a/tests/bugs/fclasses/bug309 +++ b/tests/bugs/fclasses/bug309 @@ -19,14 +19,14 @@ if { ${ll} != 2 } { set result2 [lindex ${result} 1] set CurrentDirectory [pwd] set UpTrek "[file join [file dirname [file dirname ${CurrentDirectory}]] [file tail ${CurrentDirectory}]]" - if { [string compare $tcl_platform(platform) "windows"] != 0} { - set res1 [ string range $result1 1 [expr [string length $result1] -3 ] ] - set res2 [ string range $result2 1 [expr [string length $result2] -3 ] ] - } else { + if { [checkplatform -windows] } { set res1 [ string range $result1 3 [expr [string length $result1] -2 ] ] set res2 [ string range $result2 3 [expr [string length $result2] -2 ] ] set CurrentDirectory [ string range $CurrentDirectory 2 [expr [string length $CurrentDirectory] -1 ]] set UpTrek [ string range $UpTrek 2 [expr [string length $UpTrek] -1 ]] + } else { + set res1 [ string range $result1 1 [expr [string length $result1] -3 ] ] + set res2 [ string range $result2 1 [expr [string length $result2] -3 ] ] } if {[string compare ${res1} "${CurrentDirectory}"] == 0} { puts "OCC309: OK 1" diff --git a/tests/bugs/modalg_2/bug426 b/tests/bugs/modalg_2/bug426 index d5bc921d82..beb76b362c 100755 --- a/tests/bugs/modalg_2/bug426 +++ b/tests/bugs/modalg_2/bug426 @@ -1,5 +1,4 @@ -set env(os_type) $tcl_platform(platform) -if {[string compare $env(os_type) "windows"] != 0 } { +if { ![checkplatform -windows] } { puts "TODO ?OCC12345 MacOS: \\*\\* Exception" puts "TODO ?OCC12345 MacOS: An exception was caught" puts "TODO ?OCC12345 MacOS: TEST INCOMPLETE" diff --git a/tests/bugs/modalg_5/bug23906 b/tests/bugs/modalg_5/bug23906 index f1e2dd7d97..27878e75d0 100755 --- a/tests/bugs/modalg_5/bug23906 +++ b/tests/bugs/modalg_5/bug23906 @@ -20,7 +20,7 @@ set q2 [dchrono h show] regexp {CPU user time: ([-0-9.+eE]+) seconds} $q2 full z puts "$z" -if { [string compare $tcl_platform(platform) "windows"] == 0 } { +if { [checkplatform -windows] } { puts "OS = Windows NT" set max_time 0.5 } else { diff --git a/tests/bugs/modalg_5/bug25019 b/tests/bugs/modalg_5/bug25019 index 53c9d0b51f..103d78d3be 100755 --- a/tests/bugs/modalg_5/bug25019 +++ b/tests/bugs/modalg_5/bug25019 @@ -30,7 +30,7 @@ set q2 [dchrono h2 show] # regexp {CPU user time: ([-0-9.+eE]+) seconds} $q1 full t1 puts "$t1" -if { [string compare $tcl_platform(platform) "windows"] == 0 } { +if { [checkplatform -windows] } { puts "OS = Windows NT" set max_time1 20 } else { @@ -46,7 +46,7 @@ if { $t1 > ${max_time1} } { # regexp {CPU user time: ([-0-9.+eE]+) seconds} $q2 full t2 puts "$t2" -if { [string compare $tcl_platform(platform) "windows"] == 0 } { +if { [checkplatform -windows] } { puts "OS = Windows NT" set max_time2 20 } else { diff --git a/tests/bugs/modalg_5/bug25413 b/tests/bugs/modalg_5/bug25413 index afb3ba95c8..e87037cecd 100644 --- a/tests/bugs/modalg_5/bug25413 +++ b/tests/bugs/modalg_5/bug25413 @@ -20,8 +20,7 @@ set chrono_info [dchrono perf_h show] regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time puts "Elapsed time is: $CPU_time" -set currentOS $tcl_platform(os) -if {[string compare $currentOS "Windows NT"] == 0} { +if { [checkplatform -windows] } { if {[regexp {Debug mode} [dversion]]} { # initial CPU_time for WINDOWS in DEBUG mode is 90 sec puts "Checking WINDOWS performance in debug mode..." @@ -41,8 +40,7 @@ if {[string compare $currentOS "Windows NT"] == 0} { puts "Done!" } } -} -if {[string compare $currentOS "Linux"] == 0} { +} else { if {[regexp {Debug mode} [dversion]]} { # initial CPU_time for LINUX in DEBUG mode is 90 sec puts "Checking LINUX performance in debug mode..." diff --git a/tests/bugs/modalg_6/bug26447 b/tests/bugs/modalg_6/bug26447 index 8aae157bbf..34e49d3b6b 100644 --- a/tests/bugs/modalg_6/bug26447 +++ b/tests/bugs/modalg_6/bug26447 @@ -19,7 +19,7 @@ for {set i 1} {$i <= 1000} {incr i} { } dchrono cr stop -if { [string compare $tcl_platform(platform) "windows"] == 0 } { +if { [checkplatform -windows] } { set max_time 7.5 } else { set max_time 4.5 diff --git a/tests/bugs/moddata_1/bug15519 b/tests/bugs/moddata_1/bug15519 index a542c69b42..b69856f6ca 100755 --- a/tests/bugs/moddata_1/bug15519 +++ b/tests/bugs/moddata_1/bug15519 @@ -18,7 +18,7 @@ tclean result set Deflection 1. catch {incmesh result ${Deflection} } -if { [string compare $tcl_platform(platform) "windows"] == 0 } { +if { [checkplatform -windows] } { set good_tri 96265 set good_nod 71339 set good_defl 27.956052399907215 diff --git a/tests/bugs/moddata_1/bug21292 b/tests/bugs/moddata_1/bug21292 index f4174c56a1..02a0ece69d 100755 --- a/tests/bugs/moddata_1/bug21292 +++ b/tests/bugs/moddata_1/bug21292 @@ -33,7 +33,7 @@ puts "CPU_user_time=${CPU_user_time}" checkprops result -s 1.40193e+07 checknbshapes result -vertex 372 -edge 369 -wire 2 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 745 -if {[string compare $tcl_platform(platform) "windows"] == 0} { +if { [checkplatform -windows] } { puts "windows" set Good_CPU_user_time 0. } else { diff --git a/tests/bugs/moddata_2/bug567 b/tests/bugs/moddata_2/bug567 index 66d877826a..cb44a2561f 100755 --- a/tests/bugs/moddata_2/bug567 +++ b/tests/bugs/moddata_2/bug567 @@ -12,7 +12,7 @@ puts "" restore [locate_data_file OCC567a.draw] s1 restore [locate_data_file OCC567b.draw] s2 -if { [string compare $tcl_platform(platform) "windows"] == 0 } { +if { [checkplatform -windows] } { puts "OS = Windows NT" set N_repeat 10 } else { diff --git a/tests/bugs/moddata_3/bug25487_1 b/tests/bugs/moddata_3/bug25487_1 index 8d7fa1feac..57fa4f33db 100644 --- a/tests/bugs/moddata_3/bug25487_1 +++ b/tests/bugs/moddata_3/bug25487_1 @@ -19,11 +19,8 @@ set chrono_info [dchrono perf_h show] regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time puts "Elapsed time is: $CPU_time" -# Check current OS -set currentOS $tcl_platform(os) - # Check prformance on Windows -if {[string compare $currentOS "Windows NT"] == 0} { +if { [checkplatform -windows] } { if {[regexp {Debug mode} [dversion]]} { # DEBUG mode # initial CPU_time for WINDOWS in DEBUG mode is 410 ((186+19)*2) sec @@ -45,10 +42,7 @@ if {[string compare $currentOS "Windows NT"] == 0} { puts "Done!" } } -} - -# Check performance on Linux -if {[string compare $currentOS "Linux"] == 0} { +} else { if {[regexp {Debug mode} [dversion]]} { # DEBUG mode # initial CPU_time for LINUX in DEBUG mode is 900 sec diff --git a/tests/bugs/moddata_3/bug25487_2 b/tests/bugs/moddata_3/bug25487_2 index c4bc26e3fb..17b300f55d 100644 --- a/tests/bugs/moddata_3/bug25487_2 +++ b/tests/bugs/moddata_3/bug25487_2 @@ -21,11 +21,8 @@ set chrono_info [dchrono perf_h show] regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time puts "Elapsed time is: $CPU_time" -# Check current OS -set currentOS $tcl_platform(os) - # Check prformance on Windows -if {[string compare $currentOS "Windows NT"] == 0} { +if { [checkplatform -windows] } { if {[regexp {Debug mode} [dversion]]} { # DEBUG mode # initial CPU_time for WINDOWS in DEBUG mode is 1208 ((549+55)*2) sec @@ -47,10 +44,7 @@ if {[string compare $currentOS "Windows NT"] == 0} { puts "Done!" } } -} - -# Check performance on Linux -if {[string compare $currentOS "Linux"] == 0} { +} else { if {[regexp {Debug mode} [dversion]]} { # DEBUG mode # initial CPU_time for LINUX in DEBUG mode is 1500 sec diff --git a/tests/bugs/vis/bug21091_3 b/tests/bugs/vis/bug21091_3 index dbfa696b48..b5dac67b80 100755 --- a/tests/bugs/vis/bug21091_3 +++ b/tests/bugs/vis/bug21091_3 @@ -22,10 +22,10 @@ set aFile ${imagedir}/${test_image}.pdf vexport ${aFile} PDF -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set refsize 144401 -} else { +if { [checkplatform -windows] } { set refsize 153993 +} else { + set refsize 144401 } if { [file exists ${aFile}] } { diff --git a/tests/bugs/vis/bug21091_4 b/tests/bugs/vis/bug21091_4 index bbe04d2ffb..8c51d4d45c 100755 --- a/tests/bugs/vis/bug21091_4 +++ b/tests/bugs/vis/bug21091_4 @@ -47,10 +47,10 @@ set aFile ${imagedir}/${test_image}.pdf vexport ${aFile} PDF -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set refsize 10107 -} else { +if { [checkplatform -windows] } { set refsize 10131 +} else { + set refsize 10107 } if { [file exists ${aFile}] } { diff --git a/tests/bugs/vis/bug21091_5 b/tests/bugs/vis/bug21091_5 index 71dba90a86..ec1974cdc8 100755 --- a/tests/bugs/vis/bug21091_5 +++ b/tests/bugs/vis/bug21091_5 @@ -47,10 +47,10 @@ set aFile ${imagedir}/${test_image}.ps vexport ${aFile} PS -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set refsize 10386 -} else { +if { [checkplatform -windows] } { set refsize 10410 +} else { + set refsize 10386 } if { [file exists ${aFile}] } { diff --git a/tests/bugs/vis/bug21091_6 b/tests/bugs/vis/bug21091_6 index 03718a4568..904238a810 100755 --- a/tests/bugs/vis/bug21091_6 +++ b/tests/bugs/vis/bug21091_6 @@ -46,10 +46,10 @@ set aFile ${imagedir}/${test_image}.eps vexport ${aFile} EPS -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set refsize 10330 -} else { +if { [checkplatform -windows] } { set refsize 10354 +} else { + set refsize 10330 } if { [file exists ${aFile}] } { diff --git a/tests/bugs/vis/bug21091_8 b/tests/bugs/vis/bug21091_8 index a9d91b7dc1..d22829d02e 100755 --- a/tests/bugs/vis/bug21091_8 +++ b/tests/bugs/vis/bug21091_8 @@ -47,10 +47,10 @@ set aFile ${imagedir}/${test_image}.svg vexport ${aFile} SVG -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set refsize 14207 -} else { +if { [checkplatform -windows] } { set refsize 14091 +} else { + set refsize 14207 } if { [file exists ${aFile}] } { diff --git a/tests/bugs/vis/bug21091_9 b/tests/bugs/vis/bug21091_9 index 3b41b1cb41..8eb7ddc38a 100755 --- a/tests/bugs/vis/bug21091_9 +++ b/tests/bugs/vis/bug21091_9 @@ -47,10 +47,10 @@ set aFile ${imagedir}/${test_image}.pgf vexport ${aFile} PGF -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set refsize 20438 -} else { +if { [checkplatform -windows] } { set refsize 20810 +} else { + set refsize 20438 } if { [file exists ${aFile}] } { diff --git a/tests/bugs/vis/bug22188 b/tests/bugs/vis/bug22188 index 3fded74fdc..88768391d4 100755 --- a/tests/bugs/vis/bug22188 +++ b/tests/bugs/vis/bug22188 @@ -20,10 +20,10 @@ vdisplay result vsetdispmode 1 vfit -if { [string compare $tcl_platform(platform) "windows"] == 0 } { - set good_tri 6114 - set good_nod 3080 - set good_defl 0.50050406431775729 +if { [checkplatform -windows] } { + set good_tri 6114 + set good_nod 3080 + set good_defl 0.50050406431775729 } else { set good_tri 6148 set good_nod 3097 diff --git a/tests/bugs/vis/bug232 b/tests/bugs/vis/bug232 index ff58877512..927850cebe 100755 --- a/tests/bugs/vis/bug232 +++ b/tests/bugs/vis/bug232 @@ -61,8 +61,7 @@ set result23 [regexp "$Yellow" [vreadpixel $x4 $y4 rgb]] set result24 [regexp "$Yellow" [vreadpixel $x5 $y5 rgb]] set result25 [regexp "$Yellow" [vreadpixel $x6 $y6 rgb]] -set env(os_type) $tcl_platform(platform) -if { [string compare $env(os_type) "windows"] != 0 } { +if { ![checkplatform -windows] } { set result31 [regexp "$Cyan" [vreadpixel $x2 $y2 rgb]] if { $result31 == 0 } { set IsFaulty 1 diff --git a/tests/bugs/vis/bug26424 b/tests/bugs/vis/bug26424 index 97ecdb01cb..cb51865a21 100644 --- a/tests/bugs/vis/bug26424 +++ b/tests/bugs/vis/bug26424 @@ -12,15 +12,12 @@ vclear vaxo vzbufftrihedron -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { - # Linux platform - set ok_color "GRAY85" -} else { +if { [checkplatform -windows] } { # Windows platform set ok_color "GRAY52" +} else { + # Linux platform + set ok_color "GRAY85" } set bug_info [vreadpixel 71 350 rgb name] diff --git a/tests/bugs/xde/bug22898 b/tests/bugs/xde/bug22898 index b1972c96ff..e6bbf4ff08 100644 --- a/tests/bugs/xde/bug22898 +++ b/tests/bugs/xde/bug22898 @@ -4,8 +4,7 @@ puts "TODO OCC24156 MacOS: Error: unsupported locale specification" # Just run multiple conversions of the shape to and from diferent formats and # check that the result is good shape with expected area -set anOS $tcl_platform(os) -if { ${anOS} == "Linux" } { +if { [checkplatform -linux] } { dlocale LC_ALL fr_FR } else { dlocale LC_ALL French diff --git a/tests/chamfer/data/complex/B9 b/tests/chamfer/data/complex/B9 index 3ce8ce73f5..b1b295ff86 100644 --- a/tests/chamfer/data/complex/B9 +++ b/tests/chamfer/data/complex/B9 @@ -7,10 +7,9 @@ dset SCALE 100 if { [string compare $command chamf_sequence] == 0 } { puts "TODO #22909 ALL: Error: The tests should be reviewed" puts "Error: The tests should be reviewed." - set env(os_type) $tcl_platform(platform) set nf 0 - if { [string compare ${env(os_type)} "windows"] != 0 } { + if { ![checkplatform -windows] } { if { [string compare $group dist_dist] == 0 } { set nf 2 } elseif { [string compare $group equal_dist] == 0 } { @@ -18,13 +17,13 @@ if { [string compare $command chamf_sequence] == 0 } { } } - if { [string compare ${env(os_type)} "windows"] == 0} { + if { [checkplatform -windows] } { if {[string compare $group dist_dist] == 0 || [string compare $group equal_dist] == 0 } { set nf 2 } } - if { [string compare ${env(os_type)} "MacOS"] == 0 } { + if { [checkplatform -osx] } { if { [string compare $group dist_dist] == 0 } { puts "TODO OCC24156 MacOS: chamfer is not done. compute of chamfer failed" set nf 8 @@ -39,7 +38,7 @@ if { [string compare $command chamf_sequence] == 0 } { } if { $nf != 0 } { - #puts "TODO OCC22909 $env(os_type):Faulty shapes in variables faulty_1 to faulty_$nf" + #puts "TODO OCC22909 [checkplatform]:Faulty shapes in variables faulty_1 to faulty_$nf" puts "TODO OCC22909 ALL:Faulty shapes in variables faulty_1 to faulty_" } } diff --git a/tests/demo/draw/getsource b/tests/demo/draw/getsource index 49cd13ac9b..9282696b40 100755 --- a/tests/demo/draw/getsource +++ b/tests/demo/draw/getsource @@ -1,8 +1,7 @@ # test for command getsource # check that path returned for command pload is as expected -set env(os_type) $tcl_platform(platform) -if { [string compare $env(os_type) "windows"] == 0 } { +if { [checkplatform -windows] } { set expected src/Draw/Draw_PloadCommands.cxx } else { set expected /src/Draw/Draw_PloadCommands.cxx diff --git a/tests/mesh/data/standard/G1 b/tests/mesh/data/standard/G1 index 5d66d3bbcf..974d163622 100755 --- a/tests/mesh/data/standard/G1 +++ b/tests/mesh/data/standard/G1 @@ -1,5 +1,4 @@ set TheFileName shading_055.brep -set env(os_type) $tcl_platform(os) if { [string compare $command "shading"] == 0 } { set nb 62 } @@ -11,4 +10,4 @@ if { [string compare $command "mesh"] == 0 } { } set bug_cross "OCC22687" -set nbcross($env(os_type)) $nb +set nbcross([checkplatform]) $nb diff --git a/tests/mesh/data/standard/U7 b/tests/mesh/data/standard/U7 index 4d8af61917..00637a9fd6 100755 --- a/tests/mesh/data/standard/U7 +++ b/tests/mesh/data/standard/U7 @@ -10,16 +10,16 @@ if { [string compare $command "shading"] == 0 } { set nbt 8 set nbl 8 set nbn 83 - set nbwithouttri($env(os_type)) $nbt - set nbfree($env(os_type)) $nbl - set nbfreenodes($env(os_type)) $nbn + set nbwithouttri([checkplatform]) $nbt + set nbfree([checkplatform]) $nbl + set nbfreenodes([checkplatform]) $nbn } else { set bug_withouttri "OCC23105" ##set nbt 14 set nbt 8 set nbn 60 set nbl 12 - set nbwithouttri($env(os_type)) $nbt - set nbfree($env(os_type)) $nbl - set nbfreenodes($env(os_type)) $nbn + set nbwithouttri([checkplatform]) $nbt + set nbfree([checkplatform]) $nbl + set nbfreenodes([checkplatform]) $nbn } diff --git a/tests/perf/fclasses/bug24947 b/tests/perf/fclasses/bug24947 index d7288cec5e..39bb04bee2 100644 --- a/tests/perf/fclasses/bug24947 +++ b/tests/perf/fclasses/bug24947 @@ -2,7 +2,7 @@ set libname TKSTEP -switch -nocase $env(os_type) { +switch -nocase [checkplatform] { windows {set libname ${libname}.dll} linux {set libname lib${libname}.so} macos {set libname lib${libname}.dylib} diff --git a/tests/perf/ncollection/A1 b/tests/perf/ncollection/A1 index 18acdf6b15..9c50924473 100644 --- a/tests/perf/ncollection/A1 +++ b/tests/perf/ncollection/A1 @@ -17,18 +17,7 @@ foreach line [split $info "\n"] { } lappend values "$diff_cl" -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set check_values { 1.2363286058767904 - 2.7537414143534 - 1.5596260162601621 - 3.937043746844462 - 1.2133020329576465 - 1.2164522569168656 - 1.2495457282327385 - 0.10352433841051313 - 0.45175659293697572 - } -} else { +if { [checkplatform -windows] } { set check_values { 1.383409071179103 5.1472531605899908 5.55719377028335395 @@ -40,18 +29,30 @@ if { [string compare $tcl_platform(platform) "windows"] != 0 } { 0.21983563611646603 } if { [regexp {64} [dversion]] } { - set check_values { 1.5 - 5.2 - 5.7 - 5.7 - 1.7 - 1.3 - 1.6 - 0.4 - 0.4 + set check_values { 1.5 + 5.2 + 5.7 + 5.7 + 1.7 + 1.3 + 1.6 + 0.4 + 0.4 + } + } +} else { + set check_values { 1.2363286058767904 + 2.7537414143534 + 1.5596260162601621 + 3.937043746844462 + 1.2133020329576465 + 1.2164522569168656 + 1.2495457282327385 + 0.10352433841051313 + 0.45175659293697572 } - } } + set index 0 foreach key $keys { set value [lindex $values $index] diff --git a/tests/perf/ncollection/A2 b/tests/perf/ncollection/A2 index e7286d0035..98bd0c6915 100644 --- a/tests/perf/ncollection/A2 +++ b/tests/perf/ncollection/A2 @@ -15,18 +15,18 @@ foreach line [split $info "\n"] { } } -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set check_values { 0.1540285 - 0.1286995 - 0.1607561 - 0.3624441 - } -} else { +if { [checkplatform -windows] } { set check_values { 0.018136771 0.008694706 0.019123649 0.784462745 } +} else { + set check_values { 0.1540285 + 0.1286995 + 0.1607561 + 0.3624441 + } } set index 0 diff --git a/tests/perf/ncollection/A3 b/tests/perf/ncollection/A3 index 8847bad490..fb45495fa3 100644 --- a/tests/perf/ncollection/A3 +++ b/tests/perf/ncollection/A3 @@ -15,18 +15,18 @@ foreach line [split $info "\n"] { } } -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set check_values { 0.1549615 - 0.1290805 - 0.1602191 - 0.3487175 - } -} else { +if { [checkplatform -windows] } { set check_values { 0.017762852 0.008435507 0.018746851 0.079263713 } +} else { + set check_values { 0.1549615 + 0.1290805 + 0.1602191 + 0.3487175 + } } set index 0 diff --git a/tests/xml/begin b/tests/xml/begin index 840942ae81..476f0676af 100755 --- a/tests/xml/begin +++ b/tests/xml/begin @@ -22,12 +22,11 @@ if { [info exists test_image ] == 0 } { set WorkDirectory $imagedir -set env(os_type) $tcl_platform(platform) -if { [regexp "indows" $env(os_type)] } { +if { [checkplatform -windows] } { if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} { - set Java "java" + set Java "java" } else { - puts "Warning: environment variable PATH doesn't contain path to Java" + puts "Warning: environment variable PATH doesn't contain path to Java" } } else { catch {set Java $env(JAVAHOME)/bin/java} -- 2.20.1