Hi All,
Having nearly finished my latest software update, I've decided to write a comprehensive test suite to ensure that everything is working properly and making it easy to see if future changes have broken things. Why I didn't do this in the first place is beyond me...
I've been reading through my 'Perl Testing' book (many thanks to chromatic and Ian) and putting some tests together in the usual t/*.t files. I don't have a lot of experience with this but it all seems pretty straight forward and the book is a great help.
The problem I've hit is this. My software uses CGI, and is running on many different machines across the net. I want users to be able to run some or all of the tests at any time through the browser based admin area.
I put together a quick script that ran the tests with a simple do and tested it on my local IIS/Perl8 setup.
do ('t/00modules.t');
When I ran the cgi in my browser I got:-
1..2
ok 1 - use module;
ok 2 - DateNext() should increment the date by 1 day
doneFree to wrong pool 222c90 not 40c01b1 during global destruction.
The CPU hits 100% for a few seconds then I get a popup saying:-
Perl Command Line Interpreter has encountered a problem and needs to c
+lose. We are sorry for the inconvenience.
Seems this is causing a perl to panic. If I run the test through the command line it works fine.
Now I know I could just use system or `` to call the test with perl, but on some of the installations (especially the Win2003/IIS/Perl8 ones) the cgi's done have permission to run commands in that way.
So I've hit a bit of a brick wall as I have no idea why using do () is causing a panic and what I can do to fix it.
I hoping a monk with more testing experience can help me.
Lyle
Many thanks to YourMother for providing a solution:-
use Test::Harness::Straps;
my $strap = new Test::Harness::Straps;
my %results = $strap->analyze_file( 't/00modules.t' );
use Data::Dumper;
print Data::Dumper->Dump([\%results]);
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.