In testrunner.tcl: Better estimates for ETC (Estimated Time to Completion).

Show the ETC even for the single-line status reports.

FossilOrigin-Name: 2a2f5f4e378338951cc2030ffbacd678e6a6eab142e39ee632c61be42345b092
This commit is contained in:
drh 2024-10-21 22:45:59 +00:00
parent e6c2759acb
commit 0d7ede8d1c
3 changed files with 51 additions and 26 deletions

View File

@ -1,5 +1,5 @@
C Add\ssqlite3rebaser_...\sto\sthe\sAPI\ssymbols\saccepted\sby\sthe\s'checksymbols'\smakefile\starget. C In\stestrunner.tcl:\s\sBetter\sestimates\sfor\sETC\s(Estimated\sTime\sto\sCompletion).\nShow\sthe\sETC\seven\sfor\sthe\ssingle-line\sstatus\sreports.
D 2024-10-21T21:53:08.916 D 2024-10-21T22:45:59.158
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -1721,7 +1721,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 7b44f1a9b9a2de8112695b908afc21dd9a68cd2d44e84b73f1b27b53492c0d59 F test/tester.tcl 7b44f1a9b9a2de8112695b908afc21dd9a68cd2d44e84b73f1b27b53492c0d59
F test/testrunner.tcl 6215e11be403a16947bbb3b31cf4905b417155df242e4c5229f85bcda1c28f50 x F test/testrunner.tcl 1472b8c57c124c7eed934a2cbc955b0c0e0a948a4608546598195267bbd4b2fd x
F test/testrunner_data.tcl c7b3b911e44f7e8c01cc6bc7571e16115cdc2e4db46630bd2acd7a931a46380e F test/testrunner_data.tcl c7b3b911e44f7e8c01cc6bc7571e16115cdc2e4db46630bd2acd7a931a46380e
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502
@ -2219,8 +2219,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 03a9703e27c44437c39363d0baf82db4ebc94538a0f28411c85dda156f82636e P 0284590f212b2d6ac6516e60350e924a1c29602e8ac8b997d0a5fa488a2dc9c1
R 6ee4864245abc117fdbf4575b6f7f982 R 2ac47cb3cae83d7727a58a5f1336d6ea
U stephan U drh
Z 125137dcf74d7a719c01e300208c0b76 Z e2b1dfbad8a2776fb071a8b0b9eafb7e
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
0284590f212b2d6ac6516e60350e924a1c29602e8ac8b997d0a5fa488a2dc9c1 2a2f5f4e378338951cc2030ffbacd678e6a6eab142e39ee632c61be42345b092

View File

