Re: cvs commit: squid3/lib MemPool.cc

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Wed, 23 May 2007 22:49:18 +0200

tor 2007-05-24 klockan 00:59 +1200 skrev Amos Jeffries:
> >
>
> Did you run make check before committing any of the days changes?
>
> I'm getting 7 of 14 core unit tests fail. Two on MemPool.cc:240, the
> rest on silent segfault.

> Assertion failed: (aLabel != NULL && aSize) at MemPool.cc:240

Hmm...

(gdb) p StrPoolsAttrs
$3 = {{name = 0x509d01 "Short Strings", obj_size = 0}, {name = 0x509d0f
"Medium Strings", obj_size = 0}, {
    name = 0x509d1e "Long Strings", obj_size = 0}}

doesn't look quite right.

Looks like C++ magics strikes again and Mem::Init is called (via the
Initer test class) before StrPoolsAttrs has been assigned..

Mem::Init needs to be called via the setUp() method, not from an
automatic instantiation constructor..

Index: src/tests/testCacheManager.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/tests/testCacheManager.cc,v
retrieving revision 1.2
diff -u -p -r1.2 testCacheManager.cc
--- src/tests/testCacheManager.cc 18 May 2007 06:41:33 -0000
1.2
+++ src/tests/testCacheManager.cc 23 May 2007 20:47:42 -0000
@@ -17,12 +17,10 @@ shut_down(int)
 
 /* init memory pools */
 
-struct Initer
+void testCacheManager::setUp()
 {
- Initer() {Mem::Init();}
-};
-
-static Initer ensure_mempools;
+ Mem::Init();
+}
 
 /*
  * Test creating a CacheManager
Index: src/tests/testCacheManager.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/tests/testCacheManager.h,v
retrieving revision 1.1
diff -u -p -r1.1 testCacheManager.h
--- src/tests/testCacheManager.h 29 May 2006 00:15:09 -0000
1.1
+++ src/tests/testCacheManager.h 23 May 2007 20:47:42 -0000
@@ -16,6 +16,7 @@ class testCacheManager : public CPPUNIT_
     CPPUNIT_TEST_SUITE_END();
 
 public:
+ void setUp();
 
 protected:
     void testCreate();

Received on Wed May 23 2007 - 14:49:25 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Jun 01 2007 - 12:00:09 MDT