You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by go...@apache.org on 2004/10/12 21:20:07 UTC

cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestReport.pm

gozer       2004/10/12 12:20:07

  Modified:    perl-framework/Apache-Test Changes
               perl-framework/Apache-Test/lib/Apache TestReport.pm
  Log:
  add automatic core dump backtrace generation in t/REPORT if
  Devel::GDB is installed
  
  Revision  Changes    Path
  1.178     +3 -0      httpd-test/perl-framework/Apache-Test/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
  retrieving revision 1.177
  retrieving revision 1.178
  diff -u -r1.177 -r1.178
  --- Changes	12 Oct 2004 18:19:03 -0000	1.177
  +++ Changes	12 Oct 2004 19:20:07 -0000	1.178
  @@ -8,6 +8,9 @@
   
   =item 1.15-dev
   
  +add automatic core dump backtrace generation in t/REPORT if
  +Devel::GDB is installed [Gozer]
  +
   add 'testcover' make target for running tests with Devel::Cover
   [Geoffrey Young]
   
  
  
  
  1.15      +33 -1     httpd-test/perl-framework/Apache-Test/lib/Apache/TestReport.pm
  
  Index: TestReport.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestReport.pm,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TestReport.pm	5 Sep 2004 00:11:30 -0000	1.14
  +++ TestReport.pm	12 Oct 2004 19:20:07 -0000	1.15
  @@ -21,6 +21,7 @@
   use Apache::TestConfig ();
   
   use File::Spec::Functions qw(catfile);
  +use File::Find;
   
   sub new {
       my $class = shift;
  @@ -79,6 +80,37 @@
   
   sub executable { $0 }
   
  +my $core_dump;
  +sub core_dump {
  +    my $self = shift;
  +    
  +    $core_dump = "";
  +    
  +    if (eval { require Devel::GDB }) {
  +        find(\&dump_core_file, 't')
  +    }
  +    
  +    $core_dump || '  [CORE TRACE COMES HERE]';
  +}
  +
  +sub dump_core_file {
  +    return unless /^core(\.\d+)?$/;
  +    
  +    my $core = $_;
  +    my $gdb = new Devel::GDB ();
  +    my $test_config = Apache::TestConfig->new({thaw=>1});
  +    my $httpd = $test_config->{vars}->{httpd};
  +    
  +    return unless defined $httpd;
  +    
  +    $core_dump .= join '', 
  +           $gdb->get("file $httpd"),
  +           $gdb->get('sharedlibrary'),
  +           $gdb->get("core $core"),
  +           $gdb->get('info threads'),
  +           $gdb->get('thread apply all bt');
  +}
  +
   sub date { scalar gmtime() . " GMT" }
   
   sub template {
  @@ -94,7 +126,7 @@
   
   3. This is the core dump trace: (if you get a core dump):
   
  -  [CORE TRACE COMES HERE]
  +@CORE_DUMP@
   
   This report was generated by @EXECUTABLE@ on @DATE@.