httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject cvs commit: httpd-apreq-2/env/t/cgi-bin .cvsignore
Date Thu, 23 Oct 2003 23:58:15 GMT
randyk      2003/10/23 16:58:15

  Modified:    env      Makefile.am .cvsignore
  Added:       env      test_cgi.c
               env/t    cgi.t
               env/t/conf extra.conf.in
               env/t/cgi-bin .cvsignore
  Log:
  add libapreq_cgi tests.
  
  Revision  Changes    Path
  1.15      +5 -3      httpd-apreq-2/env/Makefile.am
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/Makefile.am,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Makefile.am	17 Oct 2003 06:27:20 -0000	1.14
  +++ Makefile.am	23 Oct 2003 23:58:14 -0000	1.15
  @@ -7,8 +7,9 @@
   lib_LIBRARIES = lib@APREQ_LIBNAME@_cgi.a
   lib@APREQ_LIBNAME@_cgi_a_SOURCES = libapreq_cgi.c
   #
  -#check_PROGRAMS = test_cgi
  -#test_cgi_LDADD = lib@APREQ_LIBNAME@_cgi.a
  +check_PROGRAMS = test_cgi
  +test_cgi_LDADD = lib@APREQ_LIBNAME@_cgi.a
  +test_cgi_SOURCES = test_cgi.c
   
   if BUILD_HTTPD
   
  @@ -44,13 +45,14 @@
   endif
   
   run_tests : t/TEST
  +	-cp -f test_cgi t/cgi-bin
   	@PERL@ t/TEST
   
   test :: all check run_tests
   
   test_clean : cmodules_clean
   	-@PERL@ t/TEST -clean
  -	-rm -rf t/htdocs t/logs t/modules t/TEST
  +	-rm -rf t/htdocs t/logs t/modules t/TEST t/cgi-bin/test_cgi
   
   cmodules_clean:
   	-cd c-modules && $(MAKE) clean
  
  
  
  1.2       +5 -0      httpd-apreq-2/env/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/.cvsignore,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- .cvsignore	11 Jun 2003 01:06:04 -0000	1.1
  +++ .cvsignore	23 Oct 2003 23:58:14 -0000	1.2
  @@ -4,3 +4,8 @@
   Makefile.in
   mod_apreq.la
   mod_apreq.lo
  +test_cgi
  +test_cgi.o
  +test_cgi.exe
  +libapreq_cgi.o
  +libapreq2_cgi.a
  
  
  
  1.3       +75 -18    httpd-apreq-2/env/test_cgi.c
  
  
  
  
  1.1                  httpd-apreq-2/env/t/cgi.t
  
  Index: cgi.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestConfig;
  use Apache::TestRequest qw(GET_BODY UPLOAD_BODY POST_BODY GET_RC GET_HEAD);
  use constant WIN32 => Apache::TestConfig::WIN32;
  use HTTP::Cookies;
  
  my @key_len = (5, 100, 305);
  my @key_num = (5, 15, 26);
  my @keys    = ('a'..'z');
  
  my @big_key_len = (100, 500, 5000, 10000);
  my @big_key_num = (5, 15, 25);
  my @big_keys    = ('a'..'z');
  
  plan tests => 10 + @key_len * @key_num + @big_key_len * @big_key_num;
  
  my $location = '/cgi-bin';
  my $script = $location . (WIN32 ? '/test_cgi.exe' : '/test_cgi');
  my $line_end = WIN32 ? "\r\n" : "\n";
  my $filler = "0123456789" x 20; # < 64K
  
  # GET
  for my $key_len (@key_len) {
      for my $key_num (@key_num) {
          my @query = ();
          my $len = 0;
  
          for my $key (@keys[0..($key_num-1)]) {
              my $pair = "$key=" . 'd' x $key_len;
              $len += length($pair) - 1;
              push @query, $pair;
          }
          my $query = join ";", @query;
  
          t_debug "# of keys : $key_num, key_len $key_len";
          my $body = GET_BODY "$script?$query";
          ok t_cmp($len,
                   $body,
                   "GET long query");
      }
  
  }
  
  # POST
  for my $big_key_len (@big_key_len) {
      for my $big_key_num (@big_key_num) {
          my @query = ();
          my $len = 0;
  
          for my $big_key (@big_keys[0..($big_key_num-1)]) {
              my $pair = "$big_key=" . 'd' x $big_key_len;
              $len += length($pair) - 1;
              push @query, $pair;
          }
          my $query = join ";", @query;
  
          t_debug "# of keys : $big_key_num, big_key_len $big_key_len";
          my $body = POST_BODY($script, content => $query);
          ok t_cmp($len,
                   $body,
                   "POST big data");
      }
  
  }
  
  ok t_cmp("\tfoo => 1$line_end", 
           GET_BODY("$script?foo=1", Content => $filler));
  
  ok t_cmp("\tfoo => ?$line_end\tbar => hello world$line_end", 
           GET_BODY("$script?foo=%3F&bar=hello+world"), "simple get");
  
  my $body = POST_BODY($script, content => 
                       "aaa=$filler;foo=1;bar=2;filler=$filler");
  ok t_cmp("\tfoo => 1$line_end\tbar => 2$line_end", 
           $body, "simple post");
  
  $body = POST_BODY("$script?foo=1", content => 
                    "intro=$filler&bar=2&conclusion=$filler");
  ok t_cmp("\tfoo => 1$line_end\tbar => 2$line_end", 
           $body, "simple post");
  
  $body = UPLOAD_BODY("$script?foo=0", content => $filler);
  ok t_cmp("\tfoo => 0$line_end", 
           $body, "simple upload");
  
  
  {
      my $test  = 'netscape';
      my $key   = 'apache';
      my $value = 'ok';
      my $cookie = qq{$key=$value};
      ok t_cmp($value,
               GET_BODY("$script?test=$test&key=$key", Cookie => $cookie),
               $test);
  }
  {
      my $test  = 'rfc';
      my $key   = 'apache';
      my $value = 'ok';
      my $cookie = qq{\$Version="1"; $key="$value"; \$Path="$location"};
      ok t_cmp(qq{"$value"},
               GET_BODY("$script?test=$test&key=$key", Cookie => $cookie),
               $test);
  }
  {
      my $test  = 'encoded value with space';
      my $key   = 'apache';
      my $value = 'okie dokie';
      my $cookie = "$key=" . join '',
          map {/ / ? '+' : sprintf '%%%.2X', ord} split //, $value;
      ok t_cmp($value,
               GET_BODY("$script?test=$test&key=$key", Cookie => $cookie),
               $test);
  }
  {
      my $test  = 'bake';
      my $key   = 'apache';
      my $value = 'ok';
      my $cookie = "$key=$value";
      my ($header) = GET_HEAD("$script?test=$test&key=$key", 
                              Cookie => $cookie) =~ /^#Set-Cookie:\s+(.+)/m;
      ok t_cmp($cookie, $header, $test);
  }
  {
      my $test  = 'bake2';
      my $key   = 'apache';
      my $value = 'ok';
      my $cookie = qq{\$Version="1"; $key="$value"; \$Path="$location"};
      my ($header) = GET_HEAD("$script?test=$test&key=$key", 
                              Cookie => $cookie) =~ /^#Set-Cookie2:\s+(.+)/m;
      ok t_cmp(qq{$key="$value"; Version=1; path="$location"}, $header, $test);
  }
  
  
  
  1.3       +0 -0      httpd-apreq-2/env/t/conf/extra.conf.in
  
  
  
  
  1.3       +0 -1      httpd-apreq-2/env/t/cgi-bin/.cvsignore
  
  
  
  

Mime
View raw message