You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-commits@perl.apache.org by st...@apache.org on 2005/10/29 03:50:11 UTC
svn commit: r329348 - in /perl/Apache-Test/trunk: MANIFEST
lib/Apache/TestConfig.pm t/cgi-bin/ t/cgi-bin/next_available_port.pl.PL
t/conf/extra.conf.in t/next_available_port.t
Author: stas
Date: Fri Oct 28 18:50:08 2005
New Revision: 329348
URL: http://svn.apache.org/viewcvs?rev=329348&view=rev
Log:
add NextAvailablePort implementation and tests
(still need to add docs and
change the implementation to use a callback system)
Added:
perl/Apache-Test/trunk/t/cgi-bin/next_available_port.pl.PL (with props)
perl/Apache-Test/trunk/t/next_available_port.t (with props)
Modified:
perl/Apache-Test/trunk/MANIFEST
perl/Apache-Test/trunk/lib/Apache/TestConfig.pm
perl/Apache-Test/trunk/t/cgi-bin/ (props changed)
perl/Apache-Test/trunk/t/conf/extra.conf.in
Modified: perl/Apache-Test/trunk/MANIFEST
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/MANIFEST?rev=329348&r1=329347&r2=329348&view=diff
==============================================================================
--- perl/Apache-Test/trunk/MANIFEST (original)
+++ perl/Apache-Test/trunk/MANIFEST Fri Oct 28 18:50:08 2005
@@ -44,9 +44,11 @@
lib/Bundle/ApacheTest.pm
t/TEST.PL
t/bad_coding.t
+t/cgi-bin/cookies.pl.PL
+t/cgi-bin/next_available_port.pl.PL
t/conf/extra.conf.in
t/cookies.t
-t/cgi-bin/cookies.pl.PL
+t/next_available_port.t
t/ping.t
t/redirect.t
t/request.t
Modified: perl/Apache-Test/trunk/lib/Apache/TestConfig.pm
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/lib/Apache/TestConfig.pm?rev=329348&r1=329347&r2=329348&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestConfig.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestConfig.pm Fri Oct 28 18:50:08 2005
@@ -1118,9 +1118,15 @@
s[@(\w+)@]
[ my $key = lc $1;
- exists $self->{vars}->{$key}
- ? $self->{vars}->{$key}
- : die "invalid token: \@$1\@ $file\n";
+ if ($key eq 'nextavailableport') {
+ $self->server->select_next_port;
+ }
+ elsif (exists $self->{vars}->{$key}) {
+ $self->{vars}->{$key};
+ }
+ else {
+ die "invalid token: \@$1\@ $file\n";
+ }
]ge;
}
Propchange: perl/Apache-Test/trunk/t/cgi-bin/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Oct 28 18:50:08 2005
@@ -1,2 +1,3 @@
cookies.pl
+next_available_port.pl
Added: perl/Apache-Test/trunk/t/cgi-bin/next_available_port.pl.PL
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/t/cgi-bin/next_available_port.pl.PL?rev=329348&view=auto
==============================================================================
--- perl/Apache-Test/trunk/t/cgi-bin/next_available_port.pl.PL (added)
+++ perl/Apache-Test/trunk/t/cgi-bin/next_available_port.pl.PL Fri Oct 28 18:50:08 2005
@@ -0,0 +1,4 @@
+use strict;
+
+print "Content-Type: text/plain\n\n";
+print $ENV{NextAvailablePort} || '';
Propchange: perl/Apache-Test/trunk/t/cgi-bin/next_available_port.pl.PL
------------------------------------------------------------------------------
svn:eol-style = native
Modified: perl/Apache-Test/trunk/t/conf/extra.conf.in
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/t/conf/extra.conf.in?rev=329348&r1=329347&r2=329348&view=diff
==============================================================================
--- perl/Apache-Test/trunk/t/conf/extra.conf.in (original)
+++ perl/Apache-Test/trunk/t/conf/extra.conf.in Fri Oct 28 18:50:08 2005
@@ -36,5 +36,9 @@
AllowOverride None
Options +ExecCGI
</Directory>
+
+ # t/next_available_port.t
+ SetEnv NextAvailablePort @NextAvailablePort@
+
</IfModule>
Added: perl/Apache-Test/trunk/t/next_available_port.t
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/t/next_available_port.t?rev=329348&view=auto
==============================================================================
--- perl/Apache-Test/trunk/t/next_available_port.t (added)
+++ perl/Apache-Test/trunk/t/next_available_port.t Fri Oct 28 18:50:08 2005
@@ -0,0 +1,15 @@
+# this test tests how a cookie jar can be passed (needs lwp)
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil;
+
+plan tests => 1, need_cgi;
+
+my $url = '/cgi-bin/next_available_port.pl';
+
+my $port = GET_BODY($url) || '';
+ok $port, qr/^\d+$/, "next available port number";
Propchange: perl/Apache-Test/trunk/t/next_available_port.t
------------------------------------------------------------------------------
svn:eol-style = native