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 jo...@apache.org on 2004/05/05 17:52:56 UTC

cvs commit: httpd-test/perl-framework/t/modules cgi.t

jorton      2004/05/05 08:52:56

  Modified:    perl-framework/t/htdocs/modules/cgi .cvsignore
               perl-framework/t/modules cgi.t
  Added:       perl-framework/t/htdocs/modules/cgi nph-stderr.pl.PL
                        stderr1.pl.PL stderr2.pl.PL stderr3.pl.PL
  Log:
  Add some simple tests for CGI script stderr handling.
  
  Revision  Changes    Path
  1.5       +4 -1      httpd-test/perl-framework/t/htdocs/modules/cgi/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/htdocs/modules/cgi/.cvsignore,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -w -d -u -r1.4 -r1.5
  --- .cvsignore	24 Nov 2003 09:33:44 -0000	1.4
  +++ .cvsignore	5 May 2004 15:52:55 -0000	1.5
  @@ -4,4 +4,7 @@
   bogus-perl.pl
   env.pl
   nph-test.pl
  -
  +stderr1.pl
  +stderr2.pl
  +stderr3.pl
  +nph-stderr.pl
  
  
  
  1.1                  httpd-test/perl-framework/t/htdocs/modules/cgi/nph-stderr.pl.PL
  
  Index: nph-stderr.pl.PL
  ===================================================================
  # produces lots of stderr output
  
  print "HTTP/1.0 200 OK\r\n";
  
  print STDERR 'x'x8192;
  print "Content-Type: text/plain\r\n\r\n";
  
  print "this is nph-stdout";
  
  close STDOUT;
  
  print STDERR "this is nph-stderr";
  
  
  
  1.1                  httpd-test/perl-framework/t/htdocs/modules/cgi/stderr1.pl.PL
  
  Index: stderr1.pl.PL
  ===================================================================
  # produces lots of stderr output
  
  print STDERR 'x'x8192;
  
  print "Content-Type: text/plain\n\n";
  
  print "this is stdout";
  
  
  
  1.1                  httpd-test/perl-framework/t/htdocs/modules/cgi/stderr2.pl.PL
  
  Index: stderr2.pl.PL
  ===================================================================
  # closes stderr during script execution
  
  close STDERR;
  
  print "Content-Type: text/plain\n\n";
  
  sleep 1;
  
  print "this is also stdout";
  
  
  
  1.1                  httpd-test/perl-framework/t/htdocs/modules/cgi/stderr3.pl.PL
  
  Index: stderr3.pl.PL
  ===================================================================
  # closes stderr during script execution
  
  print "Content-Type: text/plain\n\n";
  print "this is more stdout";
  
  close STDOUT;
  
  print STDERR "this is a post-stdout-closure error message";
  
  
  
  1.14      +24 -1     httpd-test/perl-framework/t/modules/cgi.t
  
  Index: cgi.t
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/modules/cgi.t,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -w -d -u -r1.13 -r1.14
  --- cgi.t	24 Nov 2003 08:41:05 -0000	1.13
  +++ cgi.t	5 May 2004 15:52:56 -0000	1.14
  @@ -7,6 +7,7 @@
   use File::stat;
   
   my $have_apache_2 = have_apache 2;
  +my $have_apache_21 = have_min_apache_version "2.1.0";
   
   ## mod_cgi test
   ##
  @@ -70,7 +71,23 @@
       'acceptpathinfodefault.sh/foo' => {
           'rc' => 200,
           'expect' => '/foo'
  -    }
  +    },
  +    'stderr1.pl' => {
  +        'rc' => 200,
  +        'expect' => 'this is stdout'
  +    },
  +    'stderr2.pl' => {
  +        'rc' => 200,
  +        'expect' => 'this is also stdout'
  +    },
  +    'stderr3.pl' => {
  +        'rc' => 200,
  +        'expect' => 'this is more stdout'
  +    },
  +    'nph-stderr.pl' => {
  +        'rc' => 200,
  +        'expect' => 'this is nph-stdout'
  +    },
   );
   
   #XXX: find something that'll on other platforms (/bin/sh aint it)
  @@ -81,6 +98,12 @@
       delete @test{qw(acceptpathinfoon.sh acceptpathinfoon.sh/foo)};
       delete @test{qw(acceptpathinfooff.sh acceptpathinfooff.sh/foo)};
       delete @test{qw(acceptpathinfodefault.sh acceptpathinfodefault.sh/foo)};
  +}
  +
  +# CGI stderr handling is broken in 2.0 on all platforms, and fixed
  +# in 2.1 only on Unixes.
  +if ($have_apache_2 && (!$have_apache_21 || Apache::TestConfig::WINFU())) {
  +    delete @test{qw(stderr1.pl stderr2.pl stderr3.pl nph-stderr.pl)};
   }
   
   my $tests = ((keys %test) * 2) + (@post_content * 3) + 4;