On Thu, 21 Jun 2001, Doug MacEachern wrote:
> On Thu, 21 Jun 2001, Stas Bekman wrote:
>
> > ------------------
> > Run:
> > $ ./t/TEST --run-tests
> > $ ./t/TEST --run-tests modules/cgi.t
> >
> > the second time modules/cgi.t is run, test #3 fails.
>
> i see that too, not looked into it yet.
ok
> > Me thinking: if the test reports ok on the first run, but fails on the
> > second, should we change the way tests are run? rerun tests
> > twice to make sure that the test really passes
> > ? more times? how about stress testing option?
>
> t/TEST --run-tests=n
> where n would be the number of times to run all the tests would be cool.
> for certain tests such as the ones that currently fail twice, we can just
> hardwire a for (1,2) {} in the .t
see the attached patch. This one just rotates through all the tests N
times, where N is --run-tests=N (optional). Another option that might be
interesting to add is replace:
my $tests =
[ ( @{ $self->{tests} } ) x $self->{opts}->{'run-tests'} ];
with:
my $tests =
[ map { $_ x $self->{opts}->{'run-tests'} } @{ $self->{tests} } ];
so in first case (as in the patch) tests: a, b, c are multiplied as a, b,
c, a, b, c, a, b, c... whereas the second example does: a, a, a, b, b, b,
c, c, c, ...
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
--- Apache-Test/lib/Apache/TestRun.pm.orig Fri Jun 22 23:45:19 2001
+++ Apache-Test/lib/Apache/TestRun.pm Fri Jun 22 23:45:33 2001
@@ -12,27 +12,30 @@
use Getopt::Long qw(GetOptions);
use Config;
-my @std_run = qw(start-httpd run-tests stop-httpd);
+my @ctl_opts = qw(start-httpd stop-httpd);
+my @test_opts = qw(run-tests);
+my @std_run = (@ctl_opts, @test_opts);
my @others = qw(verbose configure clean help ping);
my @flag_opts = (@std_run, @others);
+my @intgr_opts = (@test_opts);
my @list_opts = qw(preamble postamble);
my @hash_opts = qw(header);
my @exit_opts = qw(clean help ping debug);
my @request_opts = qw(get head post);
my %usage = (
- 'start-httpd' => 'start the test server',
- 'run-tests' => 'run the tests',
- 'stop-httpd' => 'stop the test server',
- 'verbose' => 'verbose output',
- 'configure' => 'force regeneration of httpd.conf',
- 'clean' => 'remove all generated test files',
- 'help' => 'display this message',
- 'preamble' => 'config to add at the beginning of httpd.conf',
- 'postamble' => 'config to add at the end of httpd.conf',
- 'ping' => 'test if server is running or port in use',
- 'debug' => 'start server under debugger (e.g. gdb)',
- 'header' => "add headers to (".join('|', @request_opts).") request",
+ 'start-httpd' => 'start the test server',
+ 'run-tests<=n>' => 'run the tests',
+ 'stop-httpd' => 'stop the test server',
+ 'verbose' => 'verbose output',
+ 'configure' => 'force regeneration of httpd.conf',
+ 'clean' => 'remove all generated test files',
+ 'help' => 'display this message',
+ 'preamble' => 'config to add at the beginning of httpd.conf',
+ 'postamble' => 'config to add at the end of httpd.conf',
+ 'ping' => 'test if server is running or port in use',
+ 'debug' => 'start server under debugger (e.g. gdb)',
+ 'header' => "add headers to (".join('|', @request_opts).") request",
(map { $_, "\U$_\E url" } @request_opts),
);
@@ -116,6 +119,7 @@
my(%opts, %vopts, %conf_opts);
GetOptions(\%opts, @flag_opts, @exit_opts,
+ (map "$_:i", @intgr_opts),
(map "$_=s", @request_opts),
(map { ("$_=s", $vopts{$_} ||= []) } @list_opts),
(map { ("$_=s", $vopts{$_} ||= {}) } @hash_opts));
@@ -151,14 +155,14 @@
my $self = shift;
my($opts, $tests) = ($self->{opts}, $self->{tests});
- unless (grep { $opts->{$_} } @std_run, @request_opts) {
+ unless (grep { $opts->{$_} } @std_run, @test_opts, @request_opts) {
if (@$tests && $self->{server}->ping) {
#if certain tests are specified and server is running, dont restart
$opts->{'run-tests'} = 1;
}
else {
#default is server-server run-tests stop-server
- $opts->{$_} = 1 for @std_run;
+ $opts->{$_} = 1 for @std_run, @test_opts;
}
}
@@ -252,9 +256,12 @@
sub run_tests {
my $self = shift;
+ # rerun the tests N times (--run-tests=N)
+ my $tests = [ ( @{ $self->{tests} } ) x $self->{opts}->{'run-tests'} ];
+
my $test_opts = {
verbose => $self->{opts}->{verbose},
- tests => $self->{tests},
+ tests => $tests,
};
#make sure we use an absolute path to perl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]