$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: igaztanaga_at_[hidden]
Date: 2007-11-18 05:51:20
Author: igaztanaga
Date: 2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
New Revision: 41197
URL: http://svn.boost.org/trac/boost/changeset/41197
Log:
Interprocess changes to support systems with filesystem-based shared memory
Added:
   trunk/libs/interprocess/test/node_pool_test.hpp   (contents, props changed)
Text files modified: 
   trunk/libs/interprocess/test/adaptive_node_pool_test.cpp            |    14 ++-                                     
   trunk/libs/interprocess/test/data_test.cpp                          |     1                                         
   trunk/libs/interprocess/test/dummy_test_allocator.hpp               |    14 +-                                      
   trunk/libs/interprocess/test/expand_bwd_test_allocator.hpp          |     3                                         
   trunk/libs/interprocess/test/file_mapping_test.cpp                  |     1                                         
   trunk/libs/interprocess/test/flat_tree_test.cpp                     |    19 +++++                                   
   trunk/libs/interprocess/test/map_test.hpp                           |    11 +-                                      
   trunk/libs/interprocess/test/memory_algorithm_test_template.hpp     |   114 ++++++++++++++++++++++++++++++          
   trunk/libs/interprocess/test/node_pool_test.cpp                     |   148 +-------------------------------------- 
   trunk/libs/interprocess/test/null_index_test.cpp                    |     2                                         
   trunk/libs/interprocess/test/set_test.hpp                           |     1                                         
   trunk/libs/interprocess/test/sharable_mutex_test_template.hpp       |     2                                         
   trunk/libs/interprocess/test/shared_memory_mapping_test.cpp         |     1                                         
   trunk/libs/interprocess/test/shared_memory_test.cpp                 |     1                                         
   trunk/libs/interprocess/test/tree_test.cpp                          |     1                                         
   trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp |     1                                         
   trunk/libs/interprocess/test/windows_shared_memory_test.cpp         |     1                                         
   17 files changed, 171 insertions(+), 164 deletions(-)
Modified: trunk/libs/interprocess/test/adaptive_node_pool_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/adaptive_node_pool_test.cpp	(original)
+++ trunk/libs/interprocess/test/adaptive_node_pool_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -7,15 +7,21 @@
 // See http://www.boost.org/libs/interprocess for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
-
 #include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/managed_shared_memory.hpp>
+#include "node_pool_test.hpp"
 #include <boost/interprocess/allocators/detail/adaptive_node_pool.hpp>
 
-using namespace boost::interprocess;
-
 int main ()
 {
+   using namespace boost::interprocess;
+   typedef managed_shared_memory::segment_manager segment_manager;
+
+   typedef detail::private_adaptive_node_pool
+      <segment_manager, 4, 64, 64> node_pool_t;
+
+   if(!test::test_all_node_pool<node_pool_t>())
+      return 1;
+
    return 0;
 }
 
Modified: trunk/libs/interprocess/test/data_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/data_test.cpp	(original)
+++ trunk/libs/interprocess/test/data_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -17,6 +17,7 @@
 #include <algorithm>
 #include <functional>
 #include <string>
+#include <cstdio>    //std::remove
 #include "print_container.hpp"
 #include "get_process_id_name.hpp"
 
Modified: trunk/libs/interprocess/test/dummy_test_allocator.hpp
==============================================================================
--- trunk/libs/interprocess/test/dummy_test_allocator.hpp	(original)
+++ trunk/libs/interprocess/test/dummy_test_allocator.hpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -28,7 +28,7 @@
 #include <algorithm>
 #include <cstddef>
 #include <stdexcept>
-#include <assert.h>
+#include <cassert>
 
 //!\file
 //!Describes an allocator to test expand capabilities
@@ -75,12 +75,12 @@
    {} 
 
    //!Constructor from other dummy_test_allocator. Never throws
