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 rwrite.t
Date Wed, 21 Nov 2001 01:42:33 GMT
dougm       01/11/20 17:42:33

  Modified:    perl-framework/c-modules/test_rwrite mod_test_rwrite.c
               perl-framework/t/apache rwrite.t
  Log:
  make rwrite test like passbrigade test, where we can configure the buffer size
  
  Revision  Changes    Path
  1.6       +12 -4     httpd-test/perl-framework/c-modules/test_rwrite/mod_test_rwrite.c
  
  Index: mod_test_rwrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/c-modules/test_rwrite/mod_test_rwrite.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_test_rwrite.c	2001/11/13 18:54:53	1.5
  +++ mod_test_rwrite.c	2001/11/21 01:42:33	1.6
  @@ -10,10 +10,14 @@
   
   #include "apache_httpd_test.h"
   
  +#define WANT_HTTPD_TEST_SPLIT_QS_NUMBERS
  +#include "httpd_test_util.c"
  +
   static int test_rwrite_handler(request_rec *r)
   {
       long total=0, remaining=1;
  -    char buff[BUFSIZ];
  +    char *buff;
  +    int buff_size = 8192;
   
       if (strcmp(r->handler, "test_rwrite")) {
           return DECLINED;
  @@ -30,14 +34,17 @@
       ap_send_http_header(r);
   #endif
   
  +    httpd_test_split_qs_numbers(r, &buff_size, &remaining, NULL);
  +
       fprintf(stderr, "[mod_test_rwrite] going to echo %ld bytes\n",
               remaining);
   
  -    memset(buff, 'a', sizeof(buff));
  +    buff = malloc(buff_size);
  +    memset(buff, 'a', buff_size);
   
       while (total < remaining) {
           int left = (remaining - total);
  -        int len = left <= sizeof(buff) ? left : sizeof(buff);
  +        int len = left <= buff_size ? left : buff_size;
           long nrd = ap_rwrite(buff, len, r);
           total += nrd;
   
  @@ -48,7 +55,8 @@
       fprintf(stderr,
               "[mod_test_rwrite] done writing %ld of %ld bytes\n",
               total, remaining);
  -    
  +
  +    free(buff);    
       return OK;
   }
   
  
  
  
  1.4       +11 -8     httpd-test/perl-framework/t/apache/rwrite.t
  
  Index: rwrite.t
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/apache/rwrite.t,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- rwrite.t	2001/11/09 11:49:56	1.3
  +++ rwrite.t	2001/11/21 01:42:33	1.4
  @@ -6,21 +6,24 @@
   
   #1k..9k, 10k..50k, 100k, 300k, 500k, 2Mb, 4Mb, 6Mb, 10Mb
   my @sizes = (1..9, 10..50, 100, 300, 500, 2000, 4000, 6000, 10_000);
  +my @buff_sizes = (1024, 8192);
   
  -plan tests => scalar @sizes, [qw(test_rwrite LWP)];
  +plan tests => @sizes * @buff_sizes, [qw(test_rwrite LWP)];
   
   my $location = "/test_rwrite";
   
  -for my $size (@sizes) {
  -    my $length = $size * 1024;
  +for my $buff_size (@buff_sizes) {
  +    for my $size (@sizes) {
  +        my $length = $size * 1024;
   
  -    print "getting $length bytes of data\n";
  +        print "getting $length bytes of data\n";
   
  -    my $str = GET_BODY "$location?$length";
  +        my $str = GET_BODY "$location?$length";
   
  -    printf "read %d bytes of data\n", length $str;
  +        printf "read %d bytes of data\n", length $str;
   
  -    my $chunk = 'a' x 1024;
  -    ok $str =~ /^($chunk){$size}$/;
  +        my $chunk = 'a' x 1024;
  +        ok $str =~ /^($chunk){$size}$/;
  +    }
   }
   
  
  
  

Mime
View raw message