perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@apache.org
Subject svn commit: r374792 - /perl/modperl/trunk/t/lib/TestAPRlib/table.pm
Date Sat, 04 Feb 2006 00:13:25 GMT
Author: gozer
Date: Fri Feb  3 16:13:23 2006
New Revision: 374792

URL: http://svn.apache.org/viewcvs?rev=374792&view=rev
Log:
apr_table_(copy|overlay) has hierarchical requirements on the pool
being used, since it copies content from table to table without
reallocing it.

The test logic was broken and would produce these kind of aborts
when apr was compiled with -DAPR_POOL_DEBUG:

  apr_table_copy: t's pool is not an ancestor of p
  apr_table_overlay: overlay's pool is not an ancestor of p
  apr_table_overlay: base's pool is not an ancestor of p

This reworks the test logic a bit to keep on testing what it was
testing, while passing correct pools to the various table methods


Modified:
    perl/modperl/trunk/t/lib/TestAPRlib/table.pm

Modified: perl/modperl/trunk/t/lib/TestAPRlib/table.pm
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/lib/TestAPRlib/table.pm?rev=374792&r1=374791&r2=374792&view=diff
==============================================================================
--- perl/modperl/trunk/t/lib/TestAPRlib/table.pm (original)
+++ perl/modperl/trunk/t/lib/TestAPRlib/table.pm Fri Feb  3 16:13:23 2006
@@ -307,11 +307,16 @@
     # - copy
     # - overlay
     {
-        my $table = APR::Table::make(APR::Pool->new, 10);
-        $table->set($_ => $_) for 1..20;
-        ok t_cmp $table->get(20), 20, "no segfault";
+        {
+            my $table = APR::Table::make(APR::Pool->new, 10);
+            $table->set($_ => $_) for 1..20;
+            ok t_cmp $table->get(20), 20, "no segfault";
+        }
 
-        my $table_copy = $table->copy(APR::Pool->new);
+        my $pool = APR::Pool->new;
+        my $table = APR::Table::make($pool, 10);
+        $table->set($_ => $_) for 1..20;
+        my $table_copy = $table->copy($pool->new);
         {
             # verify that the temp pool used to create $table_copy was
             # not freed, by allocating a new table to fill with a
@@ -325,9 +330,12 @@
         }
         ok t_cmp $table_copy->get(20), 20, "no segfault/valid data";
 
-        my $table2 = APR::Table::make(APR::Pool->new, 1);
+        my $table2 = APR::Table::make($pool, 1);
         $table2->set($_**2 => $_**2) for 1..20;
-        my $overlay = $table_copy->overlay($table2, APR::Pool->new);
+        my $table2_copy = APR::Table::make($pool, 1);
+        $table2_copy->set($_ => $_) for 1..20;
+        
+        my $overlay = $table2_copy->overlay($table2, $pool->new);
         {
             # see the comment for above's:
             # $table_copy = $table->copy(APR::Pool->new);



Mime
View raw message