-   dummy_test_allocator(const dummy_test_allocator &other)
+   dummy_test_allocator(const dummy_test_allocator &)
    {}
 
    //!Constructor from related dummy_test_allocator. Never throws
    template<class T2>
-   dummy_test_allocator(const dummy_test_allocator<T2> &other)
+   dummy_test_allocator(const dummy_test_allocator<T2> &)
    {}
 /*
    pointer address(reference value) 
@@ -137,14 +137,14 @@
 
 //!Equality test for same type of dummy_test_allocator
 template<class T> inline
-bool operator==(const dummy_test_allocator<T>  &alloc1, 
-                const dummy_test_allocator<T>  &alloc2)
+bool operator==(const dummy_test_allocator<T>  &, 
+                const dummy_test_allocator<T>  &)
 {  return false; }
 
 //!Inequality test for same type of dummy_test_allocator
 template<class T> inline
-bool operator!=(const dummy_test_allocator<T>  &alloc1, 
-                const dummy_test_allocator<T>  &alloc2)
+bool operator!=(const dummy_test_allocator<T>  &, 
+                const dummy_test_allocator<T>  &)
 {  return true; }
 
 }  //namespace test {
Modified: trunk/libs/interprocess/test/expand_bwd_test_allocator.hpp
==============================================================================
--- trunk/libs/interprocess/test/expand_bwd_test_allocator.hpp	(original)
+++ trunk/libs/interprocess/test/expand_bwd_test_allocator.hpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -28,7 +28,7 @@
 #include <algorithm>
 #include <cstddef>
 #include <stdexcept>
-#include <assert.h>
+#include <cassert>
 
 //!\file
 //!Describes an allocator to test expand capabilities
@@ -147,7 +147,6 @@
          assert(0);
          throw std::bad_alloc();
       }
-      return std::pair<pointer, bool>(0, true);
    }
 
    //!Returns maximum the number of objects the previously allocated memory
Modified: trunk/libs/interprocess/test/file_mapping_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/file_mapping_test.cpp	(original)
+++ trunk/libs/interprocess/test/file_mapping_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -16,6 +16,7 @@
 #include <memory>
 #include <cstdio>
 #include <string>
+#include <cstdio>    //std::remove
 #include "get_process_id_name.hpp"
 
 using namespace boost::interprocess;
Modified: trunk/libs/interprocess/test/flat_tree_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/flat_tree_test.cpp	(original)
+++ trunk/libs/interprocess/test/flat_tree_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -123,6 +123,16 @@
       std::cout << "Error in set_test<MyShmSet>" << std::endl;
       return 1;
    }
+
+   if (0 != set_test_copyable<my_managed_shared_memory
+                  ,MyShmSet
+                  ,MyStdSet
+                  ,MyShmMultiSet
+                  ,MyStdMultiSet>()){
+      std::cout << "Error in set_test<MyShmSet>" << std::endl;
+      return 1;
+   }
+
    if (0 != set_test<my_managed_shared_memory
                   ,MyMovableShmSet
                   ,MyStdSet
@@ -150,6 +160,15 @@
       return 1;
    }
 
+   if (0 != map_test_copyable<my_managed_shared_memory
+                  ,MyShmMap
+                  ,MyStdMap
+                  ,MyShmMultiMap
+                  ,MyStdMultiMap>()){
+      std::cout << "Error in set_test<MyShmMap>" << std::endl;
+      return 1;
+   }
+
 //   if (0 != map_test<my_managed_shared_memory
 //                  ,MyMovableShmMap
 //                  ,MyStdMap
Modified: trunk/libs/interprocess/test/map_test.hpp
==============================================================================
--- trunk/libs/interprocess/test/map_test.hpp	(original)
+++ trunk/libs/interprocess/test/map_test.hpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -97,19 +97,20 @@
 
          MyStdMap *stdmap2 = new MyStdMap(aux_vect2, aux_vect2 + 50);
 
-         MyShmMultiMap *shmmultiset2 = 
+         MyShmMultiMap *shmmultimap2 = 
             segment.template construct<MyShmMultiMap>("MyShmMultiMap2")
                (detail::make_move_iterator(&aux_vect3[0])
                , detail::make_move_iterator(aux_vect3 + 50)
                , std::less<IntType>(), segment.get_segment_manager());
 
-         MyStdMultiMap *stdmultiset2 = new MyStdMultiMap(aux_vect2, aux_vect2 + 50);
+         MyStdMultiMap *stdmultimap2 = new MyStdMultiMap(aux_vect2, aux_vect2 + 50);
          if(!CheckEqualContainers(shmmap2, stdmap2)) return 1;
-         if(!CheckEqualContainers(shmmultiset2, stdmultiset2)) return 1;
+         if(!CheckEqualContainers(shmmultimap2, stdmultimap2)) return 1;
+
          segment.destroy_ptr(shmmap2);
-         segment.destroy_ptr(shmmultiset2);
+         segment.destroy_ptr(shmmultimap2);
          delete stdmap2;
-         delete stdmultiset2;
+         delete stdmultimap2;
       }
 
       int i, j;
Modified: trunk/libs/interprocess/test/memory_algorithm_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/memory_algorithm_test_template.hpp	(original)
+++ trunk/libs/interprocess/test/memory_algorithm_test_template.hpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -17,6 +17,7 @@
 #include <new>
 #include <utility>
 #include <cstring>
+#include <cstdio>    //std::remove
 
 namespace boost { namespace interprocess { namespace test {
 
@@ -508,6 +509,102 @@
    return true;
 }
 
+
+//This test uses tests grow and shrink_to_fit functions
+template<class Allocator>
+bool test_grow_shrink_to_fit(Allocator &a)
+{
+   std::vector<void*> buffers;
+
+   std::size_t original_size = a.get_size();
+   std::size_t original_free = a.get_free_memory();
+
+   a.shrink_to_fit();
+
+   if(!a.all_memory_deallocated() && a.check_sanity())
+      return false;
+
+   std::size_t shrunk_size          = a.get_size();
+   std::size_t shrunk_free_memory   = a.get_free_memory();
+   if(shrunk_size != a.get_min_size())
+      return 1;
+
+   a.grow(original_size - shrunk_size);
+
+   if(!a.all_memory_deallocated() && a.check_sanity())
+      return false;
+
+   if(original_size != a.get_size())
+      return false;
+   if(original_free != a.get_free_memory())
+      return false;
+
+   //Allocate memory
+   for(int i = 0; true; ++i){
+      void *ptr = a.allocate(i, std::nothrow);
+      if(!ptr)
+         break;
+      buffers.push_back(ptr);
+   }
+
+   //Now deallocate the half of the blocks
+   //so expand maybe can merge new free blocks
+   for(int i = 0, max = (int)buffers.size()
+      ;i < max
+      ;++i){
+      if(i%2){
+         a.deallocate(buffers[i]);
+         buffers[i] = 0;
+      }
+   }
+
+   //Deallocate the rest of the blocks
+
+   //Deallocate it in non sequential order
+   for(int j = 0, max = (int)buffers.size()
+      ;j < max
+      ;++j){
+      int pos = (j%4)*((int)buffers.size())/4;
+      std::size_t old_free = a.get_free_memory();
+      a.shrink_to_fit();
+      if(!a.check_sanity())   return false;
+      if(original_size < a.get_size())    return false;
+      if(old_free < a.get_free_memory())  return false;
+
+      a.grow(original_size - a.get_size());
+
+      if(!a.check_sanity())   return false;
+      if(original_size != a.get_size())         return false;
+      if(old_free      != a.get_free_memory())  return false;
+
+      a.deallocate(buffers[pos]);
+      buffers.erase(buffers.begin()+pos);
+   }
+
+   //Now shrink it to the maximum
+   a.shrink_to_fit();
+
+   if(a.get_size() != a.get_min_size())
+      return 1;
+
+   if(shrunk_free_memory != a.get_free_memory())
+      return 1;
+
+   if(!a.all_memory_deallocated() && a.check_sanity())
+      return false;
+
+   a.grow(original_size - shrunk_size);
+
+   if(original_size != a.get_size())
+      return false;
+   if(original_free != a.get_free_memory())
+      return false;
+
+   if(!a.all_memory_deallocated() && a.check_sanity())
+      return false;
+   return true;
+}
+
 //This test allocates multiple values until there is no more memory
 //and after that deallocates all in the inverse order
 template<class Allocator>
@@ -526,6 +623,8 @@
          void *ptr = a.allocate(i, std::nothrow);
          if(!ptr)
             break;
+         if(!a.check_sanity())
+            return false;
          buffers2.push_back(ptr);
       }
 
@@ -540,6 +639,9 @@
          }
       }
 
+      if(!a.check_sanity())
+         return false;
+
       std::vector<void*> buffers;
       for(int i = 0; true; ++i){
          multiallocation_iterator it = a.allocate_many(i+1, (i+1)*2, std::nothrow);
@@ -555,6 +657,9 @@
             return false;
       }
 
+      if(!a.check_sanity())
+         return false;
+
       switch(t){
          case DirectDeallocation:
          {
@@ -811,6 +916,15 @@
       return false;
    }
 
+   std::cout << "Starting test_grow_shrink_to_fit. Class: "
+             << typeid(a).name() << std::endl;
+
+   if(!test_grow_shrink_to_fit(a)){
+      std::cout << "test_grow_shrink_to_fit failed. Class: "
+                << typeid(a).name() << std::endl;
+      return false;
+   }
+
    return true;
 }
 
Modified: trunk/libs/interprocess/test/node_pool_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/node_pool_test.cpp	(original)
+++ trunk/libs/interprocess/test/node_pool_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -8,157 +8,19 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 #include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/managed_shared_memory.hpp>
+#include "node_pool_test.hpp"
 #include <boost/interprocess/allocators/detail/node_pool.hpp>
-#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
-#include <boost/interprocess/smart_ptr/deleter.hpp>
-#include <boost/interprocess/detail/type_traits.hpp>
-#include <vector>
-#include <cstddef>
-#include <string>
-#include "get_process_id_name.hpp"
 
-using namespace boost::interprocess;
 
-template <class NodePool>
-struct test_node_pool
-{
-   static bool allocate_then_deallocate(NodePool &pool);
-   static bool deallocate_free_chunks(NodePool &pool);
-};
-
-template <class NodePool>
-bool test_node_pool<NodePool>::allocate_then_deallocate(NodePool &pool)
-{
-   const std::size_t num_alloc = 1 + 3*NodePool::nodes_per_chunk;
-
-   std::vector<void*> nodes;
-
-   //Precondition, the pool must be empty
-   if(0 != pool.num_free_nodes()){
-      return false;
-   }
-
-   //First allocate nodes
-   for(std::size_t i = 0; i < num_alloc; ++i){
-      nodes.push_back(pool.allocate(1));
-   }
-
-   //Check that the free count is correct
-   if((NodePool::nodes_per_chunk - 1) != pool.num_free_nodes()){
-      return false;
-   }
-   
-   //Now deallocate all and check again
-   for(std::size_t i = 0; i < num_alloc; ++i){
-       pool.deallocate(nodes[i], 1);
-   }
-
-   //Check that the free count is correct
-   if(4*NodePool::nodes_per_chunk != pool.num_free_nodes()){
-      return false;
-   }
-   
-   pool.deallocate_free_chunks();
-
-   if(0 != pool.num_free_nodes()){
-      return false;
-   }
-
-   return true;
-}
-
-template <class NodePool>
-bool test_node_pool<NodePool>::deallocate_free_chunks(NodePool &pool)
-{
-   const std::size_t max_chunks        = 10;
-   const std::size_t max_nodes         = max_chunks*NodePool::nodes_per_chunk;
-   const std::size_t nodes_per_chunk   = NodePool::nodes_per_chunk;
-
-   std::vector<void*> nodes;
-
-   //Precondition, the pool must be empty
-   if(0 != pool.num_free_nodes()){
-      return false;
-   }
-
-   //First allocate nodes
-   for(std::size_t i = 0; i < max_nodes; ++i){
-      nodes.push_back(pool.allocate(1));
-   }
-
-   //Check that the free count is correct
-   if(0 != pool.num_free_nodes()){
-      return false;
-   }
-   
-   //Now deallocate one of each chunk per iteration
-   for(std::size_t node_i = 0; node_i < nodes_per_chunk; ++node_i){
-      //Deallocate a node per chunk
-      for(std::size_t i = 0; i < max_chunks; ++i){
-         pool.deallocate(nodes[i*nodes_per_chunk + node_i], 1);
-      }
-
-      //Check that the free count is correct
-      if(max_chunks*(node_i+1) != pool.num_free_nodes()){
-         return false;
-      }
-      
-      //Now try to deallocate free chunks
-      pool.deallocate_free_chunks();
-
-      //Until we don't deallocate the last node of every chunk
-      //no node should be deallocated
-      if(node_i != (nodes_per_chunk - 1)){
-         if(max_chunks*(node_i+1) != pool.num_free_nodes()){
-            return false;
-         }
-      }
-      else{
-         //If this is the last iteration, all the memory should
-         //have been deallocated.
-         if(0 != pool.num_free_nodes()){
-            return false;
-         }
-      }
-   }
-
-   return true;
-}
 
-template<std::size_t NodeSize, std::size_t NodesPerChunk>
-bool test_all_node_pool()
+int main ()
 {
+   using namespace boost::interprocess;
    typedef managed_shared_memory::segment_manager segment_manager;
    typedef detail::private_node_pool
-      <segment_manager, NodeSize, NodesPerChunk> node_pool_t;
+      <segment_manager, 4, 64> node_pool_t;
 
-   typedef test_node_pool<node_pool_t> test_node_pool_t;
-   shared_memory_object::remove(test::get_process_id_name());
-   {
-      managed_shared_memory shm(create_only, test::get_process_id_name(), 16*1024);
-
-      typedef deleter<node_pool_t, segment_manager> deleter_t;
-      typedef unique_ptr<node_pool_t, deleter_t> unique_ptr_t;
-
-      //Delete the pool when the tests end
-      unique_ptr_t p
-         (shm.construct<node_pool_t>(anonymous_instance)(shm.get_segment_manager())
-         ,deleter_t(shm.get_segment_manager()));
-
-      //Now call each test
-      if(!test_node_pool_t::allocate_then_deallocate(*p))
-         return false;
-      if(!test_node_pool_t::deallocate_free_chunks(*p))
-         return false;
-   }
-   shared_memory_object::remove(test::get_process_id_name());
-   return true;
-}
-
-int main ()
-{
-   if(!test_all_node_pool<4, 64>())
+   if(!test::test_all_node_pool<node_pool_t>())
       return 1;
 
    return 0;
Added: trunk/libs/interprocess/test/node_pool_test.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/test/node_pool_test.hpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -0,0 +1,163 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2007. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/managed_shared_memory.hpp>
+#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
+#include <boost/interprocess/smart_ptr/deleter.hpp>
+#include <boost/interprocess/detail/type_traits.hpp>
+#include <vector>
+#include <cstddef>
+#include <string>
+#include "get_process_id_name.hpp"
+
+namespace boost {
+namespace interprocess {
+namespace test {
+
+template <class NodePool>
+struct test_node_pool
+{
+   static bool allocate_then_deallocate(NodePool &pool);
+   static bool deallocate_free_chunks(NodePool &pool);
+};
+
+template <class NodePool>
+bool test_node_pool<NodePool>::allocate_then_deallocate(NodePool &pool)
+{
+   const std::size_t num_alloc = 1 + 3*pool.get_real_num_node();
+
+   std::vector<void*> nodes;
+
+   //Precondition, the pool must be empty
+   if(0 != pool.num_free_nodes()){
+      return false;
+   }
+
+   //First allocate nodes
+   for(std::size_t i = 0; i < num_alloc; ++i){
+      nodes.push_back(pool.allocate(1));
+   }
+
+   //Check that the free count is correct
+   if((pool.get_real_num_node() - 1) != pool.num_free_nodes()){
+      return false;
+   }
+   
+   //Now deallocate all and check again
+   for(std::size_t i = 0; i < num_alloc; ++i){
+       pool.deallocate(nodes[i], 1);
+   }
+
+   //Check that the free count is correct
+   if(4*pool.get_real_num_node() != pool.num_free_nodes()){
+      return false;
+   }
+   
+   pool.deallocate_free_chunks();
+
+   if(0 != pool.num_free_nodes()){
+      return false;
+   }
+
+   return true;
+}
+
+template <class NodePool>
+bool test_node_pool<NodePool>::deallocate_free_chunks(NodePool &pool)
+{
+   const std::size_t max_chunks        = 10;
+   const std::size_t max_nodes         = max_chunks*pool.get_real_num_node();
+   const std::size_t nodes_per_chunk   = pool.get_real_num_node();
+
+   std::vector<void*> nodes;
+
+   //Precondition, the pool must be empty
+   if(0 != pool.num_free_nodes()){
+      return false;
+   }
+
+   //First allocate nodes
+   for(std::size_t i = 0; i < max_nodes; ++i){
+      nodes.push_back(pool.allocate(1));
+   }
+
+   //Check that the free count is correct
+   if(0 != pool.num_free_nodes()){
+      return false;
+   }
+   
+   //Now deallocate one of each chunk per iteration
+   for(std::size_t node_i = 0; node_i < nodes_per_chunk; ++node_i){
+      //Deallocate a node per chunk
+      for(std::size_t i = 0; i < max_chunks; ++i){
+         pool.deallocate(nodes[i*nodes_per_chunk + node_i], 1);
+      }
+
+      //Check that the free count is correct
+      if(max_chunks*(node_i+1) != pool.num_free_nodes()){
+         return false;
+      }
+      
+      //Now try to deallocate free chunks
+      pool.deallocate_free_chunks();
+
+      //Until we don't deallocate the last node of every chunk
+      //no node should be deallocated
+      if(node_i != (nodes_per_chunk - 1)){
+         if(max_chunks*(node_i+1) != pool.num_free_nodes()){
+            return false;
+         }
+      }
+      else{
+         //If this is the last iteration, all the memory should
+         //have been deallocated.
+         if(0 != pool.num_free_nodes()){
+            return false;
+         }
+      }
+   }
+
+   return true;
+}
+
+template<class node_pool_t>
+bool test_all_node_pool()
+{
+   using namespace boost::interprocess;
+   typedef managed_shared_memory::segment_manager segment_manager;
+
+   typedef boost::interprocess::test::test_node_pool<node_pool_t> test_node_pool_t;
+   shared_memory_object::remove(test::get_process_id_name());
+   {
+      managed_shared_memory shm(create_only, test::get_process_id_name(), 16*1024);
+
+      typedef deleter<node_pool_t, segment_manager> deleter_t;
+      typedef unique_ptr<node_pool_t, deleter_t> unique_ptr_t;
+
+      //Delete the pool when the tests end
+      unique_ptr_t p
+         (shm.construct<node_pool_t>(anonymous_instance)(shm.get_segment_manager())
+         ,deleter_t(shm.get_segment_manager()));
+
+      //Now call each test
+      if(!test_node_pool_t::allocate_then_deallocate(*p))
+         return false;
+      if(!test_node_pool_t::deallocate_free_chunks(*p))
+         return false;
+   }
+   shared_memory_object::remove(test::get_process_id_name());
+   return true;
+}
+
+}  //namespace test {
+}  //namespace interprocess {
+}  //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
Modified: trunk/libs/interprocess/test/null_index_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/null_index_test.cpp	(original)
+++ trunk/libs/interprocess/test/null_index_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -13,7 +13,7 @@
 #include <boost/interprocess/managed_shared_memory.hpp>
 #include <boost/interprocess/mem_algo/simple_seq_fit.hpp>
 #include <cstddef>
-#include <assert.h>
+#include <cassert>
 #include <string>
 #include "get_process_id_name.hpp"
 
Modified: trunk/libs/interprocess/test/set_test.hpp
==============================================================================
--- trunk/libs/interprocess/test/set_test.hpp	(original)
+++ trunk/libs/interprocess/test/set_test.hpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -98,6 +98,7 @@
             std::cout << "Error in construct<MyShmMultiSet>(MyShmMultiSet2)" << std::endl;
             return 1;
          }
+
          segment.destroy_ptr(shmset2);
          segment.destroy_ptr(shmmultiset2);
          delete stdset2;
Modified: trunk/libs/interprocess/test/sharable_mutex_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/sharable_mutex_test_template.hpp	(original)
+++ trunk/libs/interprocess/test/sharable_mutex_test_template.hpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -30,7 +30,7 @@
 #include <boost/interprocess/sync/sharable_lock.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
 #include <iostream>
-#include <assert.h>
+#include <cassert>
 #include "util.hpp"
 
 namespace boost { namespace interprocess { namespace test {
Modified: trunk/libs/interprocess/test/shared_memory_mapping_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/shared_memory_mapping_test.cpp	(original)
+++ trunk/libs/interprocess/test/shared_memory_mapping_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -117,6 +117,7 @@
    catch(std::exception &exc){
       shared_memory_object::remove(test::get_process_id_name());
       std::cout << "Unhandled exception: " << exc.what() << std::endl;
+      return 1;
    }
    shared_memory_object::remove(test::get_process_id_name());
    return 0;
Modified: trunk/libs/interprocess/test/shared_memory_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/shared_memory_test.cpp	(original)
+++ trunk/libs/interprocess/test/shared_memory_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -79,6 +79,7 @@
    catch(std::exception &ex){
       shared_memory_object::remove(ShmName);
       std::cout << ex.what() << std::endl;
+      return 1;
    }
    shared_memory_object::remove(ShmName);
    return 0;
Modified: trunk/libs/interprocess/test/tree_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/tree_test.cpp	(original)
+++ trunk/libs/interprocess/test/tree_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -132,7 +132,6 @@
       return 1;
    }
 
-   using namespace boost::interprocess::detail;
    if(0 != test::set_test_copyable<my_managed_shared_memory
                         ,MyShmSet
                         ,MyStdSet
Modified: trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp	(original)
+++ trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -116,6 +116,7 @@
    }
    catch(std::exception &exc){
       std::cout << "Unhandled exception: " << exc.what() << std::endl;
+      return 1;
    }
 
    return 0;
Modified: trunk/libs/interprocess/test/windows_shared_memory_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/windows_shared_memory_test.cpp	(original)
+++ trunk/libs/interprocess/test/windows_shared_memory_test.cpp	2007-11-18 05:51:19 EST (Sun, 18 Nov 2007)
@@ -66,6 +66,7 @@
    }
    catch(std::exception &ex){
       std::cout << ex.what() << std::endl;
+      return 1;
    }
    return 0;
 }