Artifacts Associated With Ticket 2794560fffffffff
Ticket change [a936547326] (rid 99118) by dgp on 2009-05-20 20:11:39:
- assignee initialized to: "dgp"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Request from Larry McVoy posted to TCLCORE: In our tree we would like to include a subset of the tcl tests in our normal builds and have it fail the build if the tests do not pass. This patch accomplishes that for a subset or for all tests. ===== library/tcltest/tcltest.tcl 1.105 vs edited ===== --- 1.105/library/tcltest/tcltest.tcl 2008-02-11 09:34:32 -08:00 +++ edited/library/tcltest/tcltest.tcl 2009-05-12 14:13:10 -07:00 @@ -2735,6 +2735,7 @@ proc tcltest::runAllTests { {shell ""} } set timeCmd {clock format [clock seconds]} puts [outputChannel] "Tests began at [eval $timeCmd]" + set exit_status 0 # Run each of the specified tests foreach file [lsort [GetMatchingFiles]] { @@ -2772,6 +2773,7 @@ proc tcltest::runAllTests { {shell ""} } } if {$Failed > 0} { lappend failFiles $testFile + set exit_status 1 } } elseif {[regexp [join { {^Number of tests skipped } @@ -2799,6 +2801,7 @@ proc tcltest::runAllTests { {shell ""} } puts [outputChannel] "\nTests ended at [eval $timeCmd]" cleanupTests 1 if {[info exists testFileFailures]} { + set exit_status 1 puts [outputChannel] "\nTest files exiting with errors: \n" foreach file $testFileFailures { puts [outputChannel] " [file tail $file]\n" @@ -2818,7 +2821,7 @@ proc tcltest::runAllTests { {shell ""} } puts [outputChannel] "" puts [outputChannel] [string repeat ~ 44] } - return + return $exit_status } ##################################################################### ===== tests/all.tcl 1.18 vs edited ===== --- 1.18/tests/all.tcl 2006-11-02 16:34:52 -08:00 +++ edited/tests/all.tcl 2009-05-12 14:05:08 -07:00 @@ -16,4 +16,4 @@ package require Tcl 8.5 package require tcltest 2.2 namespace import tcltest::* configure {*}$argv -testdir [file dir [info script]] -runAllTests +exit [runAllTests] - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "34. tcltest Package"
- title initialized to:
non-empty return from [runAllTests] - indicate status
- type initialized to: "RFE"
Ticket change [afef946dc1] (rid 97904) by nijtmans on 2009-05-25 15:30:16:
- icomment:
Patch looks fine to me. Seconded.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [49cb69e3fc] (rid 100102) by dgp on 2009-05-26 06:08:04:
- icomment:
I agree it's a step in the right direction. I logged it here for a chance to tweak it just a big before adopting it.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [ae4ebe8f6c] (rid 101623) by eriklns on 2013-01-19 21:12:31:
- icomment:
I agree with the need for [runAllTests] returning information regarding succes/failure. I supply a patch that improves upon the previous patch as follows: Besides failed tests, the new patch additionally takes into account any test file failures. It differentiates between the two types of failure with the sign of the numeric result. (I didn't find the option "attach a file" to this issue tracker. Therefore, like Larry McVoy, I just copy the text of the patch into this comment:) --- tcltest.tcl.orig2013-01-19 14:01:28.000000000 +0100 +++ tcltest.tcl2013-01-19 14:08:58.000000000 +0100 @@ -2833,6 +2833,21 @@ } } + # Prepare a result, indicating whether all is well + # (i.e. no test file failures and no failed tests). + # + # The result is a single integer, where: + # - a negative number indicates the number of test file failures + # (ignoring the number of failed tests). + # - a positive number indicates the number of failed tests, + # given zero test file failures. + # - zero indicates no failures at all + # + if {![info exists testFileFailures] || + ![set result [llength $testFileFailures]]} { + set result $numTests(Failed) + } + # cleanup puts [outputChannel] "\nTests ended at [eval $timeCmd]" cleanupTests 1 @@ -2856,7 +2871,7 @@ puts [outputChannel] "" puts [outputChannel] [string repeat ~ 44] } - return + return $result } ##################################################################### - login: "eriklns"
- mimetype: "text/plain"
- username: "eriklns"
- icomment:
Ticket change [07fa2a48ce] (rid 89491) by eriklns on 2013-01-19 21:18:12:
- icomment:
Hmm (dissatisfaction): The copy/paste doesn't preserve the exact diff information. If someone tells me how/where to post the patch *file*, Ill be happy to do so. Additional info: the supplied patch was made against tcltest.tcl 2.3.5 (latest version I found in the Fossil repo today).
- login: "eriklns"
- mimetype: "text/plain"
- username: "eriklns"
- icomment:
Ticket change [e415339a7d] (rid 87902) by eriklns on 2013-01-19 23:13:44:
- icomment:
Oh, and of course true negative values are achieved by using a minus sign. Duh! --- tcltest.tcl.orig2013-01-19 14:01:28.000000000 +0100 +++ tcltest.tcl2013-01-19 17:10:04.000000000 +0100 @@ -2833,6 +2833,21 @@ } } + # Prepare a result, indicating whether all is well + # (i.e. no test file failures and no failed tests). + # + # The result is a single integer, where: + # - a negative number indicates the number of test file failures + # (ignoring the number of failed tests). + # - a positive number indicates the number of failed tests, + # given zero test file failures. + # - zero indicates no failures at all + # + if {![info exists testFileFailures] || + ![set result -[llength $testFileFailures]]} { + set result $numTests(Failed) + } + # cleanup puts [outputChannel] "\nTests ended at [eval $timeCmd]" cleanupTests 1 @@ -2856,7 +2871,7 @@ puts [outputChannel] "" puts [outputChannel] [string repeat ~ 44] } - return + return $result } ##################################################################### - login: "eriklns"
- mimetype: "text/plain"
- username: "eriklns"
- icomment:
Ticket change [3adf4e9e49] (rid 167018) by fvogel on 2018-10-29 22:03:57:
- closer changed to: "nobody"
- comment changed to:
Request from Larry McVoy posted to TCLCORE: In our tree we would like to include a subset of the tcl tests in our normal builds and have it fail the build if the tests do not pass. This patch accomplishes that for a subset or for all tests. ===== library/tcltest/tcltest.tcl 1.105 vs edited ===== --- 1.105/library/tcltest/tcltest.tcl 2008-02-11 09:34:32 -08:00 +++ edited/library/tcltest/tcltest.tcl 2009-05-12 14:13:10 -07:00 @@ -2735,6 +2735,7 @@ proc tcltest::runAllTests { {shell ""} } set timeCmd {clock format [clock seconds]} puts [outputChannel] "Tests began at [eval $timeCmd]" + set exit_status 0 # Run each of the specified tests foreach file [lsort [GetMatchingFiles]] { @@ -2772,6 +2773,7 @@ proc tcltest::runAllTests { {shell ""} } } if {$Failed > 0} { lappend failFiles $testFile + set exit_status 1 } } elseif {[regexp [join { {^Number of tests skipped } @@ -2799,6 +2801,7 @@ proc tcltest::runAllTests { {shell ""} } puts [outputChannel] "\nTests ended at [eval $timeCmd]" cleanupTests 1 if {[info exists testFileFailures]} { + set exit_status 1 puts [outputChannel] "\nTest files exiting with errors: \n" foreach file $testFileFailures { puts [outputChannel] " [file tail $file]\n" @@ -2818,7 +2821,7 @@ proc tcltest::runAllTests { {shell ""} } puts [outputChannel] "" puts [outputChannel] [string repeat ~ 44] } - return + return $exit_status } ##################################################################### ===== tests/all.tcl 1.18 vs edited ===== --- 1.18/tests/all.tcl 2006-11-02 16:34:52 -08:00 +++ edited/tests/all.tcl 2009-05-12 14:05:08 -07:00 @@ -16,4 +16,4 @@ package require Tcl 8.5 package require tcltest 2.2 namespace import tcltest::* configure {*}$argv -testdir [file dir [info script]] -runAllTests +exit [runAllTests] - icomment: "Superseded by TIP #425, isn't it?"
- login: "fvogel"
- mimetype: "text/plain"
- severity changed to: "Minor"
Ticket change [cfe21548a9] (rid 167019) by fvogel on 2018-10-29 22:04:19:
- icomment: "Sorry: superseded by TIP #525 I think."
- login: "fvogel"
- mimetype: "text/plain"
Ticket change [2f48cfc025] (rid 170541) by dgp on 2019-03-29 17:21:32:
- closedate changed to: "2458572.22329541"
- closer changed to: "dgp"
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Out of Date"
- status changed to: "Closed"