You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philip M. Gollucci" <pg...@p6m7g8.com> on 2005/04/22 05:10:52 UTC
[TODO] completed
Hi,
knock out 1 of the todo/bugs_apr_ext :)
FYI: APR::NetLib does not exist.
See attached.
HTH
--
END
------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
Re: [TODO] completed
Posted by Stas Bekman <st...@stason.org>.
Philip M. Gollucci wrote:
> Hi,
>
> knock out 1 of the todo/bugs_apr_ext :)
I've committed a part of the patch as discussed in this thread with some
tweaks: http://svn.apache.org/viewcvs?rev=164431&view=rev
Please don't forget indent 4 in the future patches, Philip :)
> FYI: APR::NetLib does not exist.
which became APR::IpSubnet and it's still untested in apr-ext.
Finally, in the Changes file, we log only changes of importance to users,
so changes in tests aren't logged, that's why that part wasn't committed.
Thank you, Philip.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [TODO] completed
Posted by Stas Bekman <st...@stason.org>.
Philip M. Gollucci wrote:
> Stas Bekman wrote:
>
>> Philip M. Gollucci wrote:
>> Thanks Philip, but what exactly are we testing here? We already load
>> all these modules in other tests. By:
>
> Yes, I agree. The todo comment simply asked to load them and add
> functional testing on an
> as needed basis. If we really wanted functional testing, we could use
> the previous to start adding tests "real" tests to ?
Ah, OK, you are right Philip, the idea was to at least make sure that they
get loaded.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [TODO] completed
Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Stas Bekman wrote:
> Philip M. Gollucci wrote:
> Thanks Philip, but what exactly are we testing here? We already load all
> these modules in other tests. By:
Yes, I agree. The todo comment simply asked to load them and add
functional testing on an
as needed basis. If we really wanted functional testing, we could use
the previous to start adding tests "real" tests to ?
> > -* modules that we need to add tests for in apr-ext:
>
> the todo list meant to add functional testing. Please look at
> t/lib/TestAPRlib/.
Yep, looked at that.
> Really those are previously existing tests that were
> converted to be used by inside and outside of mod_perl tests.
--
END
------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [TODO] completed
Posted by Stas Bekman <st...@stason.org>.
Philip M. Gollucci wrote:
> Hi,
>
> knock out 1 of the todo/bugs_apr_ext :)
> FYI: APR::NetLib does not exist.
Thanks Philip, but what exactly are we testing here? We already load all
these modules in other tests. By:
> -* modules that we need to add tests for in apr-ext:
the todo list meant to add functional testing. Please look at
t/lib/TestAPRlib/. Really those are previously existing tests that were
converted to be used by inside and outside of mod_perl tests.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [TODO] completed
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Sat, 23 Apr 2005, Stas Bekman wrote:
>
>
>>Randy Kobes wrote:
>
> [ .. ]
>
>>>That'd be nice to clean this up ... I'm wondering
>>>though about having, in particular, apr-ext tests for
>>> socket.pm
>>> sockaddr.pm
>>> brigade.pm
>>>that simply load the modules. In looking at the corrsponding
>>>responses in t/response/TestAPR/, it appears in their
>>>current form that all 3 of these require mod_perl to do
>>>their work. Might having a corresponding apr-ext test lead
>>>some to believe that these function outside of mod_perl, and
>>>so in this context their presence could be considered
>>>somewhat misleading?
>>
>>That's correct for the socket modules, as there is no way
>>to get the apr socket at the moment but via mod_perl. but
>>what's wrong with brigade API? you can create one
>>yourself:
>>
>> $bb = APR::Brigade->new($pool, APR::BucketAlloc->new($pool));
>
>
> That's right - I don't know why I didn't recognize this
> at the time we were refactoring the apr/apr-ext tests.
> How about the following diff, which adds a brigade test
> to apr-ext?
+1
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [TODO] completed
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Sat, 23 Apr 2005, Stas Bekman wrote:
> Randy Kobes wrote:
[ .. ]
> > That'd be nice to clean this up ... I'm wondering
> > though about having, in particular, apr-ext tests for
> > socket.pm
> > sockaddr.pm
> > brigade.pm
> > that simply load the modules. In looking at the corrsponding
> > responses in t/response/TestAPR/, it appears in their
> > current form that all 3 of these require mod_perl to do
> > their work. Might having a corresponding apr-ext test lead
> > some to believe that these function outside of mod_perl, and
> > so in this context their presence could be considered
> > somewhat misleading?
>
> That's correct for the socket modules, as there is no way
> to get the apr socket at the moment but via mod_perl. but
> what's wrong with brigade API? you can create one
> yourself:
>
> $bb = APR::Brigade->new($pool, APR::BucketAlloc->new($pool));
That's right - I don't know why I didn't recognize this
at the time we were refactoring the apr/apr-ext tests.
How about the following diff, which adds a brigade test
to apr-ext?
=================================================================
Index: t/apr-ext/brigade.t
===================================================================
--- t/apr-ext/brigade.t (revision 0)
+++ t/apr-ext/brigade.t (revision 0)
@@ -0,0 +1,11 @@
+#!perl -T
+
+use strict;
+use warnings FATAL => 'all';
+use Apache::Test;
+
+use TestAPRlib::brigade;
+
+plan tests => TestAPRlib::brigade::num_of_tests();
+
+TestAPRlib::brigade::test();
Property changes on: t/apr-ext/brigade.t
___________________________________________________________________
Name: svn:eol-style
+ native
Index: t/response/TestAPR/brigade.pm
===================================================================
--- t/response/TestAPR/brigade.pm (revision 164419)
+++ t/response/TestAPR/brigade.pm (working copy)
@@ -16,13 +16,17 @@
use Apache2::Const -compile => 'OK';
+use TestAPRlib::brigade;
+
sub handler {
my $r = shift;
my $ba = $r->connection->bucket_alloc;
- plan $r, tests => 14;
+ plan $r, tests => 14 + TestAPRlib::brigade::num_of_tests();
+ TestAPRlib::brigade::test();
+
# basic + pool + destroy
{
my $bb = APR::Brigade->new($r->pool, $ba);
Index: t/lib/TestAPRlib/brigade.pm
===================================================================
--- t/lib/TestAPRlib/brigade.pm (revision 0)
+++ t/lib/TestAPRlib/brigade.pm (revision 0)
@@ -0,0 +1,106 @@
+package TestAPRlib::brigade;
+
+# testing APR::Brigade in this tests.
+# Other tests do that too:
+# TestAPR::flatten : flatten()
+# TestAPR::bucket : is_empty(), first(), last()
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+
+use APR::Pool ();
+use APR::Brigade ();
+use APR::Bucket ();
+use APR::BucketAlloc ();
+
+use Apache2::Const -compile => 'OK';
+
+sub num_of_tests {
+ return 14;
+}
+
+sub test {
+
+ my $p = APR::Pool->new();
+ my $ba = APR::BucketAlloc->new($p);
+
+ # basic + pool + destroy
+ {
+ my $bb = APR::Brigade->new($p, $ba);
+
+ t_debug('$bb is defined');
+ ok defined $bb;
+
+ t_debug('$bb ISA APR::Brigade object');
+ ok $bb->isa('APR::Brigade');
+
+ my $pool = $bb->pool;
+
+ t_debug('$pool is defined');
+ ok defined $pool;
+
+ t_debug('$pool ISA APR::Pool object');
+ ok $pool->isa('APR::Pool');
+
+ t_debug("destroy");
+ $bb->destroy;
+ ok 1;
+ }
+
+ # concat / split / length / flatten
+ {
+ my $bb1 = APR::Brigade->new($p, $ba);
+ $bb1->insert_head(APR::Bucket->new($ba, "11"));
+ $bb1->insert_tail(APR::Bucket->new($ba, "12"));
+
+ my $bb2 = APR::Brigade->new($p, $ba);
+ $bb2->insert_head(APR::Bucket->new($ba, "21"));
+ $bb2->insert_tail(APR::Bucket->new($ba, "22"));
+
+ # concat
+ $bb1->concat($bb2);
+ # bb1: 11, 12, 21, 22
+ ok t_cmp($bb1->length, 8, "total data length in bb");
+ my $len = $bb1->flatten(my $data);
+ ok t_cmp($len, 8, "bb flatten/len");
+ ok t_cmp($data, "11122122", "bb flatten/data");
+ t_debug('$bb2 is empty');
+ ok $bb2->is_empty;
+
+ # split
+ my $b = $bb1->first; # 11
+ $b = $bb1->next($b); # 12
+ my $bb3 = $bb1->split($b);
+
+ # bb1: 11, bb3: 12, 21, 22
+ $len = $bb1->flatten($data);
+ ok t_cmp($len, 2, "bb1 flatten/len");
+ ok t_cmp($data, "11", "bb1 flatten/data");
+ $len = $bb3->flatten($data);
+ ok t_cmp($len, 6, "bb3 flatten/len");
+ ok t_cmp($data, "122122", "bb3 flatten/data");
+ }
+
+ # out-of-scope pools
+ {
+ my $bb1 = APR::Brigade->new(APR::Pool->new, $ba);
+ $bb1->insert_head(APR::Bucket->new($ba, "11"));
+ $bb1->insert_tail(APR::Bucket->new($ba, "12"));
+
+ # try to overwrite the temp pool data
+ require APR::Table;
+ my $table = APR::Table::make(APR::Pool->new, 50);
+ $table->set($_ => $_) for 'aa'..'za';
+ # now test that we are still OK
+
+ my $len = $bb1->flatten(my $data);
+ ok t_cmp($data, "1112", "correct data");
+ }
+
+ Apache2::Const::OK;
+}
+
+1;
Property changes on: t/lib/TestAPRlib/brigade.pm
___________________________________________________________________
Name: svn:eol-style
+ native
====================================================================
--
best regards,
randy
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [TODO] completed
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Thu, 21 Apr 2005, Philip M. Gollucci wrote:
>
>
>>Hi,
>>
>>knock out 1 of the todo/bugs_apr_ext :)
>>FYI: APR::NetLib does not exist.
>>
>>See attached.
>>
>>HTH
>
>
> That'd be nice to clean this up ... I'm wondering
> though about having, in particular, apr-ext tests for
> socket.pm
> sockaddr.pm
> brigade.pm
> that simply load the modules. In looking at the corrsponding
> responses in t/response/TestAPR/, it appears in their
> current form that all 3 of these require mod_perl to do
> their work. Might having a corresponding apr-ext test lead
> some to believe that these function outside of mod_perl, and
> so in this context their presence could be considered
> somewhat misleading?
That's correct for the socket modules, as there is no way to get the apr
socket at the moment but via mod_perl. but what's wrong with brigade API?
you can create one yourself:
$bb = APR::Brigade->new($pool, APR::BucketAlloc->new($pool));
> Also, I seem to recall that we had a test just for
> APR::Const, but dropped it, as APR::Const was used in a
> number of the other tests anyway. The test itself I seem to
> remember was just comparing some APR::Const::* to a
> numerical value, which may be difficult to maintain, in case
> APR at the C level changes the numerical value.
Right and APR::Const is indeed loaded by other apr-ext tests anyway.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [TODO] completed
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 21 Apr 2005, Philip M. Gollucci wrote:
> Hi,
>
> knock out 1 of the todo/bugs_apr_ext :)
> FYI: APR::NetLib does not exist.
>
> See attached.
>
> HTH
That'd be nice to clean this up ... I'm wondering
though about having, in particular, apr-ext tests for
socket.pm
sockaddr.pm
brigade.pm
that simply load the modules. In looking at the corrsponding
responses in t/response/TestAPR/, it appears in their
current form that all 3 of these require mod_perl to do
their work. Might having a corresponding apr-ext test lead
some to believe that these function outside of mod_perl, and
so in this context their presence could be considered
somewhat misleading?
Also, I seem to recall that we had a test just for
APR::Const, but dropped it, as APR::Const was used in a
number of the other tests anyway. The test itself I seem to
remember was just comparing some APR::Const::* to a
numerical value, which may be difficult to maintain, in case
APR at the C level changes the numerical value.
--
best regards,
randy
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org