@ -324,6 +324,8 @@ set TRG(schema) {
/* Fields updated as jobs run */ /* Fields updated as jobs run */
starttime INTEGER, -- Start time (milliseconds since 1970) starttime INTEGER, -- Start time (milliseconds since 1970)
endtime INTEGER, -- End time endtime INTEGER, -- End time
span INTEGER, -- Total run-time in milliseconds
estwork INTEGER, -- Estimated amount of work
state TEXT CHECK( state IN ('','ready','running','done','failed','omit') ), state TEXT CHECK( state IN ('','ready','running','done','failed','omit') ),
ntest INT, -- Number of test cases run ntest INT, -- Number of test cases run
nerr INT, -- Number of errors reported nerr INT, -- Number of errors reported
@ -342,6 +344,13 @@ set TRG(schema) {
} }
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Estimated amount of work required by displaytype, relative to 'tcl'
#
set estwork(tcl) 1
set estwork(fuzz) 11
set estwork(bld) 56
set estwork(make) 97
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Check if this script is being invoked to run a single file. If so, # Check if this script is being invoked to run a single file. If so,
# run it. # run it.
@ -495,19 +504,21 @@ proc show_status {db cls} {
}] }]
set total 0 set total 0
foreach s {"" ready running done failed} { set S($s) 0 } foreach s {"" ready running done failed omit} { set S($s) 0; set W($s) 0; }
set workpending 0
$db eval { $db eval {
SELECT state, count(*) AS cnt FROM jobs GROUP BY 1 SELECT state, count(*) AS cnt, sum(estwork) AS ew FROM jobs GROUP BY 1
} { } {
incr S($state) $cnt incr S($state) $cnt
incr total $cnt incr W($state) $ew
incr totalw $ew
} }
set nt 0 set nt 0
set ne 0 set ne 0
$db eval { $db eval {
SELECT sum(ntest) AS nt, sum(nerr) AS ne FROM jobs HAVING nt>0 SELECT sum(ntest) AS nt, sum(nerr) AS ne FROM jobs HAVING nt>0
} break } break
set fin [expr $S(done)+$S(failed)] set fin [expr $W(done)+$W(failed)+$W(omit)]
if {$cmdline!=""} {set cmdline " $cmdline"} if {$cmdline!=""} {set cmdline " $cmdline"}
if {$cls} { if {$cls} {
@ -522,15 +533,12 @@ proc show_status {db cls} {
set srcdir [file dirname [file dirname $TRG(info_script)]] set srcdir [file dirname [file dirname $TRG(info_script)]]
set line "Running: $S(running) (max: $nJob)" set line "Running: $S(running) (max: $nJob)"
if {$S(running)>0 && $fin>100 && $fin>0.05*$total} { if {$S(running)>0 && $fin>10} {
# Only estimate the time remaining after completing at least 100 set tmleft [expr {($tm/$fin)*($totalw-$fin)}]
# jobs amounting to 10% of the total. Never estimate less than
# 2% of the total time used so far.
set tmleft [expr {($tm/$fin)*($total-$fin)}]
if {$tmleft<0.02*$tm} { if {$tmleft<0.02*$tm} {
set tmleft [expr {$tm*0.02}] set tmleft [expr {$tm*0.02}]
} }
append line " est time left [elapsetime $tmleft]" append line " ETC [elapsetime $tmleft]"
} }
puts [format %-79.79s $line] puts [format %-79.79s $line]
if {$S(running)>0} { if {$S(running)>0} {
@ -914,6 +922,7 @@ proc r_get_next_job {iJob} {
# Returns the jobid value for the new job. # Returns the jobid value for the new job.
# #
proc add_job {args} { proc add_job {args} {
global estwork
set options { set options {
-displaytype -displayname -build -dirname -displaytype -displayname -build -dirname
@ -938,25 +947,29 @@ proc add_job {args} {
set state "" set state ""
if {$A(-depid)==""} { set state ready } if {$A(-depid)==""} { set state ready }
set type $A(-displaytype)
set ew $estwork($type)
trdb eval { trdb eval {
INSERT INTO jobs( INSERT INTO jobs(
displaytype, displayname, build, dirname, cmd, depid, priority, displaytype, displayname, build, dirname, cmd, depid, priority, estwork,
state state
) VALUES ( ) VALUES (
$A(-displaytype), $type,
$A(-displayname), $A(-displayname),
$A(-build), $A(-build),
$A(-dirname), $A(-dirname),
$A(-cmd), $A(-cmd),
$A(-depid), $A(-depid),
$A(-priority), $A(-priority),
$ew,
$state $state
) )
} }
trdb last_insert_rowid trdb last_insert_rowid
} }
# Argument $build is either an empty string, or else a list of length 3 # Argument $build is either an empty string, or else a list of length 3
# describing the job to build testfixture. In the usual form: # describing the job to build testfixture. In the usual form:
@ -1283,8 +1296,8 @@ proc make_new_testset {} {
trdb eval { REPLACE INTO config VALUES('start', $tm ); } trdb eval { REPLACE INTO config VALUES('start', $tm ); }
add_jobs_from_cmdline $TRG(patternlist) add_jobs_from_cmdline $TRG(patternlist)
}
}
} }
proc mark_job_as_finished {jobid output state endtm} { proc mark_job_as_finished {jobid output state endtm} {
@ -1309,10 +1322,12 @@ proc mark_job_as_finished {jobid output state endtm} {
if {[info exists pltfm]} {set pltfm [string trim $pltfm]} if {[info exists pltfm]} {set pltfm [string trim $pltfm]}
trdb eval { trdb eval {
UPDATE jobs UPDATE jobs
SET output=$output, state=$state, endtime=$endtm, SET output=$output, state=$state, endtime=$endtm, span=$endtm-starttime,
ntest=$ntest, nerr=$nerr, svers=$svers, pltfm=$pltfm ntest=$ntest, nerr=$nerr, svers=$svers, pltfm=$pltfm
WHERE jobid=$jobid; WHERE jobid=$jobid;
UPDATE jobs SET state=$childstate WHERE depid=$jobid; UPDATE jobs SET state=$childstate WHERE depid=$jobid;
UPDATE config SET value=value+$nerr WHERE name='nfail';
UPDATE config SET value=value+$ntest WHERE name='ntest';
} }
} }
} }
@ -1460,17 +1475,23 @@ proc progress_report {} {
show_status trdb 1 show_status trdb 1
} }
} else { } else {
set tm [expr [clock_milliseconds] - $TRG(starttime)] set tmms [expr [clock_milliseconds] - $TRG(starttime)]
set tm [format "%d" [expr int($tm/1000.0 + 0.5)]] set tm [format "%d" [expr int($tmms/1000.0 + 0.5)]]
set wtotal 0
set wdone 0
r_write_db { r_write_db {
trdb eval { trdb eval {
SELECT displaytype, state, count(*) AS cnt SELECT displaytype, state, count(*) AS cnt, sum(estwork) AS ew
FROM jobs FROM jobs
GROUP BY 1, 2 GROUP BY 1, 2
} { } {
set v($state,$displaytype) $cnt set v($state,$displaytype) $cnt
incr t($displaytype) $cnt incr t($displaytype) $cnt
incr wtotal $ew
if {$state=="done" || $state=="failed" || $state=="omit"} {
incr wdone $ew
}
} }
} }
@ -1486,11 +1507,15 @@ proc progress_report {} {
lappend text "r$v(running,$j)" lappend text "r$v(running,$j)"
} }
} }
if {$wdone>0} {
set tmleft [expr {($tmms/$wdone)*($wtotal-$wdone)}]
append text " ETC [elapsetime $tmleft]"
}
if {[info exists TRG(reportlength)]} { if {[info exists TRG(reportlength)]} {
puts -nonewline "[string repeat " " $TRG(reportlength)]\r" puts -nonewline "[string repeat " " $TRG(reportlength)]\r"
} }
set report "${tm} [join $text { }]" set report "[elapsetime $tmms] [join $text { }]"
set TRG(reportlength) [string length $report] set TRG(reportlength) [string length $report]
if {[string length $report]<100} { if {[string length $report]<100} {
puts -nonewline "$report\r" puts -nonewline "$report\r"