From: drh <> Date: Fri, 2 Aug 2024 17:36:34 +0000 (+0000) Subject: Add the "-d SECS" option to the "status" command of testrunner.tcl X-Git-Tag: version-3.47.0~266 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b2d590c5f918be381b9aeb3a4a3dd0b60908b808;p=thirdparty%2Fsqlite.git Add the "-d SECS" option to the "status" command of testrunner.tcl FossilOrigin-Name: 2151ea31632f7aa363c7d4b7205e1174a45d710783a8efad8176049d356cfc70 --- diff --git a/manifest b/manifest index 0e8de61d1a..d42c57accb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C New\sMSVC\smakefile\stargets:\s\stclextension,\stclextension-install,\ntclextension-uninstall,\sand\stclextension-list. -D 2024-08-02T15:28:40.391 +C Add\sthe\s"-d\sSECS"\soption\sto\sthe\s"status"\scommand\sof\stestrunner.tcl +D 2024-08-02T17:36:34.415 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1705,7 +1705,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 640106bf8f7785d0ac67cda2837577eb9f2d936033bacedf9e705ca5451958ef -F test/testrunner.tcl f6ac1a55ce4c9278cf8c4dbaed1facd347c9b80acae5d32511c3bf3e529a4817 +F test/testrunner.tcl 8a32439556e7ebba144e30c46cca95a3780647bd4f0101f3d43fbf92ef86414d F test/testrunner_data.tcl c5ae2b1f9a99210b0600d002fb3af1fee350997cee9416551e83b93501360ebf F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5e7c94645632b736e805428ff4c135666ab525fac99c29c12d5127b06f39fc6e -R 34f8aa4c5bd786ba6f617a118e3aad0d +P c38734f57509c50dd28029738dd602600950703b773d9b7b60fdb1dcb06e8fd8 +R 83c1979a453bc44130a53ce766cc177f U drh -Z 99d8311f9a3fa0ec204446f79bbc573f +Z 6d452c8f357818d9c3aa4547edb14d11 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e3145013e7..304debfec0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c38734f57509c50dd28029738dd602600950703b773d9b7b60fdb1dcb06e8fd8 +2151ea31632f7aa363c7d4b7205e1174a45d710783a8efad8176049d356cfc70 diff --git a/test/testrunner.tcl b/test/testrunner.tcl index aeb015865d..80cf3ff9b9 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -58,7 +58,7 @@ Usage: $a0 help $a0 njob ?NJOB? $a0 script ?-msvc? CONFIG - $a0 status + $a0 status ?-d SECS? where SWITCHES are: --buildonly Build test exes but do not run tests @@ -101,8 +101,9 @@ with the specified permutation. The "status" and "njob" commands are designed to be run from the same directory as a running testrunner.tcl script that is running tests. The "status" command prints a report describing the current state and progress -of the tests. The "njob" command may be used to query or modify the number -of sub-processes the test script uses to run tests. +of the tests. Use the "-d N" option to have the status display clear the +screen and repeat every N seconds. The "njob" command may be used to query +or modify the number of sub-processes the test script uses to run tests. The "script" command outputs the script used to build a configuration. Add the "-msvc" option for a Windows-compatible script. For a list of @@ -390,10 +391,24 @@ if {[string compare -nocase script [lindex $argv 0]]==0} { #-------------------------------------------------------------------------- # Check if this is the "status" command: # -if {[llength $argv]==1 +if {[llength $argv]>=1 && [string compare -nocase status [lindex $argv 0]]==0 } { - + set delay 0 + for {set ii 1} {$ii<[llength $argv]} {incr ii} { + set a0 [lindex $argv $ii] + if {$a0=="-d" && $ii+1<[llength $argv]} { + incr ii + set delay [lindex $argv $ii] + if {![string is integer -strict $delay]} { + puts "Argument to -d should be an integer" + exit 1 + } + } else { + puts "unknown option: \"$a0\"" + exit 1 + } + } proc display_job {jobdict {tm ""}} { array set job $jobdict @@ -404,71 +419,100 @@ if {[llength $argv]==1 puts " $dfname $dtm" } + # The clreol proc returns the VT100 escape code for clear-to-end-of-line, + # if delay>0. If we are only painting the status once, it returns an + # empty string. + # + if {$delay>0} { + proc clreol {} {return ""} + } else { + proc clreol {} {return \033K} + } + if {![file readable $TRG(dbname)]} { puts "Database missing: $TRG(dbname)" exit } sqlite3 mydb $TRG(dbname) mydb timeout 2000 - mydb eval BEGIN - - if {[catch { - set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }] - set nJob [mydb one { SELECT value FROM config WHERE name='njob' }] - } msg]} { - puts "Cannot read database: $TRG(dbname)" - mydb close - exit - } - - set now [clock_milliseconds] - set tm [mydb one { - SELECT - COALESCE((SELECT value FROM config WHERE name='end'), $now) - - (SELECT value FROM config WHERE name='start') - }] - - set total 0 - foreach s {"" ready running done failed} { set S($s) 0 } - mydb eval { - SELECT state, count(*) AS cnt FROM jobs GROUP BY 1 - } { - incr S($state) $cnt - incr total $cnt - } - set fin [expr $S(done)+$S(failed)] - if {$cmdline!=""} {set cmdline " $cmdline"} - set f "" - if {$S(failed)>0} { - set f "$S(failed) FAILED, " - } - puts "Command line: \[testrunner.tcl$cmdline\]" - puts "Jobs: $nJob" - puts "Summary: ${tm}ms, ($fin/$total) finished, ${f}$S(running) running" - - set srcdir [file dirname [file dirname $TRG(info_script)]] - if {$S(running)>0} { - puts "Running: " - mydb eval { - SELECT * FROM jobs WHERE state='running' ORDER BY starttime - } job { - display_job [array get job] $now + # Clear the whole screen initially. + # + if {$delay>0} {puts -nonewline "\033\[2J"} + + while {1} { + mydb eval BEGIN + if {[catch { + set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }] + set nJob [mydb one { SELECT value FROM config WHERE name='njob' }] + } msg]} { + puts "Cannot read database: $TRG(dbname)" + mydb close + exit } - } - if {$S(failed)>0} { - puts "Failures: " + + set now [clock_milliseconds] + set tm [mydb one { + SELECT + COALESCE((SELECT value FROM config WHERE name='end'), $now) - + (SELECT value FROM config WHERE name='start') + }] + + set total 0 + foreach s {"" ready running done failed} { set S($s) 0 } mydb eval { - SELECT * FROM jobs WHERE state='failed' ORDER BY starttime - } job { - display_job [array get job] + SELECT state, count(*) AS cnt FROM jobs GROUP BY 1 + } { + incr S($state) $cnt + incr total $cnt + } + set fin [expr $S(done)+$S(failed)] + if {$cmdline!=""} {set cmdline " $cmdline"} + + if {$delay>0} { + # Move the cursor to the top-left corner. Each iteration will simply + # overwrite. + puts -nonewline "\033\[H" + } + set f "" + if {$S(failed)>0} { + set f "$S(failed) FAILED, " + } + puts "Command line: \[testrunner.tcl$cmdline\]" + puts "Jobs: $nJob" + puts "Summary: ${tm}ms, ($fin/$total) finished,\ + ${f}$S(running) running " + + set srcdir [file dirname [file dirname $TRG(info_script)]] + if {$S(running)>0} { + puts "Running: " + mydb eval { + SELECT * FROM jobs WHERE state='running' ORDER BY starttime + } job { + display_job [array get job] $now + } + } + if {$S(failed)>0} { + puts "Failures: " + mydb eval { + SELECT * FROM jobs WHERE state='failed' ORDER BY starttime + } job { + display_job [array get job] + } + set nOmit [mydb one {SELECT count(*) FROM jobs WHERE state='omit'}] + if {$nOmit} { + puts "$nOmit jobs omitted due to failures[clreol]" + } } - set nOmit [mydb one {SELECT count(*) FROM jobs WHERE state='omit'}] - if {$nOmit} { - puts "$nOmit jobs omitted due to failures" + if {$delay>0} { + # Clear everything else to the bottom of the screen + puts -nonewline "\033\[J" + flush stdout } + mydb eval COMMIT + if {$delay<=0} break + after [expr {$delay*1000}] } - mydb close exit }