Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
tcltest exit code
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Olе Streicher  
View profile  
 More options Aug 22 2012, 9:53 am
Newsgroups: comp.lang.tcl
From: ole-usenet-s...@gmx.net (Olе Streicher)
Date: Wed, 22 Aug 2012 15:53:09 +0200
Local: Wed, Aug 22 2012 9:53 am
Subject: tcltest exit code
Hi,

I am trying to write some unit tests to be run when a tcl module (with
some C code) is built. I use a simple "all.tcl":

---------------8<------------------
package require tcltest
tcltest::verbose {pass body error}
tcltest::runAllTests
---------------8<------------------

But, how do I get the test result as the exit code? The tclsh
interpreter always returns exit code 0. Foofle found some "if { [info
exists tcltest::testFileFailures] } ..."  but this seems not to work.

Best regards

Ole


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don Porter  
View profile  
 More options Aug 22 2012, 10:03 am
Newsgroups: comp.lang.tcl
From: Don Porter <d...@nist.gov>
Date: Wed, 22 Aug 2012 10:03:27 -0400
Local: Wed, Aug 22 2012 10:03 am
Subject: Re: tcltest exit code
On 08/22/2012 09:53 AM, Olе Streicher wrote:

> ---------------8<------------------
> package require tcltest
> tcltest::verbose {pass body error}
> tcltest::runAllTests
> ---------------8<------------------

> But, how do I get the test result as the exit code?

The tcltest package doesn't support any programmatic access to its test
stats; it's written to do its own reporting.

You can cheat and peek into tcltest's private operations, and use this:

exit [expr {$::tcltest::numTests(Failed) > 0}]

The risk is that someday, those private parts of the tcltest package
could change and you'd need to update your test suite to deal with it.
Empirically, that's not been a problem on the scale of years.

--
| Don Porter            Applied and Computational Mathematics Division |
| donald.por...@nist.gov             Information Technology Laboratory |
| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Olе Streicher  
View profile  
 More options Aug 22 2012, 10:17 am
Newsgroups: comp.lang.tcl
From: ole-usenet-s...@gmx.net (Olе Streicher)
Date: Wed, 22 Aug 2012 16:17:54 +0200
Local: Wed, Aug 22 2012 10:17 am
Subject: Re: tcltest exit code
Hi,

Don Porter <d...@nist.gov> writes:
> On 08/22/2012 09:53 AM, Olе Streicher wrote:
>> ---------------8<------------------
>> package require tcltest
>> tcltest::verbose {pass body error}
>> tcltest::runAllTests
>> ---------------8<------------------

>> But, how do I get the test result as the exit code?

> The tcltest package doesn't support any programmatic access to its test
> stats; it's written to do its own reporting.

Is there a better way to do unit tests for module compilation?

> You can cheat and peek into tcltest's private operations, and use this:
> exit [expr {$::tcltest::numTests(Failed) > 0}]

Unfortunately, this does not work. I always get zero here.

> The risk is that someday, those private parts of the tcltest package
> could change and you'd need to update your test suite to deal with it.
> Empirically, that's not been a problem on the scale of years.

What is the current state of tcl development? It looks if almost nothing
happens anymore there (at least, when compared to f.e. python). This
problem is there since at least 7 years, without a clean solution yet.

Best regards

Ole


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don Porter  
View profile  
 More options Aug 22 2012, 11:08 am
Newsgroups: comp.lang.tcl
From: Don Porter <d...@nist.gov>
Date: Wed, 22 Aug 2012 11:08:33 -0400
Local: Wed, Aug 22 2012 11:08 am
Subject: Re: tcltest exit code

>> You can cheat and peek into tcltest's private operations, and use this:
>> exit [expr {$::tcltest::numTests(Failed)>  0}]
> Unfortunately, this does not work. I always get zero here.

Aha!  You're right.  [tcltest::cleanupTests 1] resets the values before
you get to them.  Here's the workaround version of all.tcl:

package require tcltest
tcltest::verbose {pass body error}
proc tcltest::cleanupTestsHook {} {
     variable numTests
     set ::code [expr {$numTests(Failed) > 0}]

}

tcltest::runAllTests
exit $code

--
| Don Porter            Applied and Computational Mathematics Division |
| donald.por...@nist.gov             Information Technology Laboratory |
| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Olе Streicher  
View profile  
 More options Aug 22 2012, 12:01 pm
Newsgroups: comp.lang.tcl
From: ole-usenet-s...@gmx.net (Olе Streicher)
Date: Wed, 22 Aug 2012 18:01:36 +0200
Local: Wed, Aug 22 2012 12:01 pm
Subject: Re: tcltest exit code
Hi Don,

Don Porter <d...@nist.gov> writes:
>>> You can cheat and peek into tcltest's private operations, and use this:
>>> exit [expr {$::tcltest::numTests(Failed)>  0}]
>> Unfortunately, this does not work. I always get zero here.
> Aha!  You're right.  [tcltest::cleanupTests 1] resets the values before
> you get to them.  Here's the workaround version of all.tcl:

