Here's a copy of my initial test script. I thought it might illustrate how I envisioned it being used.
-----------------------------
use strict;
use warnings;

use Apache::Test qw(-withtestmore);
use Apache::TestUtil;

require 't/test_funcs.pl';

plan( tests => 12, need_module('mod_perl') );

# Try without url.

eval{
  t_mem();
};

ok( $@ );
ok t_cmp( $@, qr/No url/, "Caught missing url.");

ok t_mem({ url => '/pw/reg_scripts/test.cgi' });
ok t_mem({ url => '/pw/reg_scripts/test.cgi', request_count => 20 });
ok t_mem({ url => '/pw/reg_scripts/test.cgi', request_count => 20, tolerance => 0 });

my ($result, $pre_test_mem, $post_test_mem, $difference, $percent_diff)
  = t_mem({ url => '/pw/reg_scripts/test.cgi' });

ok( $result );
ok( $pre_test_mem );
ok( $post_test_mem );
ok t_cmp( $difference, 0, "No difference in memory size.");
ok t_cmp( $percent_diff, 0, "No percent difference in memory size.");

# Hit a script with a leak and verify a change.
# This should fail.

$result = t_mem({ url => '/pw/reg_scripts/test_leak.cgi', request_count => 100, tolerance => 0 });
ok t_cmp($result, undef, "Test failed with leaky process.");

ok (t_mem({ url => '/pw/reg_scripts/test_leak.cgi', request_count => 100, tolerance => 50 }));


On Aug 30, 2005, at 12:45 PM, William McKee wrote:

On Tue, Aug 30, 2005 at 10:46:38AM -0400, Jim Brandt wrote:

I'd be interested in any feedback on what I've got so far. I was also
thinking it might fit nicely in Apache::TestUtil?


It looks useful, Jim. I could see where it may be helpful in figuring
out which modules to preload in start.pl so that you get better sharing
of resources. What was your intention in writing it?


William

--
Knowmad Services Inc.
http://www.knowmad.com


==========================================
Jim Brandt
Administrative Computing Services
University at Buffalo

Reply via email to