Ensure that the one-line running status output from testrunner.tcl does not

exceed the 80-char line width of a standard terminal.

FossilOrigin-Name: 1eae0f9ed3c4530d117a8efc4adaf0b2cc422083f0407830a1a6d2a5b970fa1a
This commit is contained in:
drh
2024-11-05 11:59:45 +00:00
parent 6d443b0d74
commit 2139c35da0
3 changed files with 21 additions and 27 deletions
+13 -19
View File
@@ -547,12 +547,15 @@ proc show_status {db cls} {
set srcdir [file dirname [file dirname $TRG(info_script)]]
set line "Running: $S(running) (max: $nJob)"
if {$S(running)>0 && $fin>10 && [string length $line]<69} {
if {$S(running)>0 && $fin>10} {
set tmleft [expr {($tm/$fin)*($totalw-$fin)}]
if {$tmleft<0.02*$tm} {
set tmleft [expr {$tm*0.02}]
}
append line " ETC [elapsetime $tmleft]"
set etc " ETC [elapsetime $tmleft]"
if {[string length $line]+[string length $etc]<80} {
append line $etc
}
}
puts [format %-79.79s $line]
if {$S(running)>0} {
@@ -1369,10 +1372,7 @@ proc script_input_ready {fd iJob jobid} {
set state "done"
set rc [catch { close $fd } msg]
if {$rc} {
if {[info exists TRG(reportlength)]} {
puts -nonewline "[string repeat " " $TRG(reportlength)]\r"
}
puts "FAILED: $job(displayname) ($iJob)"
puts [format %-79.79s "FAILED: $job(displayname) ($iJob)"]
set state "failed"
if {$TRG(stopOnError)} {
puts "OUTPUT: $O($iJob)"
@@ -1523,22 +1523,16 @@ proc progress_report {} {
lappend text "r$v(running,$j)"
}
}
set report "[elapsetime $tmms] [join $text { }]"
if {$wdone>0} {
set tmleft [expr {($tmms/$wdone)*($wtotal-$wdone)}]
append text " ETC [elapsetime $tmleft]"
}
if {[info exists TRG(reportlength)]} {
puts -nonewline "[string repeat " " $TRG(reportlength)]\r"
}
set report "[elapsetime $tmms] [join $text { }]"
set TRG(reportlength) [string length $report]
if {[string length $report]<100} {
puts -nonewline "$report\r"
flush stdout
} else {
puts $report
set etc " ETC [elapsetime $tmleft]"
if {[string length $report]+[string length $etc]<80} {
append report $etc
}
}
puts -nonewline [format %-79.79s $report]\r
flush stdout
}
after $TRG(reporttime) progress_report
}