Artifacts Associated With Ticket 7abc1460c04b4688
Ticket change [1fc1cb25ab] (rid 261749) by serhiy.storchaka on 2026-11-16 09:57:55:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
Under Tk, <tt>cleanupTests</tt> exits so that a test file run as the main script (<tt>wish foo.test</tt>) does not wait in the event loop. But <tt>runAllTests</tt> also calls <tt>cleanupTests 1</tt> after the last test file, and when the all file is the main script, this exits too, with status 0, before <tt>runAllTests</tt> lists the test files that exited with errors and before it returns its result. So under Tk, <tt>if {[tcltest::runAllTests]} {exit 1}</tt> never exits with 1, and "Test files exiting with errors" is never printed. all.tcl: <pre> package require Tk package require tcltest tcltest::configure -testdir [file dirname [file normalize [info script]]] {*}$argv if {[tcltest::runAllTests]} { exit 1 } </pre> fail.test: <pre> package require tcltest namespace import tcltest::* test fail-1.1 {a failing test} -body {expr 1} -result 2 cleanupTests </pre> <tt>wish all.tcl</tt> prints <tt>Failed 1</tt> but exits with status 0, with Tcl 8.6.18 and with the current main, with <tt>-singleproc</tt> 0 and 1. This makes the CI of Tk report success when tests fail at startup. Suggested fix: do not exit in <tt>cleanupTests</tt> when it is called from <tt>runAllTests</tt>. At the end of <tt>runAllTests</tt>, where the exit is needed (under Tk, with the all file as the main script), exit with status 1 if there were failures or test file errors, and 0 otherwise; elsewhere return the result as documented. Scripts which do not check the result keep working, but such runs then end with a non-zero status when tests fail. - foundin initialized to: "8.6.18, 9.0.5, 9.1.0"
- is_private initialized to: "0"
- login: "serhiy.storchaka"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "serhiy.storchaka"
- subsystem initialized to: "34. tcltest Package"
- title initialized to:
tcltest: under Tk, runAllTests exits with status 0 before reporting errors
- type initialized to: "Bug"
Ticket change [f212efc2c3] (rid 261750) by serhiy.storchaka on 2026-11-16 09:58:21:
- icomment:
Tk ticket: [https://core.tcl-lang.org/tk/info/ead4782b08|ead4782b08], with a workaround in Tk branch [https://core.tcl-lang.org/tk/timeline?r=ci-test-exit-status|ci-test-exit-status].
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [51b6cc31ee] (rid 261753) by serhiy.storchaka on 2026-11-16 10:27:54:
- icomment:
Proposed fix in branch [/timeline?r=tcltest-runalltests-exit-status|tcltest-runalltests-exit-status].
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [c1dc0b184b] (rid 261974) by jan.nijtmans on 2026-11-20 15:42:50:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2461365.1547541665"
- closer changed to: "jan.nijtmans"
- comment changed to:
Under Tk, <tt>cleanupTests</tt> exits so that a test file run as the main script (<tt>wish foo.test</tt>) does not wait in the event loop. But <tt>runAllTests</tt> also calls <tt>cleanupTests 1</tt> after the last test file, and when the all file is the main script, this exits too, with status 0, before <tt>runAllTests</tt> lists the test files that exited with errors and before it returns its result. So under Tk, <tt>if {[tcltest::runAllTests]} {exit 1}</tt> never exits with 1, and "Test files exiting with errors" is never printed. all.tcl: <pre> package require Tk package require tcltest tcltest::configure -testdir [file dirname [file normalize [info script]]] {*}$argv if {[tcltest::runAllTests]} { exit 1 } </pre> fail.test: <pre> package require tcltest namespace import tcltest::* test fail-1.1 {a failing test} -body {expr 1} -result 2 cleanupTests </pre> <tt>wish all.tcl</tt> prints <tt>Failed 1</tt> but exits with status 0, with Tcl 8.6.18 and with the current main, with <tt>-singleproc</tt> 0 and 1. This makes the CI of Tk report success when tests fail at startup. Suggested fix: do not exit in <tt>cleanupTests</tt> when it is called from <tt>runAllTests</tt>. At the end of <tt>runAllTests</tt>, where the exit is needed (under Tk, with the all file as the main script), exit with status 1 if there were failures or test file errors, and 0 otherwise; elsewhere return the result as documented. Scripts which do not check the result keep working, but such runs then end with a non-zero status when tests fail. - icomment:
Merged to [fc10972b81621cc4|trunk], core-9-0-branch and core-8-6-branch Many thanks!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"