httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john sachs <jsa...@covalent.net>
Subject Re: t/modules/rewrite tweaking
Date Tue, 07 Aug 2001 17:22:56 GMT
hi,
first let me explain the test a little.
in this section of code, i am testing the 'rnd' rewriting functionality which takes a text
file like this:

1 one|two|three|four|five|six
2 two|three|four|five|six

and rewrites the key randomly to one of the possibilities you've given it.  in the test, the
expected outcome is something between the number you're requesting and 6 which is max.  therefore
the code:

ok ($r =~ /^[$r-6]$/);

the problem is i didnt take into account the condition you've run into where $r is a chunk
of text with special characters in it.  i will have to somehow check for this case before
i go blindly dumping it into the regexp.

as a side note, i think you're getting this error because your particular build of apache
does not contain mod_rewrite.  very soon, the test will tell you its not going to run on your
platform...heh.  i plan to talk to doug about this today.
-j
On Wed, Aug 08, 2001 at 12:46:54AM +0800, Stas Bekman wrote:
+ On Tue, 7 Aug 2001, john sachs wrote:
+ 
+ > it is a range.
+ 
+ so according to the error:
+ 
+ "Invalid [] range ">-6" before HERE mark in regex"
+ 
+ what kind of range ">-6" is?
+ 
+ 
+ > On Tue, Aug 07, 2001 at 02:13:35PM +0800, Stas Bekman wrote:
+ > + perl t/TEST httpd /home/stas/httpd-2.0/bin/httpd -run t/modules/rewrite.t
+ > + modules/rewrite.....NOK 6Invalid [] range ">-6" before HERE mark in regex
+ > + m/^[<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
+ > + <html><head>
+ > + <title>404 Not Found</title>
+ > + </head><body>
+ > + <h1>Not Found</h1>
+ > + <p>The requested URL /modules/rewrite/1 was not found on this server.</p>
+ > + </body></html>-6 << HERE ]$/
+ > + modules/rewrite.....dubious
+ > + 	Test returned status 9 (wstat 2304, 0x900)
+ > + DIED. FAILED tests 1-27
+ > + 	Failed 27/27 tests, 0.00% okay
+ > + Failed Test       Stat Wstat Total Fail  Failed  List of Failed
+ > + -------------------------------------------------------------------------------
+ > + modules/rewrite.t    9  2304    27   27 100.00%  1-27
+ > + error running tests (please examine t/logs/error_log)
+ > + Failed 1/1 test scripts, 0.00% okay. 27/27 subtests failed, 0.00% okay.
+ > +
+ > + the problem is in "Invalid [] range ">-6" before HERE mark in regex" at
+ > + least that's what I see with perl   5.6.1.
+ > +
+ > + If - is not a range (which apparently it's not), you should escape it:
+ > +
+ > + Index: t/modules/rewrite.t
+ > + ===================================================================
+ > + RCS file: /home/cvs/httpd-test/perl-framework/t/modules/rewrite.t,v
+ > + retrieving revision 1.1
+ > + diff -u -r1.1 rewrite.t
+ > + --- t/modules/rewrite.t	2001/08/02 16:38:19	1.1
+ > + +++ t/modules/rewrite.t	2001/08/07 05:54:43
+ > + @@ -25,7 +25,7 @@
+ > +  		chomp $r;
+ > +
+ > +  		if ($_ eq 'RND') {
+ > + -			ok ($r =~ /^[$r-6]$/);
+ > + +			ok ($r =~ /^[$r\-6]$/);
+ > +  		} else {
+ > +  			ok ($r eq $n);
+ > +  		}
+ > +
+ > + Also I've applied the 4 chars indent convention that we use (let me know
+ > + if you don't care, so here is a complete patch:
+ > +
+ > + Index: t/modules/rewrite.t
+ > + ===================================================================
+ > + RCS file: /home/cvs/httpd-test/perl-framework/t/modules/rewrite.t,v
+ > + retrieving revision 1.1
+ > + diff -u -r1.1 rewrite.t
+ > + --- t/modules/rewrite.t	2001/08/02 16:38:19	1.1
+ > + +++ t/modules/rewrite.t	2001/08/07 05:51:15
+ > + @@ -16,20 +16,20 @@
+ > +  plan tests => @map * @num + 3;
+ > +
+ > +  foreach (@map) {
+ > + -	foreach my $n (@num) {
+ > + -		## throw $_ into upper case just so we can test out internal
+ > + -		## 'tolower' map in mod_rewrite
+ > + -		$_=uc($_);
+ > + +    foreach my $n (@num) {
+ > + +        ## throw $_ into upper case just so we can test out internal
+ > + +        ## 'tolower' map in mod_rewrite
+ > + +        $_ = uc($_);
+ > +
+ > + -		$r = GET_BODY "/modules/rewrite/$n", 'Accept' => $_;
+ > + -		chomp $r;
+ > + +        $r = GET_BODY "/modules/rewrite/$n", 'Accept' => $_;
+ > + +        chomp $r;
+ > +
+ > + -		if ($_ eq 'RND') {
+ > + -			ok ($r =~ /^[$r-6]$/);
+ > + -		} else {
+ > + -			ok ($r eq $n);
+ > + -		}
+ > + -	}
+ > + +        if ($_ eq 'RND') {
+ > + +            ok ($r =~ /^[$r\-6]$/);
+ > + +        } else {
+ > + +            ok ($r eq $n);
+ > + +        }
+ > + +    }
+ > +  }
+ > +
+ > +  $r = GET_BODY "/modules/rewrite/", 'Accept' => 7;
+ > +
+ > +
+ > +
+ > + note that all sub-tests in this test file are failing for me, with the
+ > + latest apache built as:
+ > +
+ > + make distclean
+ > + ./buildconf
+ > + ./configure --prefix=$HOME/httpd-2.0 \
+ > +    --with-mpm=threaded --enable-so \
+ > +    --enable-rewrite=shared
+ > + make && make install
+ > +
+ > + [Tue Aug 07 14:09:00 2001] [error] [client 127.0.0.1] File does not exist:
+ > + /home/stas/apache.org/httpd-test/perl-framework/t/htdocs/modules/rewrite/6
+ > + [Tue Aug 07 14:09:01 2001] [error] [client 127.0.0.1] Directory index
+ > + forbidden by rule:
+ > + /home/stas/apache.org/httpd-test/perl-framework/t/htdocs/modules/rewrite/
+ > +
+ > + another important IMHO note is to test whether the feature under test is
+ > + enabled and perform the skip operation if not, rather then report failure.
+ > + In addition during the skip, you can print a note, how to add the missing
+ > + feature.
+ > +
+ > + _____________________________________________________________________
+ > + Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
+ > + http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
+ > + mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
+ > + http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
+ > +
+ > +
+ > +
+ > +
+ >
+ 
+ 
+ 
+ _____________________________________________________________________
+ Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
+ http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
+ mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
+ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
+ 
+ 

Mime
View raw message