httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: httpd-test/perl-framework/t/apache getfile.t
Date Wed, 21 Nov 2001 21:21:33 GMT
dougm       01/11/21 13:21:33

  Modified:    perl-framework/t/apache getfile.t
  Log:
  switch to using a response callback to cut down on memory usage
  
  Revision  Changes    Path
  1.7       +14 -9     httpd-test/perl-framework/t/apache/getfile.t
  
  Index: getfile.t
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/apache/getfile.t,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- getfile.t	2001/11/09 01:30:35	1.6
  +++ getfile.t	2001/11/21 21:21:33	1.7
  @@ -2,7 +2,8 @@
   use warnings FATAL => 'all';
   
   use Apache::Test;
  -use Apache::TestRequest;
  +use Apache::TestRequest ();
  +use Apache::TestUtil;
   use File::Basename;
   
   my $vars = Apache::Test::vars();
  @@ -14,16 +15,19 @@
   }
   else {
       $perlpod = undef;
  +    #XXX: howto plan ..., skip_unless(...) + have_module(...) ?
  +    push @Apache::Test::SkipReasons,
  +      "dir $vars->{perlpod} doesn't exist"
   }
   
   my %other_files = map {
       ("/getfiles-binary-$_", $vars->{$_})
   } qw(httpd perl);
   
  -plan tests => @pods + keys(%other_files),
  -    skip_unless(sub { $vars->{perlpod} }, "dir $vars->{perlpod} doesn't exist");
  +plan tests => @pods + keys(%other_files), 'LWP';
   
   my $location = "/getfiles-perl-pod";
  +my $ua = Apache::TestRequest::user_agent();
   
   for my $file (@pods) {
       verify("$location/$file", "$perlpod/$file");
  @@ -37,13 +41,14 @@
   sub verify {
       my($url, $file) = @_;
   
  -    my $res = GET $url;
  -    my $str = $res->content_ref; #avoid an extra copy
  -
  -    my $slen = length $$str;
       my $flen = -s $file;
  +    my $received = 0;
   
  -    print "downloaded $slen bytes, file is $flen bytes\n";
  +    $ua->do_request(GET => $url,
  +                    sub {
  +                        my($chunk, $res) = @_;
  +                        $received += length $chunk;
  +                    });
   
  -    ok $slen == $flen;
  +    ok t_cmp($flen, $received, "download of $url");
   }
  
  
  

Mime
View raw message