> package require tcltest
> tcltest::verbose {pass body error}
> proc tcltest::cleanupTestsHook {} {
>     variable numTests
>     set ::code [expr {$numTests(Failed) > 0}]
> }
> tcltest::runAllTests
> exit $code

Thank you. However, it still does not work completely: if the test
crashes because of a segmentation fault in the module, I still get a
success.

Best regards

Ole


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don Porter  
View profile  
 More options Aug 22 2012, 1:34 pm
Newsgroups: comp.lang.tcl
From: Don Porter <d...@nist.gov>
Date: Wed, 22 Aug 2012 13:34:28 -0400
Local: Wed, Aug 22 2012 1:34 pm
Subject: Re: tcltest exit code

> Thank you. However, it still does not work completely: if the test
> crashes because of a segmentation fault in the module, I still get a
> success.

package require tcltest
tcltest::verbose {pass body error}
proc tcltest::cleanupTestsHook {} {
     variable numTests
     upvar 2 testFileFailures crashed
     set ::code [expr {$numTests(Failed) > 0}]
     if {[info exists crashed]} {
         set ::code [expr {$::code || [llength $crashed]}]
     }
}

tcltest::runAllTests
exit $code

--
| Don Porter            Applied and Computational Mathematics Division |
| donald.por...@nist.gov             Information Technology Laboratory |
| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Olе Streicher  
View profile  
 More options Aug 22 2012, 1:38 pm
Newsgroups: comp.lang.tcl
From: ole-usenet-s...@gmx.net (Olе Streicher)
Date: Wed, 22 Aug 2012 19:38:45 +0200
Local: Wed, Aug 22 2012 1:38 pm
Subject: Re: tcltest exit code

Don Porter <d...@nist.gov> writes:
> package require tcltest
> tcltest::verbose {pass body error}
> proc tcltest::cleanupTestsHook {} {
>     variable numTests
>     upvar 2 testFileFailures crashed
>     set ::code [expr {$numTests(Failed) > 0}]
>     if {[info exists crashed]} {
>         set ::code [expr {$::code || [llength $crashed]}]
>     }
> }
> tcltest::runAllTests
> exit $code

Thank you very much! Works well for me.

Best regards

Ole


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andreas Kupries  
View profile  
 More options Aug 22 2012, 10:21 pm
Newsgroups: comp.lang.tcl
From: Andreas Kupries <akupr...@shaw.ca>
Date: Wed, 22 Aug 2012 19:21:22 -0700
Local: Wed, Aug 22 2012 10:21 pm
Subject: Re: tcltest exit code

ole-usenet-s...@gmx.net (Olе Streicher) writes:
> What is the current state of tcl development? It looks if almost nothing
> happens anymore there (at least, when compared to f.e. python).

Where are you looking ?

While our bug trackers are still at

        http://tcl.sourceforge.net/

the source code repositories have moved to

        http://core.tcl.tk/

--
So long,
        Andreas Kupries <akupr...@shaw.ca>
                        <http://www.purl.org/NET/akupries/>
        Developer @     <http://www.activestate.com/>

http://www.tcl.tk/community/tcl2012/ - Tcl'2012, Nov 12-16, Chicago, IL, USA.
--------------------------------------------------------------------------- ----


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Olе Streicher  
View profile  
 More options Aug 24 2012, 4:50 am
Newsgroups: comp.lang.tcl
From: ole-usenet-s...@gmx.net (Olе Streicher)
Date: Fri, 24 Aug 2012 10:50:36 +0200
Local: Fri, Aug 24 2012 4:50 am
Subject: Re: tcltest exit code
Hi Andreas,

Andreas Kupries <akupr...@shaw.ca> writes:
> ole-usenet-s...@gmx.net (Olе Streicher) writes:
>> What is the current state of tcl development? It looks if almost nothing
>> happens anymore there (at least, when compared to f.e. python).
> Where are you looking ?

I don't mean Tcl itself but the whole ecosystem. In the last months, I
tried to push some older (astrophysical) programs for the use of the
current Tcl versions and found a good nightmare; there are many
libraries that are stuck at older versions. Most prominent is BLT
(current version 2.4z which is ~10 years old).

Another example is the tcltest (Tcl core) package: you find the exit
code question in the usenet already 6 years ago, but nothing seems to
happened since then: just slowly changing workarounds. This is not what
I would call a living development. Therefore my question about its
current state.

Best regards

Ole


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andreas Kupries  
View profile  
 More options Aug 26 2012, 9:59 pm
Newsgroups: comp.lang.tcl
From: Andreas Kupries <akupr...@shaw.ca>
Date: Sun, 26 Aug 2012 18:59:24 -0700
Local: Sun, Aug 26 2012 9:59 pm
Subject: Re: tcltest exit code

