Skip to content
Tcl Source Code History Of Ticket 7abc1460c0
Login

History Of Ticket 7abc1460c0

Artifacts Associated With Ticket 7abc1460c0

  1. Ticket change [1fc1cb25ab] (rid 261749) by serhiy.storchaka on 2026-11-16 09:57:55:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. 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.
      
    5. foundin initialized to: "8.6.18, 9.0.5, 9.1.0"
    6. is_private initialized to: "0"
    7. login: "serhiy.storchaka"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "serhiy.storchaka"
    13. subsystem initialized to: "34. tcltest Package"
    14. title initialized to:
      tcltest: under Tk, runAllTests exits with status 0 before reporting errors
      
    15. type initialized to: "Bug"
  2. Ticket change [f212efc2c3] (rid 261750) by serhiy.storchaka on 2026-11-16 09:58:21:

    1. 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].
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [51b6cc31ee] (rid 261753) by serhiy.storchaka on 2026-11-16 10:27:54:

    1. icomment:
      Proposed fix in branch [/timeline?r=tcltest-runalltests-exit-status|tcltest-runalltests-exit-status].
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  4. Ticket change [c1dc0b184b] (rid 261974) by jan.nijtmans on 2026-11-20 15:42:50:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2461365.1547541665"
    3. closer changed to: "jan.nijtmans"
    4. 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.
      
    5. icomment:
      Merged to [fc10972b81621cc4|trunk], core-9-0-branch and core-8-6-branch
      
      Many thanks!
      
    6. login: "jan.nijtmans"
    7. mimetype: "text/x-fossil-wiki"
    8. resolution changed to: "Fixed"
    9. status changed to: "Closed"