You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Doug MacEachern <do...@covalent.net> on 2001/08/17 19:56:10 UTC

perldb

to help with debugging tests, you can run under the perldebugger
% t/TEST -v -d perl t/modules/cgi.t 

...
  DB<1> lwpd 1

will turn on debug mode so Apache::TestRequest prints the request method
and url, along with the response headers from the server.  'lwp 2' does
the same, but includes response body.  any non \d argument triggers a call
to LWP::Debug::import, "lwp '+'" for example, see 'perldoc LWP::Debug' for
more info on those options.

i find it handy to set a breakpoint at 'ok', so the debugger stops each
time a test happens:
  DB<2> b ok
  DB<3> c
then you'll see:
1..35
GET http://localhost:8529/modules/cgi/bogus-sh.sh :
HTTP/1.1 500 Internal Server Error
Connection: close
Date: Fri, 17 Aug 2001 17:51:50 GMT
Server: Apache/2.0.25-dev (Unix) mod_ssl/3.0a0 OpenSSL/0.9.6 DAV/2
Content-Length: 536
Content-Type: text/html; charset=iso-8859-1
Client-Date: Fri, 17 Aug 2001 17:51:50 GMT
Client-Peer: 127.0.0.1:8529
Title: 500 Internal Server Error


return code for bogus-sh.sh: 500, expecting: 500
Test::ok(/usr/local/ithrperl/lib/5.7.2/Test.pm:222):
222:        croak "ok: plan before you test!" if !$planned;
  DB<3> 

type 'c' at the prompt to continue on to the next test.

'perldoc perldebug' for more info on using the perl debugger.




Re: perldb

Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:

> to help with debugging tests, you can run under the perldebugger
> % t/TEST -v -d perl t/modules/cgi.t 
> 
> ...
>   DB<1> lwpd 1
> 
> will turn on debug mode so Apache::TestRequest prints the request method
> and url, along with the response headers from the server.  'lwp 2' does
> the same, but includes response body.  any non \d argument triggers a call
> to LWP::Debug::import, "lwp '+'" for example, see 'perldoc LWP::Debug' for
> more info on those options.
> 
> i find it handy to set a breakpoint at 'ok', so the debugger stops each
> time a test happens:
>   DB<2> b ok
>   DB<3> c


that doesn't seem to work

% t/TEST -start
% t/TEST -v -d perl t/apache/read.t 
setting ulimit to allow core files
ulimit -c unlimited
 exec t/TEST -v -d perl t/apache/read.t

Loading DB routines from perl5db.pl version 1.14
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

Apache::TestPerlDB added perldb commands:
   bok - Set breakpoint at test n
   lwpd - Set the LWP debug level for Apache::TestRequest
Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.  
  DB<1> lwpd 1
Undefined subroutine &Apache::TestRequest::lwp_debug called at ../Apache-Test/lib/Apache/TestPerlDB.pm line 5.

  DB<2> b ok
Subroutine main::ok not found.



-- 


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/