[Box Backup] ./runtest.pl common debug fails

Jamie Webb boxbackup@fluffy.co.uk
Wed, 16 Nov 2005 15:53:02 +0000


On Wed, Nov 16, 2005 at 10:26:46AM +0000, Ben Summers wrote:
> tells you what happened. In fact, this is harmless, it's a check to  
> see that realloc reallocated a block, which on your platform it  
> didn't. The test hopes the block was reallocated so it can check the  
> debug leak checking is working.

Linux realloc expands blocks in-place if it can. It's easy to pretty
much guarantee that it can't:

diff -Naur boxbackup-0.09/test/common/testcommon.cpp boxbackup-mod/test/common/testcommon.cpp
--- boxbackup-0.09/test/common/testcommon.cpp	2004-12-06 12:58:48.000000000 +0000
+++ boxbackup-mod/test/common/testcommon.cpp	2005-11-16 15:07:14.000000000 +0000
@@ -176,11 +176,13 @@
 	{
 		TEST_THAT(memleakfinder_numleaks() == 0);
 		void *block = ::malloc(12);
-		TEST_THAT(memleakfinder_numleaks() == 1);
+		void *dummy = ::malloc(12);
+		TEST_THAT(memleakfinder_numleaks() == 2);
 		void *b2 = ::realloc(block, 128*1024);
 		TEST_THAT(block != b2);
-		TEST_THAT(memleakfinder_numleaks() == 1);
+		TEST_THAT(memleakfinder_numleaks() == 2);
 		::free(b2);
+		::free(dummy);
 		TEST_THAT(memleakfinder_numleaks() == 0);
 		char *test = new char[1024];
 		TEST_THAT(memleakfinder_numleaks() == 1);

-- Jamie Webb