From e137e97af6af04d1a29fdcec339d1ff3094e0b3d Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 4 Sep 2026 14:02:05 +0000 Subject: [PATCH] Improved orderly-shutdown in testrunner. Windows lets running jobs complete. Unix just invokes exit and lets the OS deal with cleaning up the mess. FossilOrigin-Name: ce822e8dc137128a6c495600205c6659a9cd2ba6ba188d86567ed97c04b7aeea --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/testrunner.tcl | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 526ba29d94..517eef6fa8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sintentional\serror\sused\sfor\stesting\sthat\swas\saccidently\sleft\sin\nthe\sprevious\scheck-in. -D 2026-09-04T13:43:43.352 +C Improved\sorderly-shutdown\sin\stestrunner.\s\sWindows\slets\srunning\sjobs\scomplete.\nUnix\sjust\sinvokes\sexit\sand\slets\sthe\sOS\sdeal\swith\scleaning\sup\sthe\smess. +D 2026-09-04T14:02:05.724 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -1735,7 +1735,7 @@ F test/temptrigfault.tes fc5918e64f3867156fefe7cfca9d8e1f495134a5229b2b511b0dc11 F test/temptrigger.test a00f258ed8d21a0e8fd4f322f15e8cfb5cef2e43655670e07a753e3fb4769d61 F test/tester.tcl dfd8dd05b54bc493a8db6cc1263ee364c36e3c27fab258dad7305cd79b948f3f F test/testloadext.c 862b848783eaed9985fbce46c65cd214664376b549fae252b364d5d1ef350a27 -F test/testrunner.tcl 08978289eafd01ffb60e06935ed138bba0660cec7bceb5201438e4f4afe01778 x +F test/testrunner.tcl c63207535fc86a438a1a5ffa7af497a95dd45df38ebd3fa27adf85defddad2c6 x F test/testrunner_data.tcl 72ffc35e17dc332af3114faecc03109a91dd5ba8ef239d1879d15b7139df46cf F test/testrunner_estwork.tcl 81e2ae10238f50540f42fbf2d94913052a99bfb494b69e546506323f195dcff9 F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 @@ -2220,8 +2220,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 0fba9b52b41a5fade0d162c947712669653c4619c89a79800017703e978d8a24 -R 787be7dd912ce8812e04b649bb0889b2 +P 87f9d70d9e3fae2eda2650d9f58fd587c5f7b9cf7f7d13d47ebd11053ce63a25 +R 2cae4b63cc958fc487a5983b3073ffa6 U drh -Z a7d4b0cc9e94085c2ca36d2eb550ffb8 +Z 53a3653e3b89438fe0d741edc60bc9ac # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dd8295232d..51674de285 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -87f9d70d9e3fae2eda2650d9f58fd587c5f7b9cf7f7d13d47ebd11053ce63a25 +ce822e8dc137128a6c495600205c6659a9cd2ba6ba188d86567ed97c04b7aeea diff --git a/test/testrunner.tcl b/test/testrunner.tcl index 23336409f2..11f125f79e 100755 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -1847,12 +1847,24 @@ proc mark_job_as_finished {jobid output state endtm} { } } -# Stop scheduling new jobs +# We want to stop running tests. Do this in an orderly way that +# avoids confusing Windows. (On unix we just invoke "exit 1".) # proc orderly_shutdown {} { + global tcl_platform + if {$tcl_platform(platform) ne "windows"} { + # Non-Windows platform can just call exit and the OS stops everything + # for us automatically. + exit 1 + } + + # Only windows reaches this point. Mark pending jobs as 'halt' to prevent + # them from being scheduled. Let running jobs continue to completion. + # set n [trdb one {SELECT count(*) FROM jobs WHERE state='running'}] trdb eval {UPDATE jobs SET state='halt' WHERE state in ('ready','')} - if {$n>0} { + if {$n>1} { + incr n -1 puts "Deferred shutdown: Waiting on $n running tasks to complete." } } @@ -1913,7 +1925,6 @@ proc script_input_ready {fd iJob jobid} { append O($iJob) "$line\n" } } - } proc dirname {ii} {