Date: | Wed, 10 Sep 2003 22:44:27 -0500 |
To: | bug-test-harness [...] rt.cpan.org |
From: | Stas Bekman <stas [...] stason.org>(by way of Andy Lester) |
Subject: | T::H trapping core dumps |
Hi Andy,
I have a request for a new feature in Test::Harness. I want a new env
var which when true will scan the current dir for core files *after
each test*. In mod_perl 2.0, we do that before and after the whole
harness, but as the number of tests grows it becomes really hard to
find the test that caused the core dump.
Here is a snippet of code that could be useful: %core_files keeps
track of seen core files
#e.g. t/core or t/core.12499
my $core_pat = '^core(\.\d+)?' . "\$";
sub scan_core {
my ($self, $top_dir) = @_;
my $times = 0;
finddepth(sub {
return unless -f $_;
return unless /$core_pat/o;
my $core = $File::Find::name;
if (exists $core_files{$core} && $core_files{$core} == -M $core) {
# we have seen this core file before the start of the test
info "an old core file has been found: $core";
}
else {
my $oh = oh();
my $again = $times++ ? "again" : "";
error "oh $oh, server dumped core $again";
error "for stacktrace, run: gdb $vars->{httpd} -core $core";
}
}, $top_dir);
}
Show quoted text
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com