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 jw...@apache.org on 2002/04/01 21:45:55 UTC

cvs commit: httpd-test/perl-framework/t/http11 chunked.t

jwoolley    02/04/01 11:45:55

  Modified:    perl-framework/t/http11 chunked.t
  Log:
  Add verbose debug output (and as a fringe benefit, prevent this test from
  aborting with an uninitialized value error if Apache segfaults while
  performing the test)
  
  Revision  Changes    Path
  1.15      +46 -11    httpd-test/perl-framework/t/http11/chunked.t
  
  Index: chunked.t
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/http11/chunked.t,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -d -u -r1.14 -r1.15
  --- chunked.t	2 Jan 2002 06:12:19 -0000	1.14
  +++ chunked.t	1 Apr 2002 19:45:55 -0000	1.15
  @@ -3,6 +3,7 @@
   
   use Apache::Test;
   use Apache::TestRequest;
  +use Apache::TestUtil;
   
   Apache::TestRequest::user_agent(keep_alive => 1);
   
  @@ -36,21 +37,39 @@
               $length = $1;
           }
   
  -        ok $res->protocol eq 'HTTP/1.1';
  +        ok t_cmp("HTTP/1.1",
  +                 $res->protocol,
  +                 "response protocol"
  +                );
   
           my $enc = $res->header('Transfer-Encoding') || 
                     $res->header('Client-Transfer-Encoding') || #lwp 5.61+
                     '';
  -        ok $enc eq 'chunked';
  -        ok ! $res->header('Content-Length');
  +        my $ct  = $res->header('Content-Length') || 0;
   
  -        ok length($body) == $length;
  +        ok t_cmp("chunked",
  +                 $enc,
  +                 "response Transfer-Encoding"
  +                );
  +
  +        ok t_cmp(0,
  +                 $ct,
  +                 "no Content-Length"
  +                );
  +
  +        ok t_cmp($length,
  +                 length($body),
  +                 "body length"
  +                );
   
           $requests++;
           my $request_num =
             Apache::TestRequest::user_agent_request_num($res);
   
  -        return $request_num == $requests;
  +        return t_cmp($requests,
  +                     $request_num,
  +                     "number of requests"
  +                    );
       }, 5;
   }
   
  @@ -66,21 +85,37 @@
               $length = $1;
           }
   
  -        ok $res->protocol eq 'HTTP/1.1';
  +        ok t_cmp("HTTP/1.1",
  +                 $res->protocol,
  +                 "response protocol"
  +                );
   
           my $enc = $res->header('Transfer-Encoding') || '';
           my $ct  = $res->header('Content-Length') || 0;
   
  -        ok $enc ne 'chunked';
  -        ok $ct == $content_length;
  +        ok !t_cmp("chunked",
  +                  $enc,
  +                  "no Transfer-Encoding (test result inverted)"
  +                 );
   
  -        ok length($body) == $length;
  +        ok t_cmp($content_length,
  +                 $ct,
  +                 "content length"
  +                );
  +
  +        ok t_cmp($length,
  +                 length($body),
  +                 "body length"
  +                );
   
           $requests++;
           my $request_num =
             Apache::TestRequest::user_agent_request_num($res);
   
  -        return $request_num == $requests;
  +        return t_cmp($requests,
  +                     $request_num,
  +                     "number of requests"
  +                    );
       }, 5;
   }