From 4659ec34c1c5ffceb64ce486502acb92f14688eb Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 13 Mar 2024 13:09:58 +0000 Subject: [PATCH] Add the --explain option to testrunner.tcl. FossilOrigin-Name: f0c9eb0326f189fe5ebbee83532ac2c413e91c6a8e9d5b93aa6170cba66fdd22 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/testrunner.tcl | 45 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index a67db52106..683882b1c4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improve\sone\sof\sthe\serror\smessages\sfrom\stestrunner.tcl. -D 2024-03-13T11:46:23.016 +C Add\sthe\s--explain\soption\sto\stestrunner.tcl. +D 2024-03-13T13:09:58.491 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1687,7 +1687,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl fe617b88c7eb08bdf983d2aaa31c20fbf439eee7b8e0d61ca636fcd0c305bbbf -F test/testrunner.tcl cdbfe4b24952a411fcc2cb48331d10ece650b6a3108bd05ae890304cfed93fed +F test/testrunner.tcl f172c5141b890acfc223884071f90176031e3a059218280952f536eb2c851ee8 F test/testrunner_data.tcl 2f94974e5e3a56af880be72f7a7fd239aa9d4ecf978625435fcc698319c927fa F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2177,8 +2177,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3128b98d2656c7f23f6071c173f96329c7bdc49cd641050fbb7b105b810ba7c7 -R b30ace34515f0911b2a0db585efbc51d +P 233155c174575fa99b34030c1936bc2b04489417f4d5223f18cdb3c8fc274a56 +R 73b7b3b0e43269248a0a7f9b5744d286 U drh -Z 4fb6ed0f5ce1c12c4ccfa1c6192fc974 +Z bad41bec7a1c5ea3149d7911ab3a6c38 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7d5581e36c..6ccc32a8fd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -233155c174575fa99b34030c1936bc2b04489417f4d5223f18cdb3c8fc274a56 \ No newline at end of file +f0c9eb0326f189fe5ebbee83532ac2c413e91c6a8e9d5b93aa6170cba66fdd22 \ No newline at end of file diff --git a/test/testrunner.tcl b/test/testrunner.tcl index 76a73a6ba7..96494dc3a5 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -62,6 +62,7 @@ Usage: where SWITCHES are: --buildonly --dryrun + --explain --jobs NUMBER-OF-JOBS --zipvfs ZIPVFS-SOURCE-DIR @@ -166,6 +167,7 @@ set TRG(fuzztest) 0 ;# is the fuzztest option present. set TRG(zipvfs) "" ;# -zipvfs option, if any set TRG(buildonly) 0 ;# True if --buildonly option set TRG(dryrun) 0 ;# True if --dryrun option +set TRG(explain) 0 ;# True for the --explain option switch -nocase -glob -- $tcl_platform(os) { *darwin* { @@ -460,6 +462,8 @@ for {set ii 0} {$ii < [llength $argv]} {incr ii} { set TRG(buildonly) 1 } elseif {($n>2 && [string match "$a*" --dryrun]) || $a=="-d"} { set TRG(dryrun) 1 + } elseif {($n>2 && [string match "$a*" --explain]) || $a=="-e"} { + set TRG(explain) 1 } else { usage } @@ -1177,15 +1181,42 @@ proc handle_buildonly {} { } } +# Handle the --explain option. Provide a human-readable +# explanation of all the tests that are in the trdb database jobs +# table. +# +proc explain_layer {indent depid} { + global TRG + if {$TRG(buildonly)} { + set showtests 0 + } else { + set showtests 1 + } + trdb eval {SELECT jobid, displayname, displaytype, dirname + FROM jobs WHERE depid=$depid ORDER BY displayname} { + if {$displaytype=="bld"} { + puts "${indent}$displayname in $dirname" + explain_layer "${indent} " $jobid + } elseif {$showtests} { + puts "${indent}[lindex $displayname end]" + } + } +} +proc explain_tests {} { + explain_layer "" "" +} + sqlite3 trdb $TRG(dbname) trdb timeout $TRG(timeout) set tm [lindex [time { make_new_testset }] 0] -if {$TRG(nJob)>1} { - puts "splitting work across $TRG(nJob) jobs" +if {$TRG(explain)} { + explain_tests +} else { + if {$TRG(nJob)>1} { + puts "splitting work across $TRG(nJob) jobs" + } + puts "built testset in [expr $tm/1000]ms.." + handle_buildonly + run_testset } -puts "built testset in [expr $tm/1000]ms.." - -handle_buildonly -run_testset trdb close -#puts [pwd]