"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "script/mtreview" between
modules-5.1.1.tar.bz2 and modules-5.2.0.tar.bz2

About: The Environment Modules package provides for the dynamic modification of a user’s environment via modulefiles.

mtreview  (modules-5.1.1.tar.bz2):mtreview  (modules-5.2.0.tar.bz2)
#!/usr/bin/env tclsh #!/usr/bin/env tclsh
# #
# MTREVIEW, review test suite log file # MTREVIEW, review test suite log file
# Copyright (C) 2019-2021 Xavier Delaruelle # Copyright (C) 2019-2022 Xavier Delaruelle
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or # the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
########################################################################## ##########################################################################
proc reportUsage {} {
puts "Usage: $::argv0 \[options\] testlogfile
Review test suite log file
Options:
-h, --help Show this help message and exit
Examples:
$::argv0 modules.log
$::argv0 install.log
$::argv0 lint.log"
}
proc sgr {sgrcode str} { proc sgr {sgrcode str} {
return "\033\[${sgrcode}m$str\033\[0m" return "\033\[${sgrcode}m$str\033\[0m"
} }
proc reportError {str} {
puts "[sgr {1;31} ERROR]: $str"
}
proc diffWithIcdiff {} { proc diffWithIcdiff {} {
if {![info exists ::diff_with_icdiff]} { if {![info exists ::diff_with_icdiff]} {
# use local installation of icdiff, check it operates correctly # use local installation of icdiff, check it operates correctly
set ::diff_with_icdiff [expr {[auto_execok ./icdiff] ne\ set ::diff_with_icdiff [expr {[auto_execok ./icdiff] ne\
{} && ![catch {exec ./icdiff --version}]}] {} && ![catch {exec ./icdiff --version}]}]
} }
return $::diff_with_icdiff return $::diff_with_icdiff
} }
proc diffWithDiff {} { proc diffWithDiff {} {
skipping to change at line 60 skipping to change at line 78
} }
} else { } else {
set cmdlist [list diff -u] set cmdlist [list diff -u]
if {![catch {exec diff --color=auto /dev/null /dev/null}]} { if {![catch {exec diff --color=auto /dev/null /dev/null}]} {
lappend cmdlist --color=auto lappend cmdlist --color=auto
} }
} }
return $cmdlist return $cmdlist
} }
set usage "Usage: $argv0 file # parse arguments
Review test suite log file" set hintmsg "\n Try '$argv0 --help' for more information."
if {$argc != 1} {
# parse command-line arguments reportError "Unexpected number of arguments$hintmsg"
set logfile [lindex $argv 0]
if {[llength $argv] == 0 || $logfile eq "-h" || $logfile eq "--help"} {
puts stderr $usage
exit 0
} elseif {[llength $argv] > 1} {
puts stderr $usage
exit 1 exit 1
} }
set arg [lindex $argv 0]
switch -glob -- $arg {
-h - --help {
reportUsage
exit 0
}
-* {
reportError "Invalid option '$arg'$hintmsg"
exit 1
}
default {
set logfile $arg
}
}
set fid [open $logfile r] set fid [open $logfile r]
set state {} set state {}
while {[gets $fid line] >= 0} { while {[gets $fid line] >= 0} {
switch -- $state { switch -- $state {
recres { recres {
##nagelfar ignore Unknown variable
if {$res ne {}} { if {$res ne {}} {
append res \n append res \n
} else { } else {
# trim first line # trim first line
set line [string range $line [string first ' $line] end] set line [string range $line [string first ' $line] end]
} }
append res $line append res $line
# end of obtained output? # end of obtained output?
if {[string range $line end-2 end] eq {'#>}} { if {[string range $line end-2 end] eq {'#>}} {
set state recexp set state recexp
# clean content # clean content
set res [string range $res 1 end-3] set res [string range $res 1 end-3]
} }
} }
recexp { recexp {
##nagelfar ignore Unknown variable
if {$exp ne {}} { if {$exp ne {}} {
append exp \n append exp \n
} else { } else {
# trim first line # trim first line
set line [string range $line [string first ' $line] end] set line [string range $line [string first ' $line] end]
} }
append exp $line append exp $line
# end of expected output? # end of expected output?
if {[string range $line end-2 end] eq {'#>}} { if {[string range $line end-2 end] eq {'#>}} {
# clean expecting content from regexp special char escaping # clean expecting content from regexp special char escaping
skipping to change at line 162 skipping to change at line 190
} }
} }
default { default {
if {![string compare -length 6 $line {FAIL: }]} { if {![string compare -length 6 $line {FAIL: }]} {
if {![info exists failure_found]} { if {![info exists failure_found]} {
set failure_found 1 set failure_found 1
} }
set state recres set state recres
set res {} set res {}
set exp {} set exp {}
##nagelfar ignore #3 Unknown variable
if {![info exists testfile_printed($testfile)]} { if {![info exists testfile_printed($testfile)]} {
set testfile_printed($testfile) 1 set testfile_printed($testfile) 1
puts [sgr {1;34;7} "=== $testfile ==="] puts [sgr {1;34;7} "=== $testfile ==="]
} }
puts [sgr 7 $line] puts [sgr 7 $line]
} elseif {![string compare -length 8 $line {Running }]} { } elseif {![string compare -length 8 $line {Running }]} {
set testfile [lindex [split $line] 1] set testfile [lindex [split $line] 1]
} elseif {[string match {*Summary ===} $line]} { } elseif {[string match {*Summary ===} $line]} {
set state sumup set state sumup
puts [sgr {1;33;7} {=== test summary ===}] puts [sgr {1;33;7} {=== test summary ===}]
 End of changes. 8 change blocks. 
11 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)