ole-usenet-s...@gmx.net (Olе Streicher) writes:
> Hi Andreas,

> Andreas Kupries <akupr...@shaw.ca> writes:
>> ole-usenet-s...@gmx.net (Olе Streicher) writes:
>>> What is the current state of tcl development? It looks if almost nothing
>>> happens anymore there (at least, when compared to f.e. python).

>> Where are you looking ?
> I don't mean Tcl itself but the whole ecosystem. In the last months,
> I tried to push some older (astrophysical) programs for the use of
> the current Tcl versions and found a good nightmare; there are many
> libraries that are stuck at older versions. Most prominent is BLT
> (current version 2.4z which is ~10 years old).

A fork for Tcl 8.5 exists at

        http://pdqi.com/w/pw/pdqi/Wize/Blt/

Mentioned at http://wiki.tcl.tk/199
Note also http://wiki.tcl.tk/24533

> Another example is the tcltest (Tcl core) package: you find the exit
> code question in the usenet already 6 years ago, but nothing seems to
> happened since then: just slowly changing workarounds.

Has it only been discussed on usenet ?

Has anybody ever found the issue important enough to actually file a
bug report on it ? Plus maybe the patches they have?

(On my quick search right now it seems not)

> This is not what I would call a living development. Therefore my
> question about its current state.

Most people in the Tcl area, including maintainers, have a day jobs
taking much of their time. Then comes family.

Even I, without much family time, find myself not reading
comp.lang.tcl as much as I did in the past. I am mostly on the
tcl-core list where core development is talked about. Tracking the bug
tracker more than here.

--
So long,
        Andreas Kupries <akupr...@shaw.ca>
                        <http://www.purl.org/NET/akupries/>
        Developer @     <http://www.activestate.com/>

http://www.tcl.tk/community/tcl2012/ - Tcl'2012, Nov 12-16, Chicago, IL, USA.
--------------------------------------------------------------------------- ----


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "tcltest package development" by Don Porter
Don Porter  
View profile  
 More options Aug 27 2012, 8:36 am
Newsgroups: comp.lang.tcl
From: Don Porter <d...@nist.gov>
Date: Mon, 27 Aug 2012 08:36:30 -0400
Local: Mon, Aug 27 2012 8:36 am
Subject: tcltest package development
On 08/26/2012 09:59 PM, Andreas Kupries wrote:

>> Another example is the tcltest (Tcl core) package: you find the exit
>> code question in the usenet already 6 years ago, but nothing seems to
>> happened since then: just slowly changing workarounds.

> Has it only been discussed on usenet ?

> Has anybody ever found the issue important enough to actually file a
> bug report on it ? Plus maybe the patches they have?

> (On my quick search right now it seems not)

<semi-disorganized brain dump follows>

The SF Tracker has 16 open feature requests for the tcltest package.
Most relevant to this discussion are

http://sf.net/tracker/?func=detail&aid=623787&group_id=10894&atid=360894
http://sf.net/tracker/?func=detail&aid=2794560&group_id=10894&atid=36...

I would be quite pleased for someone interested to open a fossil branch
to work on some/all of these, or other improvements to tcltest.

The other constraint to keep in mind for tcltest enhancements is the
existing body of test suites that you'd want to avoid breaking as much
as reasonably possible.  To avoid that constraint (and to shuffle off
the burden of "tcltest 1" compatibility still woven through the existing
package), someone might also consider going to work directly on either
tcltest 3, or a successor package of testing facilities.

For quite a while now, tcltest edits are mostly small bug fixes or
small accommodations to the changing facilities of Tcl.  Substantial
new features haven't been done.  This is due to a number of things.

A large factor is that the maintainer, me, has formed an impression that
tcltest is largely "done".  As in, it's good enough, and the proposed
improvements are all tinkerings around the edge that might be nice, but
aren't a big deal.  So working on them never rises above all the other
pending Tcl improvements which seem more important at the time.  Only
occasionally does someone dissatisfied interact with me enough like this
to bring a deficiency into focus.

A contributing factor is that tcltest started existence as a set of
utility scripts forming a testing application, rather than a testing
package, and it's never really completed the transformation.  It still
contains, and even prefers, facilities that reach out and read $::argv
for itself and write directly to stdout and stderr for its own
reporting, rather than specify interfaces that would allow a client
application to get at these things and use them as it chooses.

I have the sense that the world of testing has grown up a firmer set of
conventions since the days when tcltest built up its feature set.  Even
a question posed earlier "Is there a better way to do unit tests for
module compilation?" suggests that there's an expected set of vocabulary
and functionality in the testing world that was not as well established
in the days of tcltest's origin.  A renovation or reboot schooled in
modern expectations might be very useful in capturing and serving this
set of expectations.  I am not immersed in the testing world nearly
enough to be the best person to attempt that.

--
| Don Porter            Applied and Computational Mathematics Division |
| donald.por...@nist.gov             Information Technology Laboratory |
| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »