mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -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} {
|
||||
|
Reference in New Issue
Block a user