You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by st...@apache.org on 2004/09/30 05:32:13 UTC

cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestHandler.pm TestRequest.pm

stas        2004/09/29 20:32:13

  Modified:    perl-framework/Apache-Test Changes
               perl-framework/Apache-Test/lib/Apache TestHandler.pm
                        TestRequest.pm
  Log:
  improve the same_interpreter framework to handle response failures
  while trying to init and later find out the same interpreter.
  
  Revision  Changes    Path
  1.172     +3 -0      httpd-test/perl-framework/Apache-Test/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
  retrieving revision 1.171
  retrieving revision 1.172
  diff -u -u -r1.171 -r1.172
  --- Changes	25 Sep 2004 01:16:49 -0000	1.171
  +++ Changes	30 Sep 2004 03:32:13 -0000	1.172
  @@ -8,6 +8,9 @@
   
   =item 1.14-dev
   
  +improve the same_interpreter framework to handle response failures
  +while trying to init and later find out the same interpreter. [Stas]
  +
   make sure that 'make distclean' cleans all the autogenerated files
   [Stas]
   
  
  
  
  1.5       +1 -1      httpd-test/perl-framework/Apache-Test/lib/Apache/TestHandler.pm
  
  Index: TestHandler.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestHandler.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- TestHandler.pm	8 Mar 2004 23:44:28 -0000	1.4
  +++ TestHandler.pm	30 Sep 2004 03:32:13 -0000	1.5
  @@ -70,7 +70,7 @@
   
       unless ($interp) {
           # shouldn't be requesting this without an INTERP header
  -        return Apache::SERVER_ERROR;
  +        die "can't find the interpreter key";
       }
   
       my $id = $same_interp_id;
  
  
  
  1.99      +16 -4     httpd-test/perl-framework/Apache-Test/lib/Apache/TestRequest.pm
  
  Index: TestRequest.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRequest.pm,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -u -r1.98 -r1.99
  --- TestRequest.pm	31 Jul 2004 06:17:29 -0000	1.98
  +++ TestRequest.pm	30 Sep 2004 03:32:13 -0000	1.99
  @@ -523,7 +523,11 @@
       my($url) = @_;
   
       my $res = GET($url, INTERP_KEY, 'tie');
  -
  +    unless ($res->code == 200) {
  +        die sprintf "failed to init the same_handler data (url=%s). " .
  +            "Failed with code=%s, response:\n%s",
  +                $url, $res->code, $res->content;
  +    }
       my $same_interp = $res->header(INTERP_KEY);
   
       return $same_interp;
  @@ -535,7 +539,7 @@
   sub same_interp_do {
       my($same_interp, $sub, $url, @args) = @_;
   
  -    die "must pass an interpreter id to work with"
  +    die "must pass an interpreter id, obtained via same_interp_tie()"
           unless defined $same_interp and $same_interp;
   
       push @args, (INTERP_KEY, $same_interp);
  @@ -546,9 +550,17 @@
       do {
           #loop until we get a response from our interpreter instance
           $res = $sub->($url, @args);
  -
  -        if ($res and $res->code == 200) {
  +        die "no result" unless $res;
  +        my $code = $res->code;
  +        if ($code == 200) {
               $found_same_interp = $res->header(INTERP_KEY) || '';
  +        }
  +        elsif ($code == 404) {
  +            # try again
  +        }
  +        else {
  +            die sprintf "failed to run the request (url=%s):\n" .
  +                "code=%s, response:\n%s", $url, $code, $res->content;
           }
   
           unless ($found_same_interp eq $same_interp) {