7 use lib "$FindBin::Bin/../live/lib";
10 use Catalyst::Test 'TestApp';
14 plan skip_all => 'set TEST_MEMLEAK to enable this test'
15 unless $ENV{TEST_MEMLEAK};
16 plan skip_all => 'GTop required for this test' if $@;
18 our $gtop = GTop->new;
19 our ( $initial, $final ) = ( 0, 0 );
20 our $tests = YAML::LoadFile("$FindBin::Bin/stress.yml");
23 map { $total_tests += scalar @{ $tests->{$_} } } keys %{$tests};
24 plan tests => $total_tests;
26 foreach my $test_group ( keys %{$tests} ) {
27 foreach my $test ( @{ $tests->{$test_group} } ) {
33 my $uri = shift || die 'No URI given for test';
35 print "TESTING $uri\n";
37 # make a few requests to set initial memory size
42 $initial = $gtop->proc_mem($$)->size;
43 print "Initial Size: " . GTop::size_string($initial) . "\n";
49 $final = $gtop->proc_mem($$)->size;
50 print "Final Size: " . GTop::size_string($final) . "\n";
52 if ( $final > $initial ) {
53 print "Leaked Bytes: " . GTop::size_string($final - $initial) . "\n";
56 is( $final, $initial, "'$uri' memory is not leaking" );