develooper Front page | perl.qa | Postings from January 2007

Comment about BAIL_OUT

Thread Next
From:
Ovid
Date:
January 4, 2007 13:34
Subject:
Comment about BAIL_OUT
Message ID:
541648.96024.qm@web60820.mail.yahoo.com
From the docs:

  BAIL_OUT
    BAIL_OUT($reason);

    Indicates to the harness that things are going so badly all testing
    should terminate.  This includes the running any additional test
    scripts.

    This is typically used when testing cannot continue such as a crit-
    ical module failing to compile or a necessary external utility not
    being available such as a database connection failing.

    The test will exit with 255.

This seems extremely useful, but I confess I've never used it.  When I
tried to run 'prove' against my 't/sample-tests/' in TAPx::Parser, I
got this:

  TAPx-Parser $ prove t/sample-tests/*
  t/sample-tests/bailout.............ok 1/5FAILED--Further testing
stopped: GERONIMMMOOOOOO!!!

However, if you use the '-s' switch to shuffle your tests and bailout
is not first, then some tests will run until the BAIL_OUT is hit.  This
seems to violate the principle that tests should be able to run in any
order without dependencies.

I guess the reason I have never used BAIL_OUT is because if I have a
bunch of tests failing, they fail quickly and I don't have to wait for
them :)  I suppose it's not that big of a deal, but I noticed it this
evening and thought I would toss it out there in case anyone has any
comments.

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About