On Mon, 15 Oct 2001, Doug MacEachern wrote:

> On Tue, 16 Oct 2001, Stas Bekman wrote:
>
> > if I understand correctly the current code uses a single instance of the
> > LWP's UA object. For one of the registry tests I need .t to drive .pm
> > response handler, which in turn touch'es the files and need to be able
> > to generate its own "sub-requests", so is it better to try to use a
> > subrequest or change the code to handle multiply UA's? Currently the
> > whole thing hangs, if I do .t -> .pm -> /request, because the first
> > request wasn't finished, so the second one cannot proceed and there is a
> > sort of deadlock.
>
> you'd have to bump up the Apache::TestConfig->{vars}->{maxclients}
> which you can do in your t/TEST (see the Apache-Test example that
> overrides new_test_config).

of course, it's obvious after you said it :)

it all works now, but there is a new problem. I remember reading in one of
the docs that in 2.0 the interpreters queue is implemented as LIFO.
Therefore in my tests I've relied on the fact that two subsequent requests
will hit the same interpreter, assuming that normally during 'make test'
there is only one request at any given time. But that's not what I see, if
you apply this patch that sets MaxClients to 2 and run:

  ./t/TEST -v closure

in ./ModPerl-Registry/

it fails, because the server does round robin and not LIFO rotation. I
need the MaxClient==2 setting for a different test (not committed yet).

After applying the patch and reconfiguring, you can also observe the
effect with:

./t/TEST -start
lynx --source http://localhost.localdomain:8529/registry/closure.pl
lynx --source http://localhost.localdomain:8529/registry/closure.pl
...

should return 1, 2, 3, 4 but it returns 1, 1, 2, 2

So my questions are:

- is it a bug that I observe RR and not LIFO?
- if it's not a bug, any idea how to make sure that I work with the same
  interpreter to be able to perform the tests? (without rerunning the
  requests many times and waiting for a specific $$ I could catch on the
  first request)

Thanks!

Index: t/TEST.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/TEST.PL,v
retrieving revision 1.1
diff -u -r1.1 TEST.PL
--- t/TEST.PL   2001/10/09 12:47:38     1.1
+++ t/TEST.PL   2001/10/16 15:31:05
@@ -3,15 +3,23 @@
 use strict;
 use warnings FATAL => 'all';

-# XXX: fixme
-#use lib map { "$_/Apache-Test/lib" } qw(. ..);
-#use lib map { "$_/blib/lib"        } qw(. .. ../..);
-#use lib map { "$_/lib"             } qw(. .. ../..);
-#use blib map { $_ } qw(. .. ../..);
-
 use lib map {("../blib/$_", "../../blib/$_")} qw(lib arch);
-#use blib qw(..);

 use Apache::TestRunPerl ();
+
+package MyTest;
+
+our @ISA = qw(Apache::TestRunPerl);
+
+# subclass new_test_config to add some config vars which will be
+# replaced in generated httpd.conf
+sub new_test_config {
+    my $self = shift;
+
+    $self->{conf_opts}->{maxclients} = 2;
+
+    return $self->SUPER::new_test_config;
+}
+
+MyTest->new->run(@ARGV);

-Apache::TestRunPerl->new->run(@ARGV